diff --git a/ABOUT-NLS b/ABOUT-NLS index 5fde45a..47d5e39 100644 --- a/ABOUT-NLS +++ b/ABOUT-NLS @@ -113,6 +113,13 @@ But in fact, some languages have dialects in different countries. For example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The country code serves to distinguish the dialects. + The locale naming convention of `LL_CC', with `LL' denoting the +language and `CC' denoting the country, is the one use on systems based +on GNU libc. On other systems, some variations of this scheme are +used, such as `LL' or `LL_CC.ENCODING'. You can get the list of +locales supported by your system for your country by running the command +`locale -a | grep '^LL''. + Not all programs have translations for all languages. By default, an English message is shown in place of a nonexistent translation. If you understand other languages, you can set up a priority list of languages. @@ -164,128 +171,422 @@ Available Packages ================== Languages are not equally supported in all packages. The following -matrix shows the current state of internationalization, as of September -2001. The matrix shows, in regard of each package, for which languages -PO files have been submitted to translation coordination, with a +matrix shows the current state of internationalization, as of May 2003. +The matrix shows, in regard of each package, for which languages PO +files have been submitted to translation coordination, with a translation percentage of at least 50%. - Ready PO files bg cs da de el en eo es et fi fr gl he hr id it ja - +----------------------------------------------------+ - a2ps | [] [] [] | - bash | [] [] [] [] | - bfd | | - binutils | [] | - bison | [] [] [] [] [] | - clisp | [] [] [] [] | - cpio | [] [] [] [] [] | - diffutils | [] [] [] [] [] [] [] | - enscript | [] [] | - error | [] [] | - fetchmail | | - fileutils | [] [] [] [] [] [] [] [] | - findutils | [] [] [] [] [] [] [] [] | - flex | [] [] [] | - freetype | | - gas | | - gawk | [] [] | - gcal | | - gcc | | - gettext | [] [] [] [] [] [] [] [] [] [] | - gnupg | [] [] [] [] [] [] [] | - gprof | | - grep | [] [] [] [] [] [] [] [] | - hello | [] [] [] [] [] [] [] [] [] [] [] | - id-utils | [] [] [] | - indent | [] [] [] [] [] | - jpilot | [] | - kbd | | - ld | [] | - libc | [] [] [] [] [] [] [] [] | - lilypond | [] | - lynx | [] [] [] [] | - m4 | [] [] [] [] [] [] [] [] | - make | [] [] [] [] [] [] | - mysecretdiary | [] | - nano | [] [] [] | - opcodes | | - parted | [] [] [] | - ptx | [] [] [] [] [] [] [] | - python | | - recode | [] [] [] [] [] [] [] [] [] | - sed | [] [] [] [] [] [] [] [] [] [] [] [] | - sh-utils | [] [] [] [] [] [] [] [] [] [] | - sharutils | [] [] [] [] [] [] [] [] | - sketch | | - soundtracker | [] [] [] | - sp | | - tar | [] [] [] [] [] [] [] [] | - texinfo | [] [] [] [] [] [] | - textutils | [] [] [] [] [] [] [] [] | - util-linux | [] [] | - wdiff | [] [] [] | - wget | [] [] [] [] [] [] [] [] [] [] | - +----------------------------------------------------+ - bg cs da de el en eo es et fi fr gl he hr id it ja - 0 14 24 32 11 1 8 23 13 1 33 22 4 0 7 9 18 + Ready PO files am az be bg ca cs da de el en en_GB eo es + +-------------------------------------------+ + a2ps | [] [] [] [] | + aegis | () | + anubis | | + ap-utils | | + bash | [] [] [] | + batchelor | | + bfd | [] [] | + binutils | [] [] | + bison | [] [] [] | + bluez-pin | [] [] | + clisp | | + clisp | [] [] [] | + coreutils | [] [] [] [] | + cpio | [] [] [] | + darkstat | () [] | + diffutils | [] [] [] [] [] [] [] | + e2fsprogs | [] [] | + enscript | [] [] [] [] | + error | [] [] [] [] [] | + fetchmail | [] () [] [] [] [] | + fileutils | [] [] [] | + findutils | [] [] [] [] [] [] | + flex | [] [] [] [] | + gas | [] | + gawk | [] [] [] [] | + gcal | [] | + gcc | [] [] | + gettext | [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] | + gettext-tools | [] [] | + gimp-print | [] [] [] [] [] | + gliv | | + glunarclock | [] [] [] | + gnucash | () [] | + gnucash-glossary | [] () [] | + gnupg | [] () [] [] [] [] | + gpe-calendar | [] | + gpe-conf | [] | + gpe-contacts | [] | + gpe-edit | | + gpe-login | [] | + gpe-ownerinfo | [] | + gpe-sketchbook | [] | + gpe-timesheet | | + gpe-today | [] | + gpe-todo | [] | + gphoto2 | [] [] [] [] | + gprof | [] [] | + gpsdrive | () () () | + grep | [] [] [] [] [] | + gretl | [] | + hello | [] [] [] [] [] [] | + id-utils | [] [] | + indent | [] [] [] [] | + jpilot | [] [] [] [] | + jwhois | [] | + kbd | [] [] [] [] [] | + ld | [] [] | + libc | [] [] [] [] [] [] | + libgpewidget | [] | + libiconv | [] [] [] [] [] | + lifelines | [] () | + lilypond | [] | + lingoteach | | + lingoteach_lessons | () () | + lynx | [] [] [] [] | + m4 | [] [] [] [] | + mailutils | [] [] | + make | [] [] [] | + man-db | [] () [] [] () | + mysecretdiary | [] [] [] | + nano | [] () [] [] [] | + nano_1_0 | [] () [] [] [] | + opcodes | [] [] | + parted | [] [] [] [] [] | + ptx | [] [] [] [] [] | + python | | + radius | | + recode | [] [] [] [] [] [] | + screem | | + sed | [] [] [] [] [] | + sh-utils | [] [] [] | + sharutils | [] [] [] [] [] [] | + sketch | [] () [] | + soundtracker | [] [] [] | + sp | [] | + tar | [] [] [] [] | + texinfo | [] [] [] [] | + textutils | [] [] [] [] | + tin | () () | + util-linux | [] [] [] [] [] | + vorbis-tools | [] [] [] | + wastesedge | () | + wdiff | [] [] [] [] | + wget | [] [] [] [] [] [] [] | + xchat | [] [] [] | + xpad | | + +-------------------------------------------+ + am az be bg ca cs da de el en en_GB eo es + 0 1 4 2 31 17 54 60 14 1 4 12 56 - ko lv nb nl nn no pl pt pt_BR ru sk sl sv tr uk zh - +----------------------------------------------------+ - a2ps | [] [] [] | 6 - bash | | 4 - bfd | | 0 - binutils | | 1 - bison | [] | 6 - clisp | [] | 5 - cpio | [] [] [] [] [] | 10 - diffutils | [] [] [] [] | 11 - enscript | [] [] [] | 5 - error | [] [] | 4 - fetchmail | | 0 - fileutils | [] [] [] [] [] [] [] [] [] | 17 - findutils | [] [] [] [] [] [] [] [] | 16 - flex | [] [] [] | 6 - freetype | | 0 - gas | | 0 - gawk | [] | 3 - gcal | | 0 - gcc | | 0 - gettext | [] [] [] [] [] [] [] [] | 18 - gnupg | [] [] [] | 10 - gprof | | 0 - grep | [] [] [] [] | 12 - hello | [] [] [] [] [] [] [] [] [] [] [] | 22 - id-utils | [] [] [] | 6 - indent | [] [] [] [] [] [] [] | 12 - jpilot | | 1 - kbd | [] | 1 - ld | | 1 - libc | [] [] [] [] [] [] [] [] | 16 - lilypond | [] [] | 3 - lynx | [] [] [] [] | 8 - m4 | [] [] [] [] | 12 - make | [] [] [] [] [] [] | 12 - mysecretdiary | | 1 - nano | [] | 4 - opcodes | [] | 1 - parted | [] [] | 5 - ptx | [] [] [] [] [] [] [] [] | 15 - python | | 0 - recode | [] [] [] [] | 13 - sed | [] [] [] [] [] [] [] | 19 - sh-utils | [] [] [] [] [] [] [] [] [] [] [] | 21 - sharutils | [] [] [] | 11 - sketch | | 0 - soundtracker | | 3 - sp | | 0 - tar | [] [] [] [] [] [] [] | 15 - texinfo | [] | 7 - textutils | [] [] [] [] [] [] [] [] | 16 - util-linux | [] [] | 4 - wdiff | [] [] [] [] | 7 - wget | [] [] [] [] [] [] [] | 17 - +----------------------------------------------------+ - 33 teams ko lv nb nl nn no pl pt pt_BR ru sk sl sv tr uk zh - 53 domains 9 1 6 20 0 6 17 1 13 25 10 11 23 21 2 2 387 + et fa fi fr ga gl he hr hu id it ja ko + +----------------------------------------+ + a2ps | [] [] [] () () | + aegis | | + anubis | [] | + ap-utils | [] | + bash | [] [] | + batchelor | [] | + bfd | [] [] | + binutils | [] [] | + bison | [] [] [] [] | + bluez-pin | [] [] [] [] | + clisp | | + clisp | [] | + coreutils | [] [] [] [] | + cpio | [] [] [] [] | + darkstat | () [] [] [] | + diffutils | [] [] [] [] [] [] [] | + e2fsprogs | | + enscript | [] [] | + error | [] [] [] [] | + fetchmail | [] | + fileutils | [] [] [] [] [] | + findutils | [] [] [] [] [] [] [] [] [] [] [] | + flex | [] [] | + gas | [] | + gawk | [] [] | + gcal | [] | + gcc | [] | + gettext | [] [] [] | + gettext-runtime | [] [] [] [] | + gettext-tools | [] | + gimp-print | [] [] | + gliv | () | + glunarclock | [] [] [] [] | + gnucash | [] | + gnucash-glossary | [] | + gnupg | [] [] [] [] [] [] [] | + gpe-calendar | [] | + gpe-conf | | + gpe-contacts | [] | + gpe-edit | [] [] | + gpe-login | [] | + gpe-ownerinfo | [] [] [] | + gpe-sketchbook | [] | + gpe-timesheet | [] [] [] | + gpe-today | [] [] | + gpe-todo | [] [] | + gphoto2 | [] [] [] | + gprof | [] [] | + gpsdrive | () [] () () | + grep | [] [] [] [] [] [] [] [] [] [] [] | + gretl | [] | + hello | [] [] [] [] [] [] [] [] [] [] [] [] [] | + id-utils | [] [] [] | + indent | [] [] [] [] [] [] [] [] | + jpilot | [] () | + jwhois | [] [] [] [] | + kbd | [] | + ld | [] | + libc | [] [] [] [] [] [] | + libgpewidget | [] [] [] | + libiconv | [] [] [] [] [] [] [] [] | + lifelines | () | + lilypond | [] | + lingoteach | [] [] | + lingoteach_lessons | | + lynx | [] [] [] [] | + m4 | [] [] [] [] | + mailutils | | + make | [] [] [] [] [] [] | + man-db | [] () () | + mysecretdiary | [] [] | + nano | [] [] [] [] | + nano_1_0 | [] [] [] [] | + opcodes | [] [] | + parted | [] [] [] | + ptx | [] [] [] [] [] [] [] | + python | | + radius | | + recode | [] [] [] [] [] [] | + screem | | + sed | [] [] [] [] [] [] [] [] | + sh-utils | [] [] [] [] [] [] | + sharutils | [] [] [] [] [] | + sketch | [] | + soundtracker | [] [] [] | + sp | [] () | + tar | [] [] [] [] [] [] [] [] [] | + texinfo | [] [] [] [] | + textutils | [] [] [] [] [] | + tin | [] () | + util-linux | [] [] [] [] () [] | + vorbis-tools | [] | + wastesedge | () | + wdiff | [] [] [] [] [] | + wget | [] [] [] [] [] [] [] [] | + xchat | [] [] [] | + xpad | | + +----------------------------------------+ + et fa fi fr ga gl he hr hu id it ja ko + 20 1 15 73 14 24 8 10 30 31 19 31 9 + + lg lt lv ms nb nl nn no pl pt pt_BR ro + +----------------------------------------+ + a2ps | [] [] () () () [] [] | + aegis | () | + anubis | [] [] | + ap-utils | () | + bash | [] | + batchelor | | + bfd | | + binutils | | + bison | [] [] [] [] | + bluez-pin | [] | + clisp | | + clisp | [] | + coreutils | [] | + cpio | [] [] [] | + darkstat | [] [] [] [] | + diffutils | [] [] [] | + e2fsprogs | | + enscript | [] [] | + error | [] [] | + fetchmail | () () | + fileutils | [] | + findutils | [] [] [] [] | + flex | [] | + gas | | + gawk | [] | + gcal | | + gcc | | + gettext | [] | + gettext-runtime | [] | + gettext-tools | | + gimp-print | [] | + gliv | [] | + glunarclock | [] | + gnucash | | + gnucash-glossary | [] [] | + gnupg | | + gpe-calendar | [] [] | + gpe-conf | [] [] | + gpe-contacts | [] | + gpe-edit | [] [] | + gpe-login | [] [] | + gpe-ownerinfo | [] [] | + gpe-sketchbook | [] [] | + gpe-timesheet | [] [] | + gpe-today | [] [] | + gpe-todo | [] [] | + gphoto2 | | + gprof | [] | + gpsdrive | () () () | + grep | [] [] [] [] | + gretl | | + hello | [] [] [] [] [] [] [] [] [] | + id-utils | [] [] [] | + indent | [] [] [] | + jpilot | () () | + jwhois | [] [] [] | + kbd | | + ld | | + libc | [] [] [] [] | + libgpewidget | [] [] | + libiconv | [] [] | + lifelines | | + lilypond | [] | + lingoteach | | + lingoteach_lessons | | + lynx | [] [] | + m4 | [] [] [] [] | + mailutils | | + make | [] [] | + man-db | [] | + mysecretdiary | [] | + nano | [] [] [] [] | + nano_1_0 | [] [] [] [] | + opcodes | [] [] [] | + parted | [] [] [] | + ptx | [] [] [] [] [] [] [] | + python | | + radius | | + recode | [] [] [] | + screem | | + sed | [] [] | + sh-utils | [] | + sharutils | [] | + sketch | [] | + soundtracker | | + sp | | + tar | [] [] [] [] [] [] | + texinfo | [] | + textutils | [] | + tin | | + util-linux | [] [] | + vorbis-tools | [] [] | + wastesedge | | + wdiff | [] [] [] [] | + wget | [] [] [] | + xchat | [] [] | + xpad | [] | + +----------------------------------------+ + lg lt lv ms nb nl nn no pl pt pt_BR ro + 0 0 2 11 7 26 3 4 18 15 34 34 + + ru sk sl sr sv ta tr uk vi wa zh_CN zh_TW + +-------------------------------------------+ + a2ps | [] [] [] [] [] | 16 + aegis | () | 0 + anubis | [] [] | 5 + ap-utils | () | 1 + bash | [] | 7 + batchelor | | 1 + bfd | [] [] [] | 7 + binutils | [] [] [] | 7 + bison | [] [] | 13 + bluez-pin | | 7 + clisp | | 0 + clisp | | 5 + coreutils | [] [] [] [] [] | 14 + cpio | [] [] [] | 13 + darkstat | [] () () | 9 + diffutils | [] [] [] [] | 21 + e2fsprogs | [] | 3 + enscript | [] [] [] | 11 + error | [] [] [] | 14 + fetchmail | [] | 7 + fileutils | [] [] [] [] [] [] | 15 + findutils | [] [] [] [] [] [] | 27 + flex | [] [] [] | 10 + gas | [] | 3 + gawk | [] [] | 9 + gcal | [] [] | 4 + gcc | [] | 4 + gettext | [] [] [] [] [] [] | 15 + gettext-runtime | [] [] [] [] [] [] | 16 + gettext-tools | [] [] | 5 + gimp-print | [] [] | 10 + gliv | | 1 + glunarclock | [] [] [] | 11 + gnucash | [] [] | 4 + gnucash-glossary | [] [] [] | 8 + gnupg | [] [] [] [] | 16 + gpe-calendar | [] | 5 + gpe-conf | | 3 + gpe-contacts | [] | 4 + gpe-edit | [] | 5 + gpe-login | [] | 5 + gpe-ownerinfo | [] | 7 + gpe-sketchbook | [] | 5 + gpe-timesheet | [] | 6 + gpe-today | [] | 6 + gpe-todo | [] | 6 + gphoto2 | [] [] | 9 + gprof | [] [] | 7 + gpsdrive | [] [] | 3 + grep | [] [] [] [] | 24 + gretl | | 2 + hello | [] [] [] [] [] | 33 + id-utils | [] [] [] | 11 + indent | [] [] [] [] | 19 + jpilot | [] [] [] [] [] | 10 + jwhois | () () [] [] | 10 + kbd | [] [] | 8 + ld | [] [] | 5 + libc | [] [] [] [] | 20 + libgpewidget | | 6 + libiconv | [] [] [] [] [] [] | 21 + lifelines | [] | 2 + lilypond | [] | 4 + lingoteach | | 2 + lingoteach_lessons | () | 0 + lynx | [] [] [] [] | 14 + m4 | [] [] [] | 15 + mailutils | | 2 + make | [] [] [] [] | 15 + man-db | [] | 6 + mysecretdiary | [] [] | 8 + nano | [] [] [] | 15 + nano_1_0 | [] [] [] | 15 + opcodes | [] [] | 9 + parted | [] [] | 13 + ptx | [] [] [] | 22 + python | | 0 + radius | | 0 + recode | [] [] [] [] | 19 + screem | [] | 1 + sed | [] [] [] [] [] | 20 + sh-utils | [] [] [] | 13 + sharutils | [] [] [] [] | 16 + sketch | [] | 5 + soundtracker | [] | 7 + sp | [] | 3 + tar | [] [] [] [] [] | 24 + texinfo | [] [] [] [] | 13 + textutils | [] [] [] [] [] | 15 + tin | | 1 + util-linux | [] [] | 14 + vorbis-tools | [] | 7 + wastesedge | | 0 + wdiff | [] [] [] [] | 17 + wget | [] [] [] [] [] [] [] | 25 + xchat | [] [] [] | 11 + xpad | | 1 + +-------------------------------------------+ + 50 teams ru sk sl sr sv ta tr uk vi wa zh_CN zh_TW + 97 domains 32 19 16 0 56 0 48 10 1 1 12 23 913 Some counters in the preceding matrix are higher than the number of visible blocks let us expect. This is because a few extra PO files are @@ -298,9 +599,9 @@ distributed as such by its maintainer. There might be an observable lag between the mere existence a PO file and its wide availability in a distribution. - If September 2001 seems to be old, you may fetch a more recent copy -of this `ABOUT-NLS' file on most GNU archive sites. The most -up-to-date matrix with full percentage details can be found at + If May 2003 seems to be old, you may fetch a more recent copy of +this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date +matrix with full percentage details can be found at `http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'. Using `gettext' in new packages @@ -315,7 +616,7 @@ library, whereas only free software can use `libintl' as a static library or use modified versions of `libintl'. Once the sources are changed appropriately and the setup can handle -to use of `gettext' the only thing missing are the translations. The +the use of `gettext' the only thing missing are the translations. The Free Translation Project is also available for packages which are not developed inside the GNU project. Therefore the information given above applies also for every other Free Software Project. Contact diff --git a/AUTHORS b/AUTHORS index 4721984..a4ee5f2 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,6 +1,6 @@ Main tinc authors: -Guus Sliepen -Ivo Timmermans +Guus Sliepen +Ivo Timmermans These files are from other sources: * lib/pidfile.h and lib/pidfile.c are by Martin Schulze, taken from diff --git a/COPYING b/COPYING index a43ea21..d60c31a 100644 --- a/COPYING +++ b/COPYING @@ -2,7 +2,7 @@ Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA + 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. @@ -279,7 +279,7 @@ POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS - Appendix: How to Apply These Terms to Your New Programs + 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 @@ -291,7 +291,7 @@ 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. - Copyright (C) 19yy + Copyright (C) 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 @@ -305,14 +305,15 @@ the "copyright" line and a pointer to where the full notice is found. 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., 675 Mass Ave, Cambridge, MA 02139, USA. + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision 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. diff --git a/COPYING.README b/COPYING.README index 144207e..26b4b1d 100644 --- a/COPYING.README +++ b/COPYING.README @@ -1,4 +1,14 @@ -This program is released under the GPL with the additional exemption -that compiling, linking, and/or using OpenSSL is allowed. You may -provide binary packages linked to the OpenSSL libraries, provided that -all other requirements of the GPL are met. +The following applies to tinc: + +This program is released under the GPL with the additional exemption that +compiling, linking, and/or using OpenSSL is allowed. You may provide binary +packages linked to the OpenSSL libraries, provided that all other requirements +of the GPL are met. + +The following applies to the LZO library: + +Hereby I grant a special exception to the tinc VPN project +(http://tinc.nl.linux.org/) to link the LZO library with the OpenSSL library +(http://www.openssl.org). + +Markus F.X.J. Oberhumer diff --git a/ChangeLog b/ChangeLog index 7622c02..9f5eca2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4614 +1,6094 @@ -2002-04-09 13:51 Guus Sliepen +------------------------------------------------------------------------ +r1418 | guus | 2004-11-11 12:17:04 +0100 (Thu, 11 Nov 2004) | 2 lines - * configure.in: This is the release of 1.0pre7. +Short readme about how to compile tinc from a Subversion checkout. -2002-04-09 13:44 Guus Sliepen +------------------------------------------------------------------------ +r1417 | guus | 2004-11-11 00:28:32 +0100 (Thu, 11 Nov 2004) | 2 lines - * NEWS, README: Remarks about 1.0pre7 release. +Updated dutch translation. -2002-04-09 13:43 Guus Sliepen +------------------------------------------------------------------------ +r1416 | guus | 2004-11-11 00:21:41 +0100 (Thu, 11 Nov 2004) | 2 lines - * po/nl.po: Updated dutch translation. +Remove duplication. -2002-04-09 13:43 Guus Sliepen +------------------------------------------------------------------------ +r1415 | guus | 2004-11-11 00:20:59 +0100 (Thu, 11 Nov 2004) | 2 lines - * doc/: PROTOCOL, tinc.conf.5, tinc.texi: masklength is better - known as prefixlength +Set BSD tuns to broadcast mode. On OpenBSD, this enables IPv6 on the tun device! -2002-04-09 13:42 Guus Sliepen +------------------------------------------------------------------------ +r1414 | guus | 2004-11-10 22:57:04 +0100 (Wed, 10 Nov 2004) | 2 lines - * src/: conf.c, subnet.c, subnet.h: masklength is better known as - prefixlength. +Update documentation. -2002-04-08 15:27 Guus Sliepen +------------------------------------------------------------------------ +r1413 | guus | 2004-11-10 22:56:31 +0100 (Wed, 10 Nov 2004) | 2 lines - * Makefile.am: Automake forgets about depcomp, remind it. +Add BlockingTCP option, useful when using TCPOnly on slow or congested links. -2002-04-05 11:11 Guus Sliepen +------------------------------------------------------------------------ +r1412 | guus | 2004-11-10 22:14:08 +0100 (Wed, 10 Nov 2004) | 2 lines - * src/netutl.c: Fix maskcheck() and maskcmp(). +Support tunneling IPv6 on Solaris. -2002-04-01 23:28 Guus Sliepen +------------------------------------------------------------------------ +r1411 | guus | 2004-11-10 20:36:02 +0100 (Wed, 10 Nov 2004) | 2 lines - * src/net_setup.c: check_rsa() is broken, I don't know why, just - remove it for now. +Let compiler decide when to inline. -2002-04-01 23:28 Guus Sliepen +------------------------------------------------------------------------ +r1410 | guus | 2004-11-10 20:34:38 +0100 (Wed, 10 Nov 2004) | 2 lines - * src/net.c: Don't check_network_activity() if select() is - interrupted by a signal. +Fix order of arguments for tar. -2002-03-27 20:43 Guus Sliepen +------------------------------------------------------------------------ +r1409 | guus | 2004-11-10 19:11:44 +0100 (Wed, 10 Nov 2004) | 2 lines - * m4/zlib.m4: Make configure --help output look nicer. +Use the generic BSD tun/tap code. -2002-03-27 17:26 Guus Sliepen +------------------------------------------------------------------------ +r1408 | guus | 2004-11-10 19:10:59 +0100 (Wed, 10 Nov 2004) | 2 lines - * NEWS, README: Update with information about the pre6 release. +Missing check for NULL-pointer. -2002-03-27 17:00 Guus Sliepen +------------------------------------------------------------------------ +r1407 | guus | 2004-11-09 10:51:35 +0100 (Tue, 09 Nov 2004) | 2 lines - * po/nl.po: Update dutch translation. +Hopefully this really fixes late packet handling. -2002-03-27 17:00 Guus Sliepen +------------------------------------------------------------------------ +r1406 | guus | 2004-11-08 23:30:13 +0100 (Mon, 08 Nov 2004) | 2 lines - * src/openbsd/device.c: Fix format strings. +Fixed another bug in late packet handling. -2002-03-27 16:47 Guus Sliepen +------------------------------------------------------------------------ +r1405 | guus | 2004-11-08 23:11:33 +0100 (Mon, 08 Nov 2004) | 2 lines - * src/Makefile.am: Remove symlink to device.c when doing a make - dist. +Update to make it compile again. -2002-03-27 16:35 Guus Sliepen +------------------------------------------------------------------------ +r1404 | guus | 2004-11-08 23:03:28 +0100 (Mon, 08 Nov 2004) | 2 lines - * doc/Makefile.maint: Recent automake uses $(AMTAR) instead of - $(TAR) +Hoopjumping to get the default directories in the manuals properly. -2002-03-27 16:26 Guus Sliepen +------------------------------------------------------------------------ +r1403 | guus | 2004-11-02 21:50:53 +0100 (Tue, 02 Nov 2004) | 2 lines - * src/: edge.c, protocol.c, protocol_auth.c, protocol_edge.c: - Remove cruft. +Splay trees. -2002-03-27 16:26 Guus Sliepen +------------------------------------------------------------------------ +r1402 | guus | 2004-11-01 18:05:09 +0100 (Mon, 01 Nov 2004) | 2 lines - * doc/: tinc.conf.5, tinc.texi: Small updates. +Don't include .svn directory in sample configuration. -2002-03-27 16:01 Guus Sliepen +------------------------------------------------------------------------ +r1401 | guus | 2004-11-01 18:04:28 +0100 (Mon, 01 Nov 2004) | 2 lines - * src/: net.h, net_packet.c: Limit the amount of packets in a queue - to 8. +Check for sys/uio.h, net/if_tun.h and net/if_tap.h -2002-03-27 16:01 Guus Sliepen +------------------------------------------------------------------------ +r1400 | guus | 2004-11-01 18:02:19 +0100 (Mon, 01 Nov 2004) | 2 lines - * lib/: list.c, list.h: Extend list_t with the number of elements - in the list. +static -2002-03-27 15:02 Guus Sliepen +------------------------------------------------------------------------ +r1399 | guus | 2004-11-01 18:01:56 +0100 (Mon, 01 Nov 2004) | 2 lines - * src/: net.c, net_socket.c: Merge do_prune() with build_fdset(). - Probably fixes the invalid filedescriptor error. +Generic device driver for *BSD and MacOS/X -2002-03-26 14:19 Guus Sliepen +------------------------------------------------------------------------ +r1398 | guus | 2004-11-01 16:18:53 +0100 (Mon, 01 Nov 2004) | 2 lines - * doc/tinc.texi: Small correction. +Support alternative tun/tap driver from http://www-user.rhrk.uni-kl.de/~nissler/tuntap/ -2002-03-26 13:00 Guus Sliepen +------------------------------------------------------------------------ +r1397 | guus | 2004-11-01 16:18:22 +0100 (Mon, 01 Nov 2004) | 2 lines - * src/process.c: Fix execute_script(). +Don't let tinc service depend on NDIS component. -2002-03-25 16:51 Guus Sliepen +------------------------------------------------------------------------ +r1396 | guus | 2004-11-01 16:16:12 +0100 (Mon, 01 Nov 2004) | 2 lines - * src/net_packet.c: Send REQ_KEY only once until ANS_KEY has - arrived. +Correct return value. -2002-03-25 16:12 Guus Sliepen +------------------------------------------------------------------------ +r1395 | guus | 2004-10-01 20:26:15 +0200 (Fri, 01 Oct 2004) | 2 lines - * doc/tinc.texi: Tell a little bit more about security. +Allow tinc to work with the latest TAP-Win32 driver. -2002-03-25 16:01 Guus Sliepen +------------------------------------------------------------------------ +r1394 | guus | 2004-10-01 20:24:41 +0200 (Fri, 01 Oct 2004) | 2 lines - * doc/: tinc.conf.5, tinc.texi, tincd.8: Updated documentation. +strndupa() is too arcane for some environments. -2002-03-25 14:54 Guus Sliepen +------------------------------------------------------------------------ +r1393 | guus | 2004-10-01 20:23:08 +0200 (Fri, 01 Oct 2004) | 2 lines - * src/net_setup.c: Set myself->status.reachable. +Fix several #includes. -2002-03-24 18:14 Guus Sliepen +------------------------------------------------------------------------ +r1392 | guus | 2004-10-01 20:22:06 +0200 (Fri, 01 Oct 2004) | 3 lines - * src/conf.c: Configuration variables were still handled case - sensitively. +Move all #ifdef HAVE_HEADER_H #include to have.h, +this allows for simplification of configure.in. -2002-03-24 18:08 Guus Sliepen +------------------------------------------------------------------------ +r1391 | guus | 2004-09-20 22:56:14 +0200 (Mon, 20 Sep 2004) | 2 lines - * src/openbsd/device.c: OpenBSD tun device uses address family - number instead of Ethernet type. +Remove duplicate #include "system.h" -2002-03-24 17:50 Guus Sliepen +------------------------------------------------------------------------ +r1390 | guus | 2004-09-20 22:55:49 +0200 (Mon, 20 Sep 2004) | 2 lines - * src/openbsd/device.c: Respect type field. +Marking potential late packets was in the wrong place. -2002-03-24 17:40 Guus Sliepen +------------------------------------------------------------------------ +r1389 | guus | 2004-07-17 14:04:30 +0200 (Sat, 17 Jul 2004) | 2 lines - * po/nl.po: Updated dutch translation. +Don't set $INTERFACE automatically, don't quit on EINTR/EAGAIN. -2002-03-24 17:36 Guus Sliepen +------------------------------------------------------------------------ +r1388 | guus | 2004-07-17 02:09:14 +0200 (Sat, 17 Jul 2004) | 3 lines - * src/linux/device.c: Set $INTERFACE correctly when using ethertap - while compiled with tun/tap support. +Added UML network socket handling. +Now you can use tinc instead of uml_switch. -2002-03-24 17:28 Guus Sliepen +------------------------------------------------------------------------ +r1387 | guus | 2004-06-21 16:37:52 +0200 (Mon, 21 Jun 2004) | 2 lines - * src/: graph.c, net.c: Execute hosts/name-up when a node becomes - reachable, and hosts/name-down when it becomes unreachable. +Handle timeouts during connecting the same way as other errors. -2002-03-24 17:22 Guus Sliepen +------------------------------------------------------------------------ +r1386 | guus | 2004-06-14 16:32:10 +0200 (Mon, 14 Jun 2004) | 2 lines - * src/process.c: Don't try to execute scripts unless they exist. +Clean up environment after executing scripts. -2002-03-23 21:21 Guus Sliepen +------------------------------------------------------------------------ +r1382 | guus | 2004-04-15 16:09:56 +0200 (Thu, 15 Apr 2004) | 2 lines - * src/: protocol_auth.c, protocol_misc.c: Reset retry timeout when - receiving the first PONG, not right after receiving the ACK. +Increase MTU by 4 bytes to allow VLAN tagged Ethernet frames in hub and switch mode. -2002-03-23 21:13 Guus Sliepen +------------------------------------------------------------------------ +r1374 | guus | 2004-03-21 15:21:22 +0100 (Sun, 21 Mar 2004) | 2 lines - * src/net.c: Don't run graph algorithms if no edge is deleted in - terminate_connection(). +Update copyrights, links, email addresses and let Subversion update $Id$ keywords. -2002-03-23 21:12 Guus Sliepen +------------------------------------------------------------------------ +r1373 | guus | 2004-03-21 14:22:24 +0100 (Sun, 21 Mar 2004) | 2 lines - * src/protocol.c: free() request strings when deleting past - requests from the tree. +Move CABAL branch to its rightful place: the trunk. -2002-03-23 21:01 Guus Sliepen +------------------------------------------------------------------------ +r1371 | guus | 2004-03-20 23:23:42 +0100 (Sat, 20 Mar 2004) | 2 lines - * src/protocol_auth.c: send_ack() was broken. +Revert Martin Kihlgren's patch, it doesn't work the way it should. -2002-03-22 14:31 Guus Sliepen +------------------------------------------------------------------------ +r1370 | guus | 2004-03-20 16:40:26 +0100 (Sat, 20 Mar 2004) | 2 lines - * src/: connection.c, edge.c, node.c, protocol.c, protocol_auth.c, - protocol_edge.c, protocol_key.c, protocol_subnet.c: Fix compiler - warnings, strictly use long int and %lx for options. +Use Subversion to create ChangeLog, better svn-clean rule. -2002-03-22 13:41 Guus Sliepen +------------------------------------------------------------------------ +r1369 | guus | 2004-03-20 16:33:07 +0100 (Sat, 20 Mar 2004) | 2 lines - * src/protocol_edge.c: Fix add_edge_h(). +Fix declaration of update_node_address(). -2002-03-22 12:43 Guus Sliepen +------------------------------------------------------------------------ +r1368 | guus | 2004-03-20 16:28:55 +0100 (Sat, 20 Mar 2004) | 3 lines - * acconfig.h, configure.in, src/edge.c, src/edge.h, src/net.c, - src/net.h, src/net_setup.c, src/protocol.c, src/protocol.h, - src/protocol_auth.c, src/protocol_edge.c: - - Added support for jumbograms. - - Remove tcpaddress from edges, it is not used at all. - - Last bits of code to prevent looping requests. +Applied Martin Kihlgren's IdentityGenerosity patch, +simplified and renamed to StrictSource. -2002-03-22 00:11 Guus Sliepen +------------------------------------------------------------------------ +r1365 | guus | 2004-03-15 20:09:52 +0100 (Mon, 15 Mar 2004) | 2 lines - * src/: protocol.c, protocol.h, protocol_edge.c, protocol_key.c, - protocol_subnet.c: Put a break on requests that run around in - circles. +Even better svn-clean command. -2002-03-19 23:48 Guus Sliepen +------------------------------------------------------------------------ +r1362 | guus | 2004-03-15 19:36:14 +0100 (Mon, 15 Mar 2004) | 2 lines - * src/: graph.c, node.h: Updated SSSP algorithm to automatically - detect indirect links (if a node uses different addresses for - connections to other nodes). +Updating dutch translation. -2002-03-19 01:08 Guus Sliepen +------------------------------------------------------------------------ +r1361 | guus | 2004-03-15 19:15:02 +0100 (Mon, 15 Mar 2004) | 2 lines - * po/nl.po: Updated dutch translation. +Only read our public key if it wasn't already in the private key file. -2002-03-19 01:08 Guus Sliepen +------------------------------------------------------------------------ +r1360 | guus | 2004-03-15 19:05:41 +0100 (Mon, 15 Mar 2004) | 2 lines - * src/: netutl.c, route.c: Don't use s6_addr[16|32] anymore. +Eat trailing whitespace in config files. -2002-03-19 01:07 Guus Sliepen +------------------------------------------------------------------------ +r1359 | guus | 2004-03-15 18:54:19 +0100 (Mon, 15 Mar 2004) | 2 lines - * src/process.c: Cleanup. +Remove CVS related cruft. -2002-03-18 23:47 Guus Sliepen +------------------------------------------------------------------------ +r1358 | guus | 2004-03-15 18:53:17 +0100 (Mon, 15 Mar 2004) | 2 lines - * src/: net.c, net.h, net_packet.c, net_setup.c, net_socket.c: - Remember sockaddrs of listening sockets, use appropriate one when - sending UDP packets. +Replace cvs-clean with a much better svn-clean. -2002-03-18 15:39 Guus Sliepen +------------------------------------------------------------------------ +r1352 | guus | 2004-01-11 00:21:36 +0100 (Sun, 11 Jan 2004) | 3 lines - * src/netutl.c: Fix #define s6_addr32. +Remove autogen.sh, the autoreconf program does exactly that. +Update everything for the latest autoconf and automake versions. -2002-03-18 15:19 Guus Sliepen +------------------------------------------------------------------------ +r1351 | guus | 2004-01-11 00:19:20 +0100 (Sun, 11 Jan 2004) | 2 lines - * src/netutl.c: #define s6_addr32, needed for FreeBSD. +Small updates. -2002-03-17 17:08 Guus Sliepen +------------------------------------------------------------------------ +r1350 | guus | 2003-12-27 17:32:52 +0100 (Sat, 27 Dec 2003) | 2 lines - * src/netutl.c: Only unmap IPv6 addresses. +Don't forget to update destination MAC address. -2002-03-17 16:59 Guus Sliepen +------------------------------------------------------------------------ +r1349 | guus | 2003-12-24 11:48:15 +0100 (Wed, 24 Dec 2003) | 2 lines - * src/: net_packet.c, net_socket.c, netutl.c, netutl.h: Unmap - v4mapped sockaddrs. +Small fixes for PMTU discovery. -2002-03-15 16:50 Guus Sliepen +------------------------------------------------------------------------ +r1348 | guus | 2003-12-22 12:05:23 +0100 (Mon, 22 Dec 2003) | 2 lines - * src/route.c: Typo. +Missing definitions. -2002-03-15 16:40 Guus Sliepen +------------------------------------------------------------------------ +r1347 | guus | 2003-12-22 12:04:17 +0100 (Mon, 22 Dec 2003) | 2 lines - * src/route.c: Different way of detecting neighbor solicitation - requests. +Improvements for PMTU discovery and IPv4 packet fragmentation. -2002-03-15 16:08 Guus Sliepen +------------------------------------------------------------------------ +r1346 | guus | 2003-12-20 22:25:17 +0100 (Sat, 20 Dec 2003) | 2 lines - * src/route.c: Oops, don't forget to actually put the checksum in - the response packet. +Better name, show probed MTU in dump. -2002-03-15 15:41 Guus Sliepen +------------------------------------------------------------------------ +r1345 | guus | 2003-12-20 22:20:10 +0100 (Sat, 20 Dec 2003) | 2 lines - * src/route.c: Neighbor solicitation requests now work (I think). +Describe the TunnelServer and PMTUDiscovery options. -2002-03-12 17:30 Guus Sliepen +------------------------------------------------------------------------ +r1344 | guus | 2003-12-20 22:09:33 +0100 (Sat, 20 Dec 2003) | 2 lines - * src/graph.c: Revert changes to Kruskal's algo. +More sensible name, and try to set PMTU discovery on IPv6 sockets as well. -2002-03-12 15:25 Guus Sliepen +------------------------------------------------------------------------ +r1343 | guus | 2003-12-20 20:47:53 +0100 (Sat, 20 Dec 2003) | 2 lines - * src/route.c: Put #ifdef NEIGHBORSOL around corresponding code. +Let tinc figure out the exact MTU of the link. -2002-03-12 15:20 Guus Sliepen +------------------------------------------------------------------------ +r1342 | guus | 2003-12-13 22:50:26 +0100 (Sat, 13 Dec 2003) | 2 lines - * src/subnet.c: Remove silly cache thingy. +Forget multicast. Always inline some function. -2002-03-12 15:19 Guus Sliepen +------------------------------------------------------------------------ +r1341 | guus | 2003-12-12 20:52:25 +0100 (Fri, 12 Dec 2003) | 2 lines - * src/net_packet.c: Packet sequence number/authentication warnings - only if debug_lvl >= 5. +Code beautification, start of multicast support. -2002-03-12 14:42 Guus Sliepen +------------------------------------------------------------------------ +r1340 | guus | 2003-12-08 13:00:40 +0100 (Mon, 08 Dec 2003) | 2 lines - * src/graph.c: Simplified implementation of Kruskal's minimum - spanning tree algorithm. +Fix proxy-neighborsolicitation. -2002-03-11 14:56 Guus Sliepen +------------------------------------------------------------------------ +r1339 | guus | 2003-12-07 15:31:09 +0100 (Sun, 07 Dec 2003) | 2 lines - * src/route.c: New strategy: forward icmp6 neighbor solicitations - to intended target. +Don't retry if configuration is wrong from the beginning. -2002-03-11 14:14 Guus Sliepen +------------------------------------------------------------------------ +r1338 | guus | 2003-12-07 15:29:02 +0100 (Sun, 07 Dec 2003) | 2 lines - * src/route.c: Try to reply to neighbor solicitation requests. +Missing space between words. -2002-03-11 12:45 Guus Sliepen +------------------------------------------------------------------------ +r1337 | guus | 2003-12-07 15:28:39 +0100 (Sun, 07 Dec 2003) | 2 lines - * src/net.c: prune_connections() before build_fdset(). +Read MaxTimeout from tinc.conf like the manpage says. -2002-03-11 12:23 Guus Sliepen +------------------------------------------------------------------------ +r1336 | guus | 2003-11-28 00:24:59 +0100 (Fri, 28 Nov 2003) | 2 lines - * src/: net.c, process.c, subnet.c, tincd.c: Cleanups, spelling - fixes, allow symbol names for signals (-k option), don't remove - pidfile if other tincd is still running. +Complain if pid file cannot be created. -2002-03-10 17:09 Guus Sliepen +------------------------------------------------------------------------ +r1335 | guus | 2003-11-17 16:30:18 +0100 (Mon, 17 Nov 2003) | 2 lines - * src/net_setup.c: Don't retry to make outgoing connections when - exitting. +Replace Opaque and Strict options with a TunnelServer option. -2002-03-10 16:40 Guus Sliepen +------------------------------------------------------------------------ +r1334 | guus | 2003-11-10 23:31:53 +0100 (Mon, 10 Nov 2003) | 2 lines - * Makefile.am, autogen.sh: Small fixes to improve portability. +Add Opaque option which prevent information from being forwarded to certain nodes. -2002-03-10 15:07 Guus Sliepen +------------------------------------------------------------------------ +r1332 | guus | 2003-11-08 16:29:40 +0100 (Sat, 08 Nov 2003) | 2 lines - * autogen.sh: Autodetect $MAKE/gmake/make. +Release notes for 1.0.2 -2002-03-10 15:05 Guus Sliepen +------------------------------------------------------------------------ +r1331 | guus | 2003-11-08 16:09:03 +0100 (Sat, 08 Nov 2003) | 2 lines - * configure.in: po/POTFILES and po/Makefile should not be generated - by configure. +Add missing definitions. -2002-03-10 15:04 Guus Sliepen +------------------------------------------------------------------------ +r1330 | guus | 2003-11-08 13:56:24 +0100 (Sat, 08 Nov 2003) | 2 lines - * src/route.c: Fix forwarding of IPv6 packets. +Update dutch translation. -2002-03-01 16:14 Guus Sliepen +------------------------------------------------------------------------ +r1329 | guus | 2003-10-12 13:40:00 +0200 (Sun, 12 Oct 2003) | 2 lines - * po/nl.po, src/net_packet.c, src/net_setup.c, src/net_socket.c: - Check if BindToDevice and PriorityInheritance are supported. +Fix another bug in meta.c. -2002-03-01 15:33 Guus Sliepen +------------------------------------------------------------------------ +r1328 | guus | 2003-10-11 16:42:30 +0200 (Sat, 11 Oct 2003) | 2 lines - * src/route.c: Woops. +Small fixes in documentation. -2002-03-01 15:25 Guus Sliepen +------------------------------------------------------------------------ +r1327 | guus | 2003-10-11 16:18:52 +0200 (Sat, 11 Oct 2003) | 3 lines - * doc/tinc.conf.5, doc/tinc.texi, po/nl.po, src/net.c, src/route.c: - Document and clean up MAC address expiry. +Fix bug that could lead to an assertion failure in libcrypto when multiple +requests arrive and TCP packets are heavily fragmented. -2002-03-01 15:09 Guus Sliepen +------------------------------------------------------------------------ +r1326 | guus | 2003-10-11 14:28:48 +0200 (Sat, 11 Oct 2003) | 2 lines - * src/: event.c, meta.c, net.c, net.h, net_packet.c, net_setup.c, - net_socket.c, protocol_misc.c, route.c, route.h, subnet.h: - - Global time_t now, so that we don't have to call time() too often. - - MAC addresses expire after a time configurable by MACExpire - (default 600 seconds) +Parentheses in the wrong spots. -2002-03-01 14:38 Guus Sliepen +------------------------------------------------------------------------ +r1325 | guus | 2003-10-11 14:16:13 +0200 (Sat, 11 Oct 2003) | 2 lines - * po/nl.po: Updated dutch translation. +Check all EVP_ function calls. -2002-03-01 14:38 Guus Sliepen +------------------------------------------------------------------------ +r1324 | guus | 2003-10-10 18:24:24 +0200 (Fri, 10 Oct 2003) | 3 lines - * doc/: tinc.conf.5, tinc.texi: Updated documentation. +Check return value of EVP_* functions, and check if length before en/decryption +matches that after in meta.c. -2002-03-01 14:18 Guus Sliepen +------------------------------------------------------------------------ +r1323 | guus | 2003-10-10 18:23:30 +0200 (Fri, 10 Oct 2003) | 2 lines - * src/: net.c, net.h, net_setup.c, net_socket.c: Create/bind TCP - and UDP listening sockets in pairs. +Fix ASCII art. -2002-03-01 13:26 Guus Sliepen +------------------------------------------------------------------------ +r1322 | guus | 2003-10-09 23:33:15 +0200 (Thu, 09 Oct 2003) | 2 lines - * src/: net.h, net_packet.c, route.c, route.h: If - "PriorityInheritance = yes" is specified in tinc.conf, the value of - the TOS field of the tunneled packets will be passed on to the UDP - packets tinc sends out. +Update documentation. -2002-03-01 13:25 Guus Sliepen +------------------------------------------------------------------------ +r1321 | guus | 2003-10-08 14:09:37 +0200 (Wed, 08 Oct 2003) | 2 lines - * src/net_setup.c: Fix listening sockets. +Some platforms don't know sa_family_t or define it other than uint16_t. -2002-03-01 12:18 Guus Sliepen +------------------------------------------------------------------------ +r1320 | guus | 2003-10-08 13:37:53 +0200 (Wed, 08 Oct 2003) | 2 lines - * src/net_socket.c: Make BindToInterface work. +Set media status for newer TAP-Win32 driver. -2002-02-27 23:37 Guus Sliepen +------------------------------------------------------------------------ +r1319 | guus | 2003-10-08 13:37:20 +0200 (Wed, 08 Oct 2003) | 2 lines - * src/: protocol.c, protocol_key.c: Fix send_request() bug. +Missing declaration. -2002-02-27 00:26 Guus Sliepen +------------------------------------------------------------------------ +r1318 | guus | 2003-10-08 13:34:55 +0200 (Wed, 08 Oct 2003) | 2 lines - * src/: net.c, net.h, net_packet.c, net_setup.c, net_socket.c, - protocol.h: Allow multiple listening sockets. +Update missing definitions, structs describing headers get __packed__ attribute. -2002-02-26 23:47 Guus Sliepen +------------------------------------------------------------------------ +r1317 | guus | 2003-10-08 13:33:54 +0200 (Wed, 08 Oct 2003) | 2 lines - * src/: net.h, netutl.c: Tweaking IPv6 support. +Forgot to #include "xalloc.h" -2002-02-20 23:37 Guus Sliepen +------------------------------------------------------------------------ +r1316 | guus | 2003-10-06 18:49:42 +0200 (Mon, 06 Oct 2003) | 2 lines - * src/: net.h, net_packet.c, net_socket.c, netutl.c: - - Change SA_LEN to SALEN, former one is already defined on some - platforms. - - Use SALEN everywhere appropriate. +Make sure type of AF_UNKNOWN is sa_family_t. -2002-02-20 23:15 Guus Sliepen +------------------------------------------------------------------------ +r1315 | guus | 2003-10-06 18:13:08 +0200 (Mon, 06 Oct 2003) | 2 lines - * src/: net.h, net_packet.c, net_setup.c, netutl.c: - - Use gai_strerror() where appropriate - - Clear hints before using them with getaddrinfo() - - Use sa_len on platforms that support them +PIDs are of type pid_t, and use %ld when reading/writing them to the pidfile. -2002-02-20 20:31 Guus Sliepen +------------------------------------------------------------------------ +r1314 | guus | 2003-10-06 18:05:30 +0200 (Mon, 06 Oct 2003) | 2 lines - * src/net_packet.c: Preserve inpkt->len, needed for broadcasts. +Use CPPFLAGS, LDFLAGS and LIBS as appropiate. -2002-02-20 20:25 Guus Sliepen +------------------------------------------------------------------------ +r1313 | guus | 2003-10-06 16:41:45 +0200 (Mon, 06 Oct 2003) | 2 lines - * src/: connection.h, net_setup.c, net_socket.c, protocol_auth.c, - protocol_key.c: Protocol now also exchanges - cipher/digest/maclength/compression for the meta connection. +Don't confuse users with "Address family not supported" warnings. -2002-02-20 18:16 Guus Sliepen +------------------------------------------------------------------------ +r1312 | guus | 2003-10-06 16:33:04 +0200 (Mon, 06 Oct 2003) | 2 lines - * src/subnet.c: Cache results of lookup_subnet_...(). +Unused variable in struct. -2002-02-20 18:15 Guus Sliepen +------------------------------------------------------------------------ +r1311 | guus | 2003-10-06 16:16:51 +0200 (Mon, 06 Oct 2003) | 2 lines - * src/netutl.c: Fix maskcmp() and maskcpy(). +Ethernet protocol types. -2002-02-20 17:04 Guus Sliepen +------------------------------------------------------------------------ +r1310 | guus | 2003-10-06 15:57:12 +0200 (Mon, 06 Oct 2003) | 2 lines - * src/route.c: Forward packets in router mode. +const -2002-02-20 17:04 Guus Sliepen +------------------------------------------------------------------------ +r1309 | guus | 2003-10-06 15:49:57 +0200 (Mon, 06 Oct 2003) | 3 lines - * src/net_setup.c: Use AF_UNSPEC for listening sockets if - AddressFamily = any. +Copy structs from packets to the stack before using them, to prevent +alignment issues. -2002-02-20 17:04 Guus Sliepen +------------------------------------------------------------------------ +r1307 | guus | 2003-10-01 11:14:01 +0200 (Wed, 01 Oct 2003) | 2 lines - * src/net.c: Fix segfault when receiving HUP signal. +Better length checks. -2002-02-18 17:25 Guus Sliepen +------------------------------------------------------------------------ +r1306 | guus | 2003-09-25 12:34:16 +0200 (Thu, 25 Sep 2003) | 3 lines - * src/net_packet.c: file net_packet.c was initially added on branch - CABAL. +Generate keys with 0x10001 as public exponent, which has less prime factors +than 0xFFFF. -2002-02-18 17:25 Guus Sliepen +------------------------------------------------------------------------ +r1305 | guus | 2003-09-23 22:59:01 +0200 (Tue, 23 Sep 2003) | 2 lines - * src/net_setup.c: file net_setup.c was initially added on branch - CABAL. +Check for short packets from the tun/tap device and from other tinc daemons. -2002-02-18 17:25 Guus Sliepen +------------------------------------------------------------------------ +r1304 | guus | 2003-09-09 17:47:59 +0200 (Tue, 09 Sep 2003) | 2 lines - * src/net_socket.c: file net_socket.c was initially added on branch - CABAL. +Update translations. -2002-02-18 17:25 Guus Sliepen +------------------------------------------------------------------------ +r1303 | guus | 2003-09-08 23:52:47 +0200 (Mon, 08 Sep 2003) | 2 lines - * doc/tinc.conf.5, doc/tinc.texi, po/POTFILES.in, po/nl.po, - src/Makefile.am, src/conf.c, src/conf.h, src/connection.c, - src/connection.h, src/edge.c, src/edge.h, src/graph.c, src/meta.c, - src/net.c, src/net.h, src/net_packet.c, src/net_setup.c, - src/net_socket.c, src/netutl.c, src/netutl.h, src/node.c, - src/node.h, src/process.c, src/protocol_auth.c, - src/protocol_edge.c, src/route.c, src/subnet.c, src/subnet.h, - src/freebsd/device.c, src/linux/device.c, src/netbsd/device.c, - src/openbsd/device.c, src/solaris/device.c: - - Non-blocking connect()s. - - Socket handling revamped to use sockaddr_t. - - tinc can now tunnel over IPv6. - - Handle all addresses and subnets in network byte order. - Only convert them when they need to be printed. - - IPv6 subnets bigger than /128 now work. - - Use %s and strerror(errno) instead of %m. +Remove pidfile when exitting. -2002-02-12 15:42 Guus Sliepen +------------------------------------------------------------------------ +r1302 | guus | 2003-09-03 18:20:33 +0200 (Wed, 03 Sep 2003) | 2 lines - * acconfig.h, configure.in: Add check for NetBSD. +Prevent multiple inclusions. -2002-02-12 15:40 Guus Sliepen +------------------------------------------------------------------------ +r1301 | guus | 2003-08-28 23:05:11 +0200 (Thu, 28 Aug 2003) | 2 lines - * src/netbsd/device.c: Added device.c for NetBSD, actually a copy - of the OpenBSD one. +We don't have to tell GCC how to cast. -2002-02-12 15:40 Guus Sliepen +------------------------------------------------------------------------ +r1300 | guus | 2003-08-28 17:27:12 +0200 (Thu, 28 Aug 2003) | 3 lines - * src/netbsd/device.c: file device.c was initially added on branch - CABAL. +Remove old edges from unreachable nodes to us. This prevents the hosts/NAME-up +script from being called twice in some situations. -2002-02-12 15:36 Guus Sliepen +------------------------------------------------------------------------ +r1294 | guus | 2003-08-22 23:32:45 +0200 (Fri, 22 Aug 2003) | 2 lines - * src/: meta.c, net.c: Get rid of sys/signal.h. +Add license exception from Markus Oberhumer. -2002-02-12 15:29 Guus Sliepen +------------------------------------------------------------------------ +r1293 | guus | 2003-08-22 17:07:57 +0200 (Fri, 22 Aug 2003) | 2 lines - * src/process.c: Don't use sa_sigaction (which NetBSD doesn't like) - at all if we don't use siginfo. +Remove debug message. -2002-02-11 16:59 Guus Sliepen +------------------------------------------------------------------------ +r1292 | guus | 2003-08-22 17:04:26 +0200 (Fri, 22 Aug 2003) | 2 lines - * THANKS, configure.in, doc/tinc.conf.5, doc/tinc.texi, m4/zlib.m4, - po/nl.po, src/net.c, src/node.c, src/node.h, src/protocol.h, - src/protocol_key.c: Added support for packet compression, thanks to - Mark Glines. Add "Compression = " to the host config files, - where level can be 0 (off), or any integer between 1 (fast) and 9 - (best). +When purging nodes, only delete them if nobody references them anymore. -2002-02-11 16:59 Guus Sliepen +------------------------------------------------------------------------ +r1291 | guus | 2003-08-22 17:03:59 +0200 (Fri, 22 Aug 2003) | 2 lines - * m4/zlib.m4: file zlib.m4 was initially added on branch CABAL. +Add checkpoints. -2002-02-11 15:20 Guus Sliepen +------------------------------------------------------------------------ +r1290 | guus | 2003-08-22 17:05:01 +0200 (Fri, 22 Aug 2003) | 2 lines - * src/solaris/device.c: Small fix. +Don't overwrite the first " when installing a service. -2002-02-11 15:20 Guus Sliepen +------------------------------------------------------------------------ +r1289 | guus | 2003-08-22 13:18:42 +0200 (Fri, 22 Aug 2003) | 2 lines - * src/net.c: - - If no PrivateKeyFile is specified, /etc/tinc/netname/rsa_key.priv - is assumed. - - Check RSA key before using it. +Allow tinc to handle unknown type addresses from other tinc daemons. -2002-02-11 13:33 Guus Sliepen +------------------------------------------------------------------------ +r1288 | guus | 2003-08-17 14:05:08 +0200 (Sun, 17 Aug 2003) | 2 lines - * src/: freebsd/device.c, linux/device.c, openbsd/device.c, - solaris/device.c: Sensible defaults for $INTERFACE. +If we're not in main_loop() and the service is stopped, exit immediately. -2002-02-11 11:16 Guus Sliepen +------------------------------------------------------------------------ +r1287 | guus | 2003-08-17 14:04:35 +0200 (Sun, 17 Aug 2003) | 2 lines - * src/: netutl.c, netutl.h: Last bits of the merger. +Do what the SDK documentation tells. -2002-02-11 11:05 Guus Sliepen +------------------------------------------------------------------------ +r1286 | guus | 2003-08-17 14:03:40 +0200 (Sun, 17 Aug 2003) | 2 lines - * src/: event.c, event.h, protocol_auth.c, protocol_edge.c, - protocol_key.c, protocol_misc.c, protocol_subnet.c: Forgot to merge - new files from pre5. +Compilation fix. -2002-02-10 22:57 Guus Sliepen +------------------------------------------------------------------------ +r1285 | guus | 2003-08-17 11:04:00 +0200 (Sun, 17 Aug 2003) | 2 lines - * AUTHORS, Makefile.am, NEWS, README, THANKS, TODO, acconfig.h, - configure.in, doc/CONNECTIVITY, doc/NETWORKING, doc/PROTOCOL, - doc/SECURITY2, doc/tinc.conf.5, doc/tinc.texi, doc/tincd.8, - doc/sample-config/tinc-down, doc/sample-config/tinc-up, - doc/sample-config/tinc.conf, lib/avl_tree.c, lib/dropin.c, - lib/dropin.h, m4/openssl.m4, po/POTFILES.in, po/nl.po, - redhat/Makefile.am, src/Makefile.am, src/conf.c, src/conf.h, - src/connection.c, src/connection.h, src/device.h, src/edge.c, - src/edge.h, src/graph.c, src/graph.h, src/meta.c, src/meta.h, - src/net.c, src/net.h, src/node.c, src/node.h, src/process.c, - src/process.h, src/protocol.c, src/protocol.h, src/route.c, - src/route.h, src/subnet.c, src/subnet.h, src/tincd.c, - src/freebsd/device.c, src/linux/device.c, src/openbsd/device.c, - src/solaris/device.c: Merging of the entire pre5 branch. +Use the event log under Windows. -2002-02-10 16:44 Ivo Timmermans +------------------------------------------------------------------------ +r1284 | guus | 2003-08-17 11:03:30 +0200 (Sun, 17 Aug 2003) | 2 lines - * doc/tinc.texi: Added @dircategory +Fix --logfile under Windows. -2002-02-10 01:39 Guus Sliepen +------------------------------------------------------------------------ +r1283 | guus | 2003-08-17 10:32:39 +0200 (Sun, 17 Aug 2003) | 2 lines - * doc/tinc.texi: Better placement of @cindex directives. +Fix fake getnameinfo() and check more arguments. -2002-02-09 23:54 Guus Sliepen +------------------------------------------------------------------------ +r1282 | guus | 2003-08-16 14:40:01 +0200 (Sat, 16 Aug 2003) | 2 lines - * configure.in: Remove src/device.c before making a symbolic link. +Don't getsockopt() SO_ERROR. We get the error from send()/recv() anyway. -2002-02-09 22:44 Guus Sliepen +------------------------------------------------------------------------ +r1281 | guus | 2003-08-16 14:11:11 +0200 (Sat, 16 Aug 2003) | 2 lines - * THANKS: Credits go to Jerome Etienne for his security analysis. +stat() batch files under Windows. -2002-02-09 22:42 Guus Sliepen +------------------------------------------------------------------------ +r1280 | guus | 2003-08-16 14:10:28 +0200 (Sat, 16 Aug 2003) | 2 lines - * configure.in: 1.0pre5, without a dash. +Simplify fake getname/addrinfo() functions, possibly fixing freeing a NULL pointer. -2002-02-09 22:35 Guus Sliepen +------------------------------------------------------------------------ +r1278 | guus | 2003-08-14 16:32:34 +0200 (Thu, 14 Aug 2003) | 2 lines - * src/Makefile.am: Add os/device.c to the release. +Update. -2002-02-09 22:11 Guus Sliepen +------------------------------------------------------------------------ +r1277 | guus | 2003-08-14 16:21:35 +0200 (Thu, 14 Aug 2003) | 2 lines - * doc/: tinc.conf.5, tincd.8: Spelling checker. +Fix permissions check for rsa_key.priv. -2002-02-09 22:00 Guus Sliepen +------------------------------------------------------------------------ +r1276 | guus | 2003-08-12 16:48:13 +0200 (Tue, 12 Aug 2003) | 2 lines - * configure.in: Make po/POTFILES and po/Makefile since not all - versions of autoconf do this automatically. +Small fixes. -2002-02-09 21:33 Guus Sliepen +------------------------------------------------------------------------ +r1275 | guus | 2003-08-12 14:35:53 +0200 (Tue, 12 Aug 2003) | 2 lines - * po/nl.po: Update translation. +Updated dutch translation. -2002-02-09 21:30 Guus Sliepen +------------------------------------------------------------------------ +r1274 | guus | 2003-08-10 15:35:05 +0200 (Sun, 10 Aug 2003) | 2 lines - * Makefile.am: There are no makefiles in redhat/. +Add a description for the Service control panel. -2002-02-09 21:27 Guus Sliepen +------------------------------------------------------------------------ +r1273 | guus | 2003-08-09 02:53:22 +0200 (Sat, 09 Aug 2003) | 2 lines - * README: We're up to version 1.0pre5 now. +Update documentation. -2002-02-09 21:18 Guus Sliepen +------------------------------------------------------------------------ +r1272 | guus | 2003-08-09 00:45:46 +0200 (Sat, 09 Aug 2003) | 2 lines - * configure.in, redhat/Makefile.am: Don't make makefiles in debian/ - and redhat/. +Only system() needs script name quoted. -2002-02-09 21:07 Guus Sliepen +------------------------------------------------------------------------ +r1271 | guus | 2003-08-09 00:13:50 +0200 (Sat, 09 Aug 2003) | 2 lines - * NEWS, README, TODO: Update to pre5. +Check for fchmod(). -2002-02-09 21:00 Guus Sliepen +------------------------------------------------------------------------ +r1270 | guus | 2003-08-09 00:11:54 +0200 (Sat, 09 Aug 2003) | 2 lines - * doc/: CONNECTIVITY, NETWORKING, PROTOCOL, SECURITY2, tincd.8: - 2002. +Simpler checking of permissions on private RSA key and other fixes. -2002-02-09 20:59 Guus Sliepen +------------------------------------------------------------------------ +r1269 | guus | 2003-08-08 21:56:11 +0200 (Fri, 08 Aug 2003) | 2 lines - * src/: conf.c, conf.h, connection.c, connection.h, device.h, - edge.c, edge.h, graph.c, graph.h, meta.c, meta.h, net.c, net.h, - netutl.c, netutl.h, node.c, node.h, process.c, process.h, - protocol_auth.c, protocol_edge.c, protocol_key.c, protocol_misc.c, - protocol_subnet.c, route.c, route.h, subnet.c, tincd.c, - freebsd/device.c, linux/device.c, openbsd/device.c, - solaris/device.c: We're living in 2002 now. +Small things. -2002-02-09 19:34 Guus Sliepen +------------------------------------------------------------------------ +r1268 | guus | 2003-08-08 21:49:47 +0200 (Fri, 08 Aug 2003) | 2 lines - * doc/tinc.texi: Update info manual. +Better error checking and reporting. -2002-02-09 17:26 Guus Sliepen +------------------------------------------------------------------------ +r1267 | guus | 2003-08-08 21:45:21 +0200 (Fri, 08 Aug 2003) | 2 lines - * src/net.c: Fix flushing of event queue. +Under Windows, the installation directory can be found in the registry. -2002-02-09 17:24 Guus Sliepen +------------------------------------------------------------------------ +r1266 | guus | 2003-08-08 21:43:47 +0200 (Fri, 08 Aug 2003) | 2 lines - * doc/tinc.conf.5, po/nl.po, src/conf.c, src/conf.h, src/event.h, - src/net.c, src/process.c, src/subnet.c: Cleanups. +Quote when needed and don't try stuff that doesn't work under Windows. -2002-02-09 17:07 Guus Sliepen +------------------------------------------------------------------------ +r1265 | guus | 2003-08-08 21:42:35 +0200 (Fri, 08 Aug 2003) | 2 lines - * src/: Makefile.am, connection.h, net.c, net.h, protocol_auth.c, - route.c: Added struct outgoing_t, which is a ticket containing the - name of a node to connect to and the time we should wait before - retrying. The outgoing_t is kept either in the event queue or by the - corresponding connection_t. +Log error first, try to close later. -2002-02-09 15:32 Guus Sliepen +------------------------------------------------------------------------ +r1264 | guus | 2003-08-08 21:39:41 +0200 (Fri, 08 Aug 2003) | 2 lines - * src/net.c: Don't quit because of tap read errors. +Better error messages under Windows. -2002-02-09 12:06 Guus Sliepen +------------------------------------------------------------------------ +r1263 | guus | 2003-08-08 19:20:12 +0200 (Fri, 08 Aug 2003) | 2 lines - * src/: net.c, protocol_key.c: Allow packet encryption to be turned - of with Cipher = none. +Typo. -2002-02-08 13:02 Guus Sliepen +------------------------------------------------------------------------ +r1262 | guus | 2003-08-08 19:17:13 +0200 (Fri, 08 Aug 2003) | 2 lines - * src/event.h: file event.h was initially added on branch pre5. +Readd quotes. -2002-02-08 13:02 Guus Sliepen +------------------------------------------------------------------------ +r1261 | guus | 2003-08-08 18:49:29 +0200 (Fri, 08 Aug 2003) | 2 lines - * src/event.c: file event.c was initially added on branch pre5. +Make rule for sample-config.tar.gz. -2002-02-08 13:02 Guus Sliepen +------------------------------------------------------------------------ +r1260 | guus | 2003-08-08 16:59:27 +0200 (Fri, 08 Aug 2003) | 2 lines - * src/: event.c, event.h: Added functions to manage an event queue. +Allow empty lines in config files. -2002-02-08 12:22 Guus Sliepen +------------------------------------------------------------------------ +r1259 | guus | 2003-08-08 16:48:33 +0200 (Fri, 08 Aug 2003) | 2 lines - * src/protocol_node.c: ADD/DEL_NODE messages are not used anymore. +Simplify execute_script(). It will probably work under Windows as well. -2002-02-08 12:12 Guus Sliepen +------------------------------------------------------------------------ +r1258 | guus | 2003-08-08 16:24:09 +0200 (Fri, 08 Aug 2003) | 2 lines - * src/: net.c, process.c: - - Purge unreachable nodes if there are no outgoing connections or - SIGWINCH is received. - - Actually use sigsegv_square(). +Correct error message when remote host closed connection. -2002-02-08 10:32 Guus Sliepen +------------------------------------------------------------------------ +r1257 | guus | 2003-08-08 16:07:12 +0200 (Fri, 08 Aug 2003) | 3 lines - * src/protocol_subnet.c: Really fix del_subnet_h(). +Remove unused stuff from doc/. +Let configure update pathnames in documentation. -2002-02-07 22:37 Guus Sliepen +------------------------------------------------------------------------ +r1253 | guus | 2003-08-08 14:55:05 +0200 (Fri, 08 Aug 2003) | 2 lines - * src/protocol_subnet.c: Fix handling of DEL_SUBNET messages. +Tell windows to be patient. -2002-02-07 22:36 Guus Sliepen +------------------------------------------------------------------------ +r1252 | guus | 2003-08-08 14:24:52 +0200 (Fri, 08 Aug 2003) | 2 lines - * src/: graph.c, net.c: Fix IndirectData and TCPOnly options. +Windows uses backslashes... -2002-02-07 16:42 Guus Sliepen +------------------------------------------------------------------------ +r1251 | guus | 2003-08-08 13:45:37 +0200 (Fri, 08 Aug 2003) | 2 lines - * doc/sample-config/: tinc-down, tinc-up, tinc.conf: Updated sample - configuration files. +Sync CABAL branch with release-1_0 branch. -2002-02-07 15:55 Guus Sliepen +------------------------------------------------------------------------ +r1248 | guus | 2003-08-03 23:45:41 +0200 (Sun, 03 Aug 2003) | 2 lines - * src/route.c: Get rid of last %hhx. +Use our own port when connecting to ourself. -2002-02-07 15:53 Guus Sliepen +------------------------------------------------------------------------ +r1247 | guus | 2003-08-03 23:45:13 +0200 (Sun, 03 Aug 2003) | 2 lines - * src/: netutl.c, subnet.c: FreeBSD compile fixes. +Simplify translation -2002-02-07 15:43 Guus Sliepen +------------------------------------------------------------------------ +r1246 | guus | 2003-08-03 23:43:19 +0200 (Sun, 03 Aug 2003) | 2 lines - * src/: protocol_subnet.c, route.c, subnet.c: Make tinc's IPv6 - support working. +Update dutch translation -2002-02-07 14:21 Guus Sliepen +------------------------------------------------------------------------ +r1245 | guus | 2003-08-03 14:38:43 +0200 (Sun, 03 Aug 2003) | 2 lines - * src/: netutl.c, subnet.c: OpenBSD (and probably other non-GNU - operating systems) doesn't support %hhu. +Remove newlines from log messages. -2002-02-07 13:42 Guus Sliepen +------------------------------------------------------------------------ +r1244 | guus | 2003-08-03 14:38:18 +0200 (Sun, 03 Aug 2003) | 2 lines - * src/: graph.c, netutl.c, route.c, openbsd/device.c: OpenBSD - compile fixes. +Keep Windows happy. -2002-02-07 13:09 Guus Sliepen +------------------------------------------------------------------------ +r1243 | guus | 2003-08-03 14:37:55 +0200 (Sun, 03 Aug 2003) | 2 lines - * src/conf.c: get_config_address() returns a pointer to a newly - created ipv4_t. +Cygwin needs windows.h. -2002-02-07 13:07 Guus Sliepen +------------------------------------------------------------------------ +r1242 | guus | 2003-08-03 11:55:20 +0200 (Sun, 03 Aug 2003) | 2 lines - * src/: conf.c, conf.h, edge.c, net.c, netutl.c, netutl.h, - protocol.h, protocol_auth.c, protocol_edge.c, subnet.c, subnet.h: - Send addresses and subnets as human readable strings. +Old gcc compilers don't like declarations in the middle of a function. -2002-02-07 13:05 Guus Sliepen +------------------------------------------------------------------------ +r1241 | guus | 2003-08-03 11:08:52 +0200 (Sun, 03 Aug 2003) | 2 lines - * doc/: PROTOCOL, SECURITY2, tinc.conf.5, tinc.texi, tincd.8: - Updated documentation. +Clean up last part of main(). -2002-02-07 10:48 Guus Sliepen +------------------------------------------------------------------------ +r1240 | guus | 2003-08-03 00:01:50 +0200 (Sun, 03 Aug 2003) | 2 lines - * src/protocol_key.c: Really stop proxying keys. +Typo and another thing to think about. -2002-02-07 00:51 Guus Sliepen +------------------------------------------------------------------------ +r1239 | guus | 2003-08-02 23:55:12 +0200 (Sat, 02 Aug 2003) | 2 lines - * src/solaris/device.c: Fix for Solaris. +Explain how tinc detaches and how it is "killed" under Windows. -2002-02-06 21:55 Guus Sliepen +------------------------------------------------------------------------ +r1238 | guus | 2003-08-02 23:39:11 +0200 (Sat, 02 Aug 2003) | 2 lines - * po/nl.po: Update dutch translation. +Updated dutch translation. -2002-02-06 21:55 Guus Sliepen +------------------------------------------------------------------------ +r1237 | guus | 2003-08-02 23:34:10 +0200 (Sat, 02 Aug 2003) | 2 lines - * src/: protocol_auth.c, protocol_edge.c, protocol_subnet.c: - Display new debug messages only when debug level is set accordingly. +Oops. -2002-02-06 21:18 Guus Sliepen +------------------------------------------------------------------------ +r1236 | guus | 2003-08-02 23:33:52 +0200 (Sat, 02 Aug 2003) | 2 lines - * src/: graph.c, net.c, node.h, protocol_key.c: - - Fix sequence number handling when many nodes are involved - - Use minimum spanning tree when broadcasting KEY_CHANGED - - Disable key proxying for now. +Missing include. -2002-02-06 20:17 Guus Sliepen +------------------------------------------------------------------------ +r1235 | guus | 2003-08-02 23:33:19 +0200 (Sat, 02 Aug 2003) | 2 lines - * acconfig.h, m4/openssl.m4, src/tincd.c: Check for - OpenSSL/SSLeay_add_all_algorithms(). +Cleanups and error messages. -2002-02-06 18:07 Guus Sliepen +------------------------------------------------------------------------ +r1234 | guus | 2003-08-02 23:01:50 +0200 (Sat, 02 Aug 2003) | 2 lines - * po/: POTFILES.in, nl.po: More translations. +Error messages. -2002-02-06 17:51 Guus Sliepen +------------------------------------------------------------------------ +r1233 | guus | 2003-08-02 22:50:38 +0200 (Sat, 02 Aug 2003) | 3 lines - * src/node.c: Cleanup. +Install tinc as a service under Windows (MinGW). Remove cleanup_and_exit(), +either exit() directly on errors or let main_loop() shutdown gracefully. -2002-02-06 17:50 Guus Sliepen +------------------------------------------------------------------------ +r1232 | guus | 2003-08-02 18:05:33 +0200 (Sat, 02 Aug 2003) | 2 lines - * lib/avl_tree.c: Clear pointers and count/depth after unlinking a - node. +When compiling with MinGW, link with ws2_32. -2002-02-06 16:58 Guus Sliepen +------------------------------------------------------------------------ +r1231 | guus | 2003-08-02 17:32:57 +0200 (Sat, 02 Aug 2003) | 2 lines - * src/net.h: Maximum size of an ethernet frame is 1514 bytes, not - 1500. +Windows has no symbolic links as we know it. -2002-02-06 16:46 Guus Sliepen +------------------------------------------------------------------------ +r1230 | guus | 2003-08-02 17:29:06 +0200 (Sat, 02 Aug 2003) | 2 lines - * po/: POTFILES.in, nl.po: Add more translations. +Oops. -2002-02-06 16:44 Guus Sliepen +------------------------------------------------------------------------ +r1229 | guus | 2003-08-02 17:27:24 +0200 (Sat, 02 Aug 2003) | 2 lines - * src/net.c: Use full keylength when calculating MAC, and allow - large UDP packets to be received. +Allow whitespace in values. -2002-02-06 15:38 Guus Sliepen +------------------------------------------------------------------------ +r1228 | guus | 2003-08-02 17:13:08 +0200 (Sat, 02 Aug 2003) | 2 lines - * src/protocol_key.c: Fix ans_key_h(). +Prevent system headers from including our own headers. -2002-02-06 15:27 Guus Sliepen +------------------------------------------------------------------------ +r1227 | guus | 2003-08-01 10:18:22 +0200 (Fri, 01 Aug 2003) | 2 lines - * src/protocol_key.c: Copy key to node_t before forwarding it. +Wrong function... -2002-02-06 15:09 Guus Sliepen +------------------------------------------------------------------------ +r1226 | guus | 2003-07-31 16:24:19 +0200 (Thu, 31 Jul 2003) | 2 lines - * src/: graph.c, node.c: Quick hack to fix node_udp_compare(). +Woops! -2002-02-06 14:57 Guus Sliepen +------------------------------------------------------------------------ +r1225 | guus | 2003-07-31 15:18:34 +0200 (Thu, 31 Jul 2003) | 2 lines - * src/net.c: Don't send packets to nodes that are not reachable. +No easy way to properly detect header files... -2002-02-06 14:43 Guus Sliepen +------------------------------------------------------------------------ +r1224 | guus | 2003-07-31 13:31:51 +0200 (Thu, 31 Jul 2003) | 2 lines - * src/: graph.c, node.c: Don't forget to manage the node_udp_tree. +Remove forgotten braces. -2002-02-06 14:14 Guus Sliepen +------------------------------------------------------------------------ +r1223 | guus | 2003-07-31 13:20:32 +0200 (Thu, 31 Jul 2003) | 2 lines - * src/graph.c: FreeBSD compile fix. +Wrong argument. -2002-02-06 14:07 Guus Sliepen +------------------------------------------------------------------------ +r1222 | guus | 2003-07-31 13:17:39 +0200 (Thu, 31 Jul 2003) | 2 lines - * src/net.c: Don't complain about missing Port variable, use - default (655) instead. +Check if the compiler knows about the __malloc__ attribute. -2002-02-06 14:05 Guus Sliepen +------------------------------------------------------------------------ +r1220 | guus | 2003-07-30 23:52:41 +0200 (Wed, 30 Jul 2003) | 2 lines - * doc/tinc.conf.5: Update configuration manual. +Prevent definitions from messing up attributes. -2002-02-06 14:04 Guus Sliepen +------------------------------------------------------------------------ +r1219 | guus | 2003-07-30 18:00:59 +0200 (Wed, 30 Jul 2003) | 2 lines - * src/freebsd/device.c: Declare correct variable name. +Replacement for stdbool.h -2002-02-06 13:35 Guus Sliepen +------------------------------------------------------------------------ +r1218 | guus | 2003-07-30 13:50:45 +0200 (Wed, 30 Jul 2003) | 3 lines - * po/nl.po, src/graph.c, src/subnet.c: Added one message to be - translated. +No C99 initialisers, gcc 2.95.3 doesn't like it. +Also make sure getopt.h is included. -2002-02-06 13:25 Guus Sliepen +------------------------------------------------------------------------ +r1217 | guus | 2003-07-30 11:45:21 +0200 (Wed, 30 Jul 2003) | 2 lines - * po/nl.po, src/graph.c, src/node.h, src/protocol_key.c: Cleanups. +Remove doc/es/ and src/device.c from the distribution. -2002-02-05 16:17 Guus Sliepen +------------------------------------------------------------------------ +r1216 | guus | 2003-07-30 11:22:29 +0200 (Wed, 30 Jul 2003) | 2 lines - * src/: Makefile.am, connection.c, connection.h, edge.c, edge.h, - graph.c, graph.h, net.c, node.c, node.h, protocol.c, protocol.h, - protocol_auth.c, protocol_edge.c, protocol_key.c, - protocol_subnet.c: - - Move information about cipher and digest from ACK to SEND_KEY - - Move information about addresses and portnumbers from ADD_NODE to - ADD_EDGE - - Stop exchanging information about nodes at all, it can be derived - from the ADD_EDGE and ADD_SUBNET messages. - - Don't purge anything. Only authorative nodes are allowed to delete - edges and subnets. This means we remember information about nodes - that may not be reachable anymore, but reduces amount of - ADD/DEL_SUBNET/EDGE messages. - - Lots of bugfixes. +Update documentation and remove stuff that's too outdated. -2002-02-03 23:18 Guus Sliepen +------------------------------------------------------------------------ +r1215 | guus | 2003-07-30 01:21:01 +0200 (Wed, 30 Jul 2003) | 2 lines - * src/tincd.c: Woops! +Cleanups. -2002-02-03 23:14 Guus Sliepen +------------------------------------------------------------------------ +r1214 | guus | 2003-07-30 00:59:01 +0200 (Wed, 30 Jul 2003) | 2 lines - * src/: net.h, node.h, process.c, protocol.c, protocol.h, - protocol_key.c, tincd.c: Cleanups. +Native Windows support. -2002-02-03 22:29 Guus Sliepen +------------------------------------------------------------------------ +r1213 | guus | 2003-07-29 14:38:49 +0200 (Tue, 29 Jul 2003) | 2 lines - * src/protocol_subnet.c: file protocol_subnet.c was initially added - on branch pre5. +Make sure (at least) the MinGW device driver works. -2002-02-03 22:29 Guus Sliepen +------------------------------------------------------------------------ +r1212 | guus | 2003-07-29 14:18:35 +0200 (Tue, 29 Jul 2003) | 2 lines - * src/: Makefile.am, protocol.c, protocol.h, protocol_auth.c, - protocol_edge.c, protocol_key.c, protocol_misc.c, protocol_node.c, - protocol_subnet.c: Split up protocol.c. +Make sure it works. -2002-02-03 22:29 Guus Sliepen +------------------------------------------------------------------------ +r1211 | guus | 2003-07-29 13:50:39 +0200 (Tue, 29 Jul 2003) | 2 lines - * src/protocol_misc.c: file protocol_misc.c was initially added on - branch pre5. +Update configure scripts. -2002-02-03 22:29 Guus Sliepen +------------------------------------------------------------------------ +r1210 | guus | 2003-07-29 13:06:23 +0200 (Tue, 29 Jul 2003) | 3 lines - * src/protocol_node.c: file protocol_node.c was initially added on - branch pre5. +Update dutch translation and make sure all device drivers are included in +the translation and distribution. -2002-02-03 22:29 Guus Sliepen +------------------------------------------------------------------------ +r1209 | guus | 2003-07-29 12:50:15 +0200 (Tue, 29 Jul 2003) | 2 lines - * src/protocol_edge.c: file protocol_edge.c was initially added on - branch pre5. +Fix compile errors and warnings. -2002-02-03 22:29 Guus Sliepen +------------------------------------------------------------------------ +r1208 | guus | 2003-07-29 00:06:09 +0200 (Tue, 29 Jul 2003) | 2 lines - * src/protocol_key.c: file protocol_key.c was initially added on - branch pre5. +More checks for missing functions. -2002-02-03 22:29 Guus Sliepen +------------------------------------------------------------------------ +r1207 | guus | 2003-07-28 23:54:03 +0200 (Mon, 28 Jul 2003) | 2 lines - * src/protocol_auth.c: file protocol_auth.c was initially added on - branch pre5. +More generic handling of tap device under Windows. -2002-02-01 17:00 Guus Sliepen +------------------------------------------------------------------------ +r1206 | guus | 2003-07-24 14:08:16 +0200 (Thu, 24 Jul 2003) | 2 lines - * src/: net.c, protocol.c: Fixes for some buglets. +Sprinkle around a lot of const and some C99 initialisers. -2002-01-29 12:50 Guus Sliepen +------------------------------------------------------------------------ +r1205 | guus | 2003-07-24 00:17:31 +0200 (Thu, 24 Jul 2003) | 2 lines - * src/: net.c, protocol.c: Some fixes to make cipher/digest - selection actually work. +Don't initialise a CIPHER_CTX if cipher == NULL. -2002-01-29 00:26 Guus Sliepen +------------------------------------------------------------------------ +r1204 | guus | 2003-07-22 23:13:23 +0200 (Tue, 22 Jul 2003) | 2 lines - * src/: net.c, net.h, node.c, node.h, protocol.c, tincd.c: - - Removed salt in favour of sequence numbers. - - Packet encryption is now fully configurable: - - option "Cipher" takes name of a cipher as argument (default - "blowfish") - - option "Digest" takes name of a digest as argument (default - "sha1") - - option "MACLength" takes length of message authentication code as - argument (default 4), set to 0 to turn it off completely. +Run setup_device() after parsing configuration but before claiming we're ready. -2002-01-24 18:03 Guus Sliepen +------------------------------------------------------------------------ +r1203 | guus | 2003-07-22 22:55:21 +0200 (Tue, 22 Jul 2003) | 2 lines - * src/net.c: Don't retry if all outgoing connections work. +Use bools and enums where appropriate. -2002-01-22 22:52 Guus Sliepen +------------------------------------------------------------------------ +r1202 | guus | 2003-07-22 14:58:34 +0200 (Tue, 22 Jul 2003) | 2 lines - * src/net.c: More #ifdefs around use of sequence numbers. +Option to specify pidfile location. -2002-01-22 22:46 Guus Sliepen +------------------------------------------------------------------------ +r1201 | guus | 2003-07-21 21:58:58 +0200 (Mon, 21 Jul 2003) | 2 lines - * src/linux/device.c: Don't use iovecs with Linux ethertap device. +Add section about configuring Cygwin and CIPE on Windows. -2002-01-14 01:29 Guus Sliepen +------------------------------------------------------------------------ +r1200 | guus | 2003-07-21 17:51:00 +0200 (Mon, 21 Jul 2003) | 2 lines - * TODO: Updated TODO list. +Copy cygwin driver to mingw directory. It doesn't work (yet). -2002-01-14 00:57 Guus Sliepen +------------------------------------------------------------------------ +r1198 | guus | 2003-07-21 16:47:43 +0200 (Mon, 21 Jul 2003) | 2 lines - * src/: net.c, net.h, node.h, protocol.c: Experimental changes to - fix the security weaknesses found by Jerome Etienne. Compile with - MORESECURE defined to add replay protection and packet - authentication. +Use functions from logger.c -2001-12-23 15:06 Guus Sliepen +------------------------------------------------------------------------ +r1197 | guus | 2003-07-21 15:18:44 +0200 (Mon, 21 Jul 2003) | 2 lines - * src/protocol.c: Exchange options during authentication (enables - IndirectData and TCPOnly) +Check for sys/mman.h. -2001-12-23 15:06 Guus Sliepen +------------------------------------------------------------------------ +r1196 | guus | 2003-07-21 15:15:36 +0200 (Mon, 21 Jul 2003) | 2 lines - * src/conf.c: Fix boolean "no". +Oops. -2001-12-20 14:53 Guus Sliepen +------------------------------------------------------------------------ +r1195 | guus | 2003-07-21 15:14:02 +0200 (Mon, 21 Jul 2003) | 2 lines - * src/protocol.c: Resynchronise completely after receiving bad - DEL_EDGE. +Be consistent. -2001-12-18 22:12 Guus Sliepen +------------------------------------------------------------------------ +r1194 | guus | 2003-07-18 16:10:27 +0200 (Fri, 18 Jul 2003) | 2 lines - * doc/: tinc.conf.5, tincd.8: - - Revamped man pages to make them more maintainable. - - Reflect new and changed options. +No UNIX style permissions under Windows. -2001-12-18 22:10 Guus Sliepen +------------------------------------------------------------------------ +r1193 | guus | 2003-07-18 16:09:47 +0200 (Fri, 18 Jul 2003) | 2 lines - * po/nl.po: Updated dutch translation. +Oops. -2001-12-18 15:33 Guus Sliepen +------------------------------------------------------------------------ +r1192 | guus | 2003-07-18 15:45:06 +0200 (Fri, 18 Jul 2003) | 3 lines - * src/linux/device.c: Make mymac extern. +Use iface instead of interface because it might already be declared in +system header files. -2001-12-18 15:32 Guus Sliepen +------------------------------------------------------------------------ +r1191 | guus | 2003-07-18 15:42:35 +0200 (Fri, 18 Jul 2003) | 2 lines - * src/freebsd/device.c: FreeBSD compile fixes. +Check for ethernet/ipv4/ipv6 related structures. -2001-12-18 00:11 Guus Sliepen +------------------------------------------------------------------------ +r1190 | guus | 2003-07-18 15:41:37 +0200 (Fri, 18 Jul 2003) | 2 lines - * src/: graph.c, net.c, node.h, protocol.c: Updated semantics for - the meta protocol and fixed a few small bugs. +Update all device.c files. -2001-12-16 14:51 Guus Sliepen +------------------------------------------------------------------------ +r1189 | guus | 2003-07-18 14:21:03 +0200 (Fri, 18 Jul 2003) | 2 lines - * configure.in, src/conf.c, src/conf.h, src/net.c: Added - configurable statistics logging for the Cube project. +Remove all #ifndefs from route.c -2001-11-16 23:41 Ivo Timmermans +------------------------------------------------------------------------ +r1188 | guus | 2003-07-18 14:16:24 +0200 (Fri, 18 Jul 2003) | 2 lines - * src/net.c: Conversion to struct addrinfo is almost complete for - this file. +Even more missing definitions. -2001-11-16 23:40 Ivo Timmermans +------------------------------------------------------------------------ +r1185 | guus | 2003-07-17 17:06:27 +0200 (Thu, 17 Jul 2003) | 3 lines - * src/tincd.c: Don't include netutl.h. +Big header file cleanup: everything that has to do with standard system +libraries is moved to system.h. -2001-11-16 23:31 Ivo Timmermans +------------------------------------------------------------------------ +r1184 | guus | 2003-07-15 18:38:18 +0200 (Tue, 15 Jul 2003) | 2 lines - * src/conf.c: Fixed silly typo: "np" instead of "no" +Windows headers declare a struct interface somewhere. -2001-11-16 23:31 Ivo Timmermans +------------------------------------------------------------------------ +r1183 | guus | 2003-07-15 18:27:39 +0200 (Tue, 15 Jul 2003) | 2 lines - * src/conf.c: get_config_subnet needs to be fixed. +Make use of the CIPE driver. Woohoo, tinc for Windows! -2001-11-16 18:40 Ivo Timmermans +------------------------------------------------------------------------ +r1182 | guus | 2003-07-15 18:26:18 +0200 (Tue, 15 Jul 2003) | 2 lines - * src/route.c: route_ipv4 and route_ipv6 replaced by route_ip. +Export mymac. -2001-11-16 18:39 Ivo Timmermans +------------------------------------------------------------------------ +r1181 | guus | 2003-07-12 22:24:04 +0200 (Sat, 12 Jul 2003) | 2 lines - * src/protocol.c: Don't include netutl.h. +Format string checking for logger(). -2001-11-16 18:39 Ivo Timmermans +------------------------------------------------------------------------ +r1180 | guus | 2003-07-12 22:19:22 +0200 (Sat, 12 Jul 2003) | 2 lines - * src/node.c: lookup_node_udp changed. +Removing distribution specific files from CVS. -2001-11-16 18:38 Ivo Timmermans +------------------------------------------------------------------------ +r1179 | guus | 2003-07-12 19:48:38 +0200 (Sat, 12 Jul 2003) | 2 lines - * src/net.c: First part of rewriting things to use struct addrinfo. +Update copyrights. -2001-11-16 18:36 Ivo Timmermans +------------------------------------------------------------------------ +r1178 | guus | 2003-07-12 19:41:48 +0200 (Sat, 12 Jul 2003) | 2 lines - * lib/: dropin.c, dropin.h: Added dropin replacements for get*info - and helper functions. +Simplify logging, update copyrights and some minor cleanups. -2001-11-16 17:16 Ivo Timmermans +------------------------------------------------------------------------ +r1177 | guus | 2003-07-11 18:13:00 +0200 (Fri, 11 Jul 2003) | 3 lines - * acconfig.h: Added HAVE_STRUCT_ADDRINFO +More missing IPv6 definitions and autoconf checks to make sure it compiles +under Solaris 2.6. -2001-11-16 16:56 Ivo Timmermans +------------------------------------------------------------------------ +r1176 | guus | 2003-07-07 13:50:52 +0200 (Mon, 07 Jul 2003) | 2 lines - * src/node.h: - (re)added port to struct node_t +More missing definitions. -2001-11-16 13:21 Ivo Timmermans +------------------------------------------------------------------------ +r1175 | guus | 2003-07-07 13:13:31 +0200 (Mon, 07 Jul 2003) | 2 lines - * src/: netutl.c, netutl.h: Obsoleted. +Actually add ipv6.h. -2001-11-16 13:20 Ivo Timmermans +------------------------------------------------------------------------ +r1174 | guus | 2003-07-07 13:11:33 +0200 (Mon, 07 Jul 2003) | 2 lines - * src/: connection.c, edge.c, net.c: Don't include netutl.h. +Provide all missing IPv6 definitions in lib/ipv6.h. -2001-11-16 13:17 Ivo Timmermans +------------------------------------------------------------------------ +r1172 | guus | 2003-07-07 01:16:29 +0200 (Mon, 07 Jul 2003) | 2 lines - * src/conf.c: Don't include netutl.h. +Sprinkling the source with static and attributes. -2001-11-16 13:16 Ivo Timmermans +------------------------------------------------------------------------ +r1171 | guus | 2003-07-07 00:11:37 +0200 (Mon, 07 Jul 2003) | 3 lines - * src/Makefile.am: Don't compile/link netutl.c. +Define logger(), cleans up source code and allows us to write log entries +to a separate file. -2001-11-16 13:14 Ivo Timmermans +------------------------------------------------------------------------ +r1168 | guus | 2003-07-06 19:49:49 +0200 (Sun, 06 Jul 2003) | 2 lines - * src/conf.h: get_config_{ip,port} removed. +Check for IPv6 header files. -2001-11-16 13:12 Ivo Timmermans +------------------------------------------------------------------------ +r1167 | guus | 2003-07-06 19:15:25 +0200 (Sun, 06 Jul 2003) | 4 lines - * src/: node.h, edge.h: Changed to use struct addrinfo where - needed. +- simplify configure.in +- drop support for OpenSSL < 0.9.7 +- add some missing definitions/includes -2001-11-16 13:10 Ivo Timmermans +------------------------------------------------------------------------ +r1166 | guus | 2003-06-25 22:55:05 +0200 (Wed, 25 Jun 2003) | 3 lines - * src/subnet.h: Obsoleted all IP types in favor of struct - addrinfo +This subtle pointer arithmetic thingy is (I'm very sure of it) the cause +of the lingering connections problem. Hopefully it is fixed now... -2001-11-16 13:08 Ivo Timmermans +------------------------------------------------------------------------ +r1165 | guus | 2003-06-25 22:52:59 +0200 (Wed, 25 Jun 2003) | 2 lines - * src/net.h: Removed definitions of ipv4_t, ipv6_t, port_t +Really make tinc default to any addressfamily. -2001-11-16 13:02 Ivo Timmermans +------------------------------------------------------------------------ +r1164 | guus | 2003-06-12 13:08:40 +0200 (Thu, 12 Jun 2003) | 2 lines - * src/connection.c: Changed lookup_connection to use struct - addrinfo +There are two lzo compression levels. -2001-11-16 13:01 Ivo Timmermans +------------------------------------------------------------------------ +r1163 | guus | 2003-06-11 22:36:36 +0200 (Wed, 11 Jun 2003) | 2 lines - * src/connection.h: Changed prototype for lookup_connection to use - struct addrinfo +Typo and conversion to UTF-8. -2001-11-16 01:23 Ivo Timmermans +------------------------------------------------------------------------ +r1162 | guus | 2003-06-11 22:19:46 +0200 (Wed, 11 Jun 2003) | 2 lines - * src/connection.h: Use struct addrinfo in connection_t to hold all - host data such as IP address and port +Update dutch translation. -2001-11-16 01:13 Ivo Timmermans +------------------------------------------------------------------------ +r1161 | guus | 2003-06-11 22:18:48 +0200 (Wed, 11 Jun 2003) | 2 lines - * src/conf.c: Deprecated get_config_ip and get_config_port +Update documentation. -2001-11-16 00:49 Ivo Timmermans +------------------------------------------------------------------------ +r1160 | guus | 2003-06-11 21:40:43 +0200 (Wed, 11 Jun 2003) | 2 lines - * configure.in: Check for struct addrinfo +More braces to make gcc happy. -2001-11-16 00:28 Ivo Timmermans +------------------------------------------------------------------------ +r1159 | guus | 2003-06-11 21:39:02 +0200 (Wed, 11 Jun 2003) | 2 lines - * AUTHORS: Credit OpenSSH +Fixes from Wessel Danker's libavl. -2001-11-16 00:26 Ivo Timmermans +------------------------------------------------------------------------ +r1158 | guus | 2003-06-11 21:28:38 +0200 (Wed, 11 Jun 2003) | 2 lines - * configure.in: Check for getnameinfo, gai_strerror, freeaddrinfo +Remove mymac stuff from device.c. -2001-11-16 00:05 Ivo Timmermans +------------------------------------------------------------------------ +r1157 | guus | 2003-06-11 21:27:35 +0200 (Wed, 11 Jun 2003) | 2 lines - * configure.in: Check for getaddrinfo +AddressFamily is "any" by default. -2001-11-05 20:09 Guus Sliepen +------------------------------------------------------------------------ +r1156 | guus | 2003-06-11 21:09:52 +0200 (Wed, 11 Jun 2003) | 3 lines - * lib/dropin.c, lib/utils.c, src/net.c: More fixes for Solaris. +If we have a Linux tun/tap device and we are in router mode, open the device +in tun mode. -2001-11-05 20:06 Guus Sliepen +------------------------------------------------------------------------ +r1155 | guus | 2003-06-11 21:07:56 +0200 (Wed, 11 Jun 2003) | 2 lines - * lib/dropin.c, lib/dropin.h, lib/utils.c, src/solaris/device.c: - Various fixes needed for Solaris. +Call make_names() before doing anything else. -2001-11-05 00:48 Guus Sliepen +------------------------------------------------------------------------ +r1154 | guus | 2003-06-07 15:18:32 +0200 (Sat, 07 Jun 2003) | 2 lines - * src/protocol.c: Correctly check if subnet owner exists. +Fix warning and add missing checks for LZO library. -2001-11-05 00:29 Guus Sliepen +------------------------------------------------------------------------ +r1152 | guus | 2003-05-18 00:12:52 +0200 (Sun, 18 May 2003) | 2 lines - * src/protocol.c: Be liberal in what you accept: allow unknown - edges to be deleted. +Fix links. -2001-11-03 23:53 Guus Sliepen +------------------------------------------------------------------------ +r1151 | guus | 2003-05-07 13:21:58 +0200 (Wed, 07 May 2003) | 2 lines - * src/: net.c, process.c: [no log message] +Small fixes. -2001-11-03 22:22 Guus Sliepen +------------------------------------------------------------------------ +r1150 | guus | 2003-05-07 01:14:45 +0200 (Wed, 07 May 2003) | 2 lines - * src/protocol.c: Several bugfixes. +Small fixes to make LZO compression work. -2001-11-03 22:21 Guus Sliepen +------------------------------------------------------------------------ +r1149 | guus | 2003-05-06 23:13:18 +0200 (Tue, 06 May 2003) | 4 lines - * src/net.c: Use PEM functions as suggested by OpenSSL docs. +- Per-node EVP_CIPHER_CTX to avoid initialisation overhead. +- LZO compression, thanks to Teemu Kiviniemi. +- Updated dutch translation. -2001-10-31 21:37 Guus Sliepen +------------------------------------------------------------------------ +r1148 | guus | 2003-04-19 13:12:45 +0200 (Sat, 19 Apr 2003) | 2 lines - * src/: netutl.c, process.c, protocol.c: Some very small fixes +Make sure outgoing_t is completely freed. -2001-10-31 21:22 Guus Sliepen +------------------------------------------------------------------------ +r1147 | guus | 2003-04-18 23:18:36 +0200 (Fri, 18 Apr 2003) | 2 lines - * src/net.c: Avoid connecting to another node twice, and check name - of outgoing connections. +Better handling of late packets. -2001-10-31 21:07 Guus Sliepen +------------------------------------------------------------------------ +r1146 | guus | 2003-04-03 13:43:17 +0200 (Thu, 03 Apr 2003) | 4 lines - * src/conf.c: Show cfg->variable instead of cfg->value when - complaining about wrong type. +HUP signal now closes connections to hosts if their host config file is +gone or changed. The tinc.conf file is reread for changes in the ConnectTo +lines. -2001-10-31 21:02 Guus Sliepen +------------------------------------------------------------------------ +r1145 | guus | 2003-03-29 23:11:22 +0100 (Sat, 29 Mar 2003) | 2 lines - * src/protocol.c: Don't forget to read public RSA key when making - an outgoing connection. +Checksums must also work for uneven number of bytes. -2001-10-31 13:50 Guus Sliepen +------------------------------------------------------------------------ +r1144 | guus | 2003-03-29 22:58:35 +0100 (Sat, 29 Mar 2003) | 2 lines - * src/: device.h, graph.c, graph.h, net.c, node.c, process.c, - protocol.c, linux/device.c: - - Small fixes to graph algorithms - - More control over tap device, ability to set interface name to - something other than the netname. - - Export NETNAME, DEVICE and INTERFACE environment variables to - scripts. +Don't copy more than necessary. -2001-10-30 17:34 Guus Sliepen +------------------------------------------------------------------------ +r1143 | guus | 2003-03-29 22:51:21 +0100 (Sat, 29 Mar 2003) | 4 lines - * src/: connection.c, connection.h, net.c, protocol.c: More updates - to protocol handlers and reimplemented terminate_connection(). +- Speed up checksumming +- If a destination is not found in the subnet list or the destination node + is unreachable, respond with an appropiate ICMP message. -2001-10-30 13:59 Guus Sliepen +------------------------------------------------------------------------ +r1142 | guus | 2003-03-28 14:41:49 +0100 (Fri, 28 Mar 2003) | 3 lines - * src/: Makefile.am, edge.c, graph.c, net.c, node.c, protocol.c, - subnet.c: Various fixes, tinc is now somewhat capable of actually - working again. +- Avoid memory leak caused by OpenSSL 0.9.7a. +- Disable RSA_blinding_on() because it segfaults. -2001-10-29 14:14 Guus Sliepen +------------------------------------------------------------------------ +r1141 | guus | 2003-03-19 12:45:05 +0100 (Wed, 19 Mar 2003) | 2 lines - * src/graph.h: file graph.h was initially added on branch CABAL. +Typo. -2001-10-29 14:14 Guus Sliepen +------------------------------------------------------------------------ +r1140 | guus | 2003-03-19 12:43:42 +0100 (Wed, 19 Mar 2003) | 2 lines - * src/: graph.c, graph.h: Working version of Kruskal's algorithm. - The running time is very bad though. +Make sure send_meta() writes everything. -2001-10-28 23:42 Guus Sliepen +------------------------------------------------------------------------ +r1139 | zarq | 2003-03-14 10:43:10 +0100 (Fri, 14 Mar 2003) | 4 lines - * src/: connection.c, connection.h, edge.c, edge.h, graph.c, - node.c, node.h, protocol.c, subnet.c, subnet.h: - - More changes needed for Kruskal's algorithm - - Implemented a breadth-first search algorithm as a cheap - substitution for a single-source shortest path algorithm. +Call RSA_blinding_on(), as advised in the paper on +http://crypto.stanford.edu/~dabo/abstracts/ssl-timing.html +to offer some resistance against timing attacks. -2001-10-28 11:16 Guus Sliepen +------------------------------------------------------------------------ +r1138 | guus | 2003-01-17 01:43:58 +0100 (Fri, 17 Jan 2003) | 2 lines - * src/graph.c: file graph.c was initially added on branch CABAL. +Various fixes for autoconf and OpenSSL 0.9.7 and a missing header. -2001-10-28 11:16 Guus Sliepen +------------------------------------------------------------------------ +r1137 | guus | 2003-01-17 01:37:20 +0100 (Fri, 17 Jan 2003) | 5 lines - * src/: Makefile.am, connection.h, edge.c, edge.h, graph.c, net.c, - node.h, process.c, protocol.c: - - More s/vertex/edge/g - - Implementation of Kruskal's minimum spanning tree algorithm. +- Fix indentation in some places. +- Optimise select loop. +- Remove unused function setup_outgoing_socket(). +- Clear EVP_CIPHER_CTX structures before using them. -2001-10-28 09:41 Guus Sliepen +------------------------------------------------------------------------ +r1136 | guus | 2003-01-14 13:53:59 +0100 (Tue, 14 Jan 2003) | 2 lines - * src/edge.c: file edge.c was initially added on branch CABAL. +Add $NAME for tinc-up/down scripts. -2001-10-28 09:41 Guus Sliepen +------------------------------------------------------------------------ +r1135 | guus | 2003-01-12 18:02:23 +0100 (Sun, 12 Jan 2003) | 3 lines - * src/: Makefile.am, conf.h, connection.c, connection.h, edge.c, - edge.h, net.c, protocol.c, protocol.h, tincd.c, vertex.c, vertex.h: - What was I thinking? s/vertex/edge/g. +Run graph algorithm when replacing a second connection from the same host +replaces an older one. -2001-10-28 09:41 Guus Sliepen +------------------------------------------------------------------------ +r1134 | guus | 2002-12-27 20:32:33 +0100 (Fri, 27 Dec 2002) | 2 lines - * src/edge.h: file edge.h was initially added on branch CABAL. +PrivateKeyFile instead of PrivateKey. -2001-10-27 17:19 Guus Sliepen +------------------------------------------------------------------------ +r1133 | guus | 2002-11-14 23:09:03 +0100 (Thu, 14 Nov 2002) | 2 lines - * src/: conf.c, connection.c, net.c, process.c, tincd.c: Various - small fixes to make tinc runnable again. +Fix PriorityInheritance. -2001-10-27 15:13 Guus Sliepen +------------------------------------------------------------------------ +r1132 | guus | 2002-10-07 09:32:31 +0200 (Mon, 07 Oct 2002) | 2 lines - * src/: device.h, net.c, net.h, node.c, process.c, route.c, - subnet.c, subnet.h, vertex.c, linux/device.c: Make sure everything - links. +Add documentation for BindToAddress. -2001-10-27 14:13 Guus Sliepen +------------------------------------------------------------------------ +r1131 | zarq | 2002-09-30 21:04:37 +0200 (Mon, 30 Sep 2002) | 2 lines - * src/: conf.c, conf.h, connection.c, connection.h, device.h, - meta.c, net.c, net.h, netutl.c, netutl.h, node.c, node.h, - process.c, protocol.c, protocol.h, route.c, route.h, subnet.c, - subnet.h, tincd.c, vertex.c, vertex.h, linux/device.c: Big bad - commit: - - Transition to new node/vertex/connection structures - - Use new configuration handling everywhere - - Linux tun/tap device handling cleanup - - Start of IPv6 support in route.c - - It compiles, but it won't link. +Fix saving of debug level for startup level 0 -2001-10-13 15:53 Guus Sliepen +------------------------------------------------------------------------ +r1130 | guus | 2002-09-24 13:43:34 +0200 (Tue, 24 Sep 2002) | 2 lines - * acconfig.h, configure.in, src/Makefile.am: Support new files - (node/vertex/device.[ch]) and OpenBSD. +Run graph() after edge_del() when updating an edge. -2001-10-12 17:52 Guus Sliepen +------------------------------------------------------------------------ +r1129 | wsl | 2002-09-16 16:08:04 +0200 (Mon, 16 Sep 2002) | 3 lines - * src/openbsd/device.c: Forgot the tun specific stuff. +its: Engels voor "van het" - 3e persoon enkelvoud, genitief, onzijdig +it's: Engels voor "het is". Dus niet "van het". -2001-10-12 17:49 Guus Sliepen +------------------------------------------------------------------------ +r1127 | guus | 2002-09-16 00:37:59 +0200 (Mon, 16 Sep 2002) | 2 lines - * src/openbsd/device.c: file device.c was initially added on branch - CABAL. +Thank some more people. -2001-10-12 17:49 Guus Sliepen +------------------------------------------------------------------------ +r1126 | guus | 2002-09-16 00:34:25 +0200 (Mon, 16 Sep 2002) | 2 lines - * src/openbsd/device.c: Added OpenBSD tun device handling. Untested - though. +Remarks about 1.0pre8 release. -2001-10-12 17:38 Guus Sliepen +------------------------------------------------------------------------ +r1125 | guus | 2002-09-16 00:19:38 +0200 (Mon, 16 Sep 2002) | 2 lines - * src/solaris/device.c: Forgot to remove some old #ifdef stuff. +Update documentation. -2001-10-12 17:33 Guus Sliepen +------------------------------------------------------------------------ +r1124 | guus | 2002-09-16 00:19:19 +0200 (Mon, 16 Sep 2002) | 2 lines - * src/solaris/device.c: file device.c was initially added on branch - CABAL. +Use /dev/net/tun as default for tun/tap device under Linux. -2001-10-12 17:33 Guus Sliepen +------------------------------------------------------------------------ +r1123 | guus | 2002-09-15 19:40:00 +0200 (Sun, 15 Sep 2002) | 2 lines - * src/solaris/device.c: Solaris tun device handling cleaned up a - bit and added. +Updated dutch translation. -2001-10-12 17:22 Guus Sliepen +------------------------------------------------------------------------ +r1122 | guus | 2002-09-15 16:55:54 +0200 (Sun, 15 Sep 2002) | 2 lines - * src/freebsd/device.c: Added FreeBSD tap device handling. +Small fixes so tinc compiles out of the box on SunOS 5.8 -2001-10-12 17:22 Guus Sliepen +------------------------------------------------------------------------ +r1121 | guus | 2002-09-15 14:26:24 +0200 (Sun, 15 Sep 2002) | 2 lines - * src/freebsd/device.c: file device.c was initially added on branch - CABAL. +port_t isn't used anymore and conflicts with MacOS/X headers. -2001-10-12 17:16 Guus Sliepen +------------------------------------------------------------------------ +r1120 | guus | 2002-09-15 14:26:04 +0200 (Sun, 15 Sep 2002) | 2 lines - * src/linux/device.c: file device.c was initially added on branch - CABAL. +MacOS/X needs #define _P1003_1B_VISIBLE in order to use mlockall(). -2001-10-12 17:16 Guus Sliepen +------------------------------------------------------------------------ +r1119 | guus | 2002-09-12 00:25:58 +0200 (Thu, 12 Sep 2002) | 2 lines - * src/: device.h, linux/device.c: - - Split tap device stuff out of net.[ch] - - Each OS gets it's own device.c to get rid of evil #ifdefs. - - Cleaned up Linux ethertap and tun/tap handling. +What was I thinking? -2001-10-12 17:16 Guus Sliepen +------------------------------------------------------------------------ +r1118 | guus | 2002-09-11 00:13:22 +0200 (Wed, 11 Sep 2002) | 2 lines - * src/device.h: file device.h was initially added on branch CABAL. +Make sure malloc() is declared. -2001-10-10 22:35 Guus Sliepen +------------------------------------------------------------------------ +r1117 | guus | 2002-09-11 00:13:01 +0200 (Wed, 11 Sep 2002) | 2 lines - * src/: connection.c, connection.h, node.h, vertex.h: More updates - to new node/vertex/connection combo. +Fix placement of #include "config.h" -2001-10-10 22:34 Guus Sliepen +------------------------------------------------------------------------ +r1116 | guus | 2002-09-10 23:46:05 +0200 (Tue, 10 Sep 2002) | 2 lines - * src/: conf.c, conf.h: Revamp configuration handling: - - Store everything in AVL trees (fast lookup) - - No need for hazahaza anymore - - Parse values when needed - - This simplifies a lot of config variable lookups. +Link with libintl if necessary. -2001-10-10 11:42 Guus Sliepen +------------------------------------------------------------------------ +r1115 | guus | 2002-09-10 23:29:42 +0200 (Tue, 10 Sep 2002) | 2 lines - * src/: connection.c, connection.h: Removed everything from - connection.c that has already been moved to node.c and vertex.c. +Clean up after indent. -2001-10-10 10:49 Guus Sliepen +------------------------------------------------------------------------ +r1114 | guus | 2002-09-10 11:40:25 +0200 (Tue, 10 Sep 2002) | 2 lines - * src/node.c: file node.c was initially added on branch CABAL. +Fix compiler warnings. -2001-10-10 10:49 Guus Sliepen +------------------------------------------------------------------------ +r1113 | guus | 2002-09-10 00:41:56 +0200 (Tue, 10 Sep 2002) | 2 lines - * src/vertex.c: file vertex.c was initially added on branch CABAL. +Let GCC check format string and arguments of send_request(). -2001-10-10 10:49 Guus Sliepen +------------------------------------------------------------------------ +r1112 | guus | 2002-09-10 00:33:31 +0200 (Tue, 10 Sep 2002) | 2 lines - * src/: connection.h, node.c, node.h, vertex.c, vertex.h: Further - implementation of doc/CONNECTIVITY. connection.[ch] is now split - into a node, vertex and connection part. +Remove redundant spaces. -2001-10-09 21:41 Wessel Dankers +------------------------------------------------------------------------ +r1111 | guus | 2002-09-09 23:49:16 +0200 (Mon, 09 Sep 2002) | 2 lines - * autogen.sh: make is not always GNU make. +Switch to K&R style indentation. -2001-10-09 21:37 Guus Sliepen +------------------------------------------------------------------------ +r1110 | guus | 2002-09-09 23:25:28 +0200 (Mon, 09 Sep 2002) | 2 lines - * src/: node.h, vertex.h: Small corrections. +Switch to K&R style indentation. -2001-10-09 21:30 Guus Sliepen +------------------------------------------------------------------------ +r1109 | guus | 2002-09-09 21:40:12 +0200 (Mon, 09 Sep 2002) | 5 lines - * src/: node.h, vertex.h: Started implementing doc/CONNECTIVITY. +Cleanups: + - Convert cp to cp(); so that automatic indenters work. + - Convert constructions like if(x == NULL) to if(!x). + - Move all assignments out of conditions. -2001-10-09 21:30 Guus Sliepen +------------------------------------------------------------------------ +r1108 | guus | 2002-09-06 23:22:35 +0200 (Fri, 06 Sep 2002) | 2 lines - * src/node.h: file node.h was initially added on branch CABAL. +Why don't these connection_t's get cleaned up? -2001-10-09 21:30 Guus Sliepen +------------------------------------------------------------------------ +r1107 | guus | 2002-09-06 23:02:36 +0200 (Fri, 06 Sep 2002) | 2 lines - * src/vertex.h: file vertex.h was initially added on branch CABAL. +Fix MST algorithm. -2001-10-08 17:47 Guus Sliepen +------------------------------------------------------------------------ +r1106 | guus | 2002-09-06 16:31:12 +0200 (Fri, 06 Sep 2002) | 2 lines - * po/nl.po: Updated dutch translation. +Reset the *correct* seqnos. -2001-10-08 17:37 Guus Sliepen +------------------------------------------------------------------------ +r1105 | guus | 2002-09-06 14:19:16 +0200 (Fri, 06 Sep 2002) | 2 lines - * src/protocol.c: Fix bug when dropping an old connection in favour - of a new one from the same host. +edge_weight_compare() shouldn't rely on edge_compare(). -2001-10-08 15:37 Guus Sliepen +------------------------------------------------------------------------ +r1104 | zarq | 2002-09-06 13:08:21 +0200 (Fri, 06 Sep 2002) | 2 lines - * src/net.c: - - Use ping timeout mechanism to close connections that don't - authenticate in time. - - Fix potential segmentation fault in check_dead_connections(). +Added AM_MAINTAINER_MODE -2001-10-08 13:59 Guus Sliepen +------------------------------------------------------------------------ +r1103 | guus | 2002-09-06 12:23:52 +0200 (Fri, 06 Sep 2002) | 2 lines - * src/net.c: Fix bug where tinc would crash because of a portscan - or a connection from a tinc daemon with a different version. +Remove global edge_tree. -2001-10-08 13:47 Guus Sliepen +------------------------------------------------------------------------ +r1102 | guus | 2002-09-06 11:48:39 +0200 (Fri, 06 Sep 2002) | 2 lines - * src/: connection.c, connection.h, net.c, protocol.c: - - Renamed lastbutonehop to prevhop. - - Added connection_t *via to connection_t, this keeps record of - where to send UDP packets to. +Only reset seqno's when a key is sent or received. -2001-09-25 15:39 Guus Sliepen +------------------------------------------------------------------------ +r1101 | guus | 2002-09-05 01:11:58 +0200 (Thu, 05 Sep 2002) | 2 lines - * src/net.c: Fill in next- and lastbutonehop for myself. +Typo. -2001-09-25 15:35 Guus Sliepen +------------------------------------------------------------------------ +r1100 | guus | 2002-09-05 01:05:49 +0200 (Thu, 05 Sep 2002) | 2 lines - * src/net.c: Try next connectto instead of the same over and over. +Add missing headers. -2001-09-24 16:16 Guus Sliepen +------------------------------------------------------------------------ +r1099 | guus | 2002-09-05 01:04:52 +0200 (Thu, 05 Sep 2002) | 2 lines - * src/connection.c: Show next- and lastbutonehop when dumping - connectionlist to syslog. +Run autopoint and libtoolize before creating initial makefiles. -2001-09-24 16:11 Guus Sliepen +------------------------------------------------------------------------ +r1098 | guus | 2002-09-04 21:57:53 +0200 (Wed, 04 Sep 2002) | 2 lines - * src/: connection.h, net.c, protocol.c, protocol.h: Not only keep - track of nexthop, but also of lastbutonehop. If destination cl wants - indirectdata, send it to the lastbutonehop instead, unless it too - has requested so, and so on. +Small updates. -2001-09-24 15:31 Guus Sliepen +------------------------------------------------------------------------ +r1097 | guus | 2002-09-04 18:36:03 +0200 (Wed, 04 Sep 2002) | 2 lines - * src/net.c: - - Try old TUN/TAP ioctl() request if the one from if_tun.h fails. - - Be more verbose about the kind of tap device used. +Updated dutch translation. -2001-09-05 20:38 Ivo Timmermans +------------------------------------------------------------------------ +r1096 | guus | 2002-09-04 18:26:45 +0200 (Wed, 04 Sep 2002) | 2 lines - * src/process.c: Killing tincd with SIGINT causes it to toggle - between the current debug level and level 5. Useful to debug a - running tincd. +Generalized request broadcasting/forwarding. -2001-09-01 14:46 Guus Sliepen +------------------------------------------------------------------------ +r1095 | guus | 2002-09-04 16:17:28 +0200 (Wed, 04 Sep 2002) | 2 lines - * src/: conf.c, conf.h: config_t* is a const parameter in - get_config_val(). +Small fixes. -2001-09-01 14:36 Guus Sliepen +------------------------------------------------------------------------ +r1094 | guus | 2002-09-04 15:48:52 +0200 (Wed, 04 Sep 2002) | 2 lines - * src/: process.c, process.h, tincd.c: Optional signal number for - -k option. +Revert to edge and graph stuff. This time, use a directed graph. -2001-09-01 14:36 Guus Sliepen +------------------------------------------------------------------------ +r1093 | guus | 2002-09-04 10:48:03 +0200 (Wed, 04 Sep 2002) | 3 lines - * src/net.c: Revised reconnection mechanism, always try out all - ConnectTo lines. +Just ignore wrong ADD_NODEs instead of replying with a DEL_NODE, in the +hope other DEL_NODEs will catch up eventually. -2001-09-01 14:02 Guus Sliepen +------------------------------------------------------------------------ +r1092 | guus | 2002-09-04 10:36:34 +0200 (Wed, 04 Sep 2002) | 2 lines - * src/protocol.c: Remove IndirectData support for now, new - implementation will be added later. +Don't forget to set prevhop to myself for new connections. -2001-08-28 22:52 Guus Sliepen +------------------------------------------------------------------------ +r1091 | guus | 2002-09-04 10:33:08 +0200 (Wed, 04 Sep 2002) | 2 lines - * src/subnet.c: Fix signed comparison bug in lookup_subnet_ipv4(). +Prevent looping DEL_NODE/ADD_NODE messages after a node disconnects. -2001-08-17 20:14 Guus Sliepen +------------------------------------------------------------------------ +r1090 | guus | 2002-09-04 10:02:33 +0200 (Wed, 04 Sep 2002) | 2 lines - * src/: net.c, protocol.c: Don't send DEL_HOSTs when !status.meta +Reduce KEY_CHANGED traffic. -2001-07-24 22:14 Guus Sliepen +------------------------------------------------------------------------ +r1089 | guus | 2002-09-04 00:49:55 +0200 (Wed, 04 Sep 2002) | 2 lines - * src/net.c: Explicitly log which type of tunnel device is used. +Woops. -2001-07-24 22:13 Guus Sliepen +------------------------------------------------------------------------ +r1088 | guus | 2002-09-04 00:37:49 +0200 (Wed, 04 Sep 2002) | 2 lines - * src/conf.h: The val variable in a config_t is never used as a - long. +A reachable node is always more preferable to an unreachable one... -2001-07-24 22:04 Guus Sliepen +------------------------------------------------------------------------ +r1087 | guus | 2002-09-03 22:43:26 +0200 (Tue, 03 Sep 2002) | 2 lines - * src/tincd.c: Write public key to rsa_key.pub instead of - rsa_key.priv (if not host configuration file is found). +Drop graph and edge stuff. Use new node stuff instead. -2001-07-24 22:03 Guus Sliepen +------------------------------------------------------------------------ +r1086 | guus | 2002-09-03 22:42:05 +0200 (Tue, 03 Sep 2002) | 2 lines - * src/: conf.c, process.c: Don't use %m in fprintf(). +Make sure setlocale() is available. -2001-07-24 10:51 Guus Sliepen +------------------------------------------------------------------------ +r1085 | guus | 2002-09-03 00:40:42 +0200 (Tue, 03 Sep 2002) | 2 lines - * doc/CONNECTIVITY: More on edges. +Replacement for the current routing algorithm. -2001-07-24 00:06 Guus Sliepen +------------------------------------------------------------------------ +r1084 | guus | 2002-08-24 14:54:55 +0200 (Sat, 24 Aug 2002) | 2 lines - * doc/CONNECTIVITY: Discuss how sending ADD_EDGEs would be better - than sending ADD_HOSTs. +Check for ranlib. -2001-07-22 19:41 Guus Sliepen +------------------------------------------------------------------------ +r1083 | guus | 2002-08-24 14:11:40 +0200 (Sat, 24 Aug 2002) | 2 lines - * doc/CONNECTIVITY: Written down a possible solution. +Gettext 1.11.5 compatibility. -2001-07-22 17:25 Guus Sliepen +------------------------------------------------------------------------ +r1080 | guus | 2002-07-18 16:30:45 +0200 (Thu, 18 Jul 2002) | 2 lines - * doc/CONNECTIVITY: Correctie. +Added support for raw sockets. This can be used instead of tun/tap devices. -2001-07-22 16:58 Guus Sliepen +------------------------------------------------------------------------ +r1078 | guus | 2002-07-16 15:18:27 +0200 (Tue, 16 Jul 2002) | 2 lines - * doc/CONNECTIVITY: Small update. +Don't bother to chown, and correctly document ConnectTo. -2001-07-22 16:46 Guus Sliepen +------------------------------------------------------------------------ +r1077 | guus | 2002-07-16 15:12:49 +0200 (Tue, 16 Jul 2002) | 2 lines - * doc/CONNECTIVITY: Described problem in more detail. +Allow tincd to be locked into main memory. -2001-07-22 16:04 Guus Sliepen +------------------------------------------------------------------------ +r1076 | guus | 2002-07-12 13:45:21 +0200 (Fri, 12 Jul 2002) | 2 lines - * doc/CONNECTIVITY: file CONNECTIVITY was initially added on branch - CABAL. +Include complete fake-getname/addrinfo from OpenSSH. -2001-07-22 16:04 Guus Sliepen +------------------------------------------------------------------------ +r1071 | guus | 2002-07-11 14:57:06 +0200 (Thu, 11 Jul 2002) | 2 lines - * doc/CONNECTIVITY: Started writing a document about how daemons - connect to each other. +Added stub device.c for Cygwin. -2001-07-21 22:21 Guus Sliepen +------------------------------------------------------------------------ +r1070 | guus | 2002-07-11 14:55:58 +0200 (Thu, 11 Jul 2002) | 2 lines - * src/: net.c, route.c: Woohoo! tinc now compiles, runs and - actually *works* on Solaris! Tested on a SparcStation 20MP running - Solaris 7. (Thanks, jiggel!) +Started port to Cygwin. -2001-07-21 17:46 Guus Sliepen +------------------------------------------------------------------------ +r1068 | guus | 2002-07-11 14:42:43 +0200 (Thu, 11 Jul 2002) | 2 lines - * src/net.c: Always close all sockets in terminate_connection(). +Clear subnets before using them. -2001-07-21 17:34 Guus Sliepen +------------------------------------------------------------------------ +r1067 | guus | 2002-07-10 13:32:33 +0200 (Wed, 10 Jul 2002) | 2 lines - * src/: connection.c, net.c, net.h, protocol.c: Updated - terminate_connection() so you can choose if DEL_HOSTs should be sent - or not. +Allow identical subnets from different owners. -2001-07-20 22:25 Guus Sliepen +------------------------------------------------------------------------ +r1066 | guus | 2002-07-10 13:27:06 +0200 (Wed, 10 Jul 2002) | 4 lines - * src/: connection.c, connection.h, net.c, protocol.c, route.c: - Added purge_tree for connection_t's which are no longer in the - connection, active or id trees, but which may still be referenced. - This tree is flushed when it is safe, this replaces - purge_connection_tree(). - - Also lots of bugfixes related to the new trees. +Allow list of environment variables to be passed to execute_script(). +When executing host-up/down scripts, include the address and port of the +remote host. -2001-07-20 15:54 Guus Sliepen +------------------------------------------------------------------------ +r1065 | guus | 2002-06-21 19:49:48 +0200 (Fri, 21 Jun 2002) | 2 lines - * src/: meta.c, net.c, protocol.c, route.c, tincd.c: Remove all - unnecessary status.meta and status.active checks. +Fix for prefixlengths of 32 (IPv4) and 128 (IPv6) bits. -2001-07-19 14:29 Guus Sliepen +------------------------------------------------------------------------ +r1064 | guus | 2002-06-21 12:11:37 +0200 (Fri, 21 Jun 2002) | 3 lines - * src/: net.c, protocol.c: Correctly use the active_tree. +s/sliepen.warande.net/sliepen.eu.org/g +s/itimmermans@bigfoot.com/ivo@o2w.nl/g -2001-07-15 20:07 Guus Sliepen +------------------------------------------------------------------------ +r1063 | guus | 2002-06-14 13:51:29 +0200 (Fri, 14 Jun 2002) | 2 lines - * src/: connection.c, connection.h, net.c, protocol.c: Split - connection list into two lists: - - one list to handle all incoming/outgoing TCP connections - - another list to handle all UDP connections - - This will prevent race conditions. +Update comments about IPv6 autoconfiguration. -2001-07-15 16:21 Guus Sliepen +------------------------------------------------------------------------ +r1062 | guus | 2002-06-13 18:12:40 +0200 (Thu, 13 Jun 2002) | 2 lines - * m4/tuntap.m4, src/net.c: Correct inclusion of standard if_tun.h - header file. +Reset listen_sockets after SIGHUP. -2001-07-04 10:43 Guus Sliepen +------------------------------------------------------------------------ +r1061 | guus | 2002-06-12 15:45:23 +0200 (Wed, 12 Jun 2002) | 2 lines - * src/tincd.c: Don't load table of verbose OpenSSL errormessages. +Add configuration details for NetBSD and Darwin (MacOS/X). -2001-07-04 10:41 Guus Sliepen +------------------------------------------------------------------------ +r1060 | guus | 2002-06-11 13:03:17 +0200 (Tue, 11 Jun 2002) | 3 lines - * m4/openssl.m4, src/meta.c, src/net.c, src/protocol.c, - src/tincd.c: - - Always use instead of just - - Check if RAND_pseudo_bytes() exists, otherwise just use - RAND_bytes() +Autoconf cleanup. Works for both 2.13 and 2.53, although running autoconf +2.53 still gives some errors. -2001-07-01 23:42 Guus Sliepen +------------------------------------------------------------------------ +r1059 | guus | 2002-06-10 17:08:23 +0200 (Mon, 10 Jun 2002) | 2 lines - * src/protocol.c: Check for all potential duplicate entries in the - id tree. +Include darwin/device.c in distribution. -2001-07-01 11:21 Guus Sliepen +------------------------------------------------------------------------ +r1058 | guus | 2002-06-10 16:35:18 +0200 (Mon, 10 Jun 2002) | 2 lines - * src/route.c: Fix compiler warning. +Use darwin/device.c when compiling on MacOS/X. -2001-07-01 11:21 Guus Sliepen +------------------------------------------------------------------------ +r1057 | guus | 2002-06-10 16:33:40 +0200 (Mon, 10 Jun 2002) | 2 lines - * po/nl.po, src/protocol.c: Fix printf format bug. +Added Darwin (MacOS/X) tun device handling. -2001-07-01 11:06 Guus Sliepen +------------------------------------------------------------------------ +r1055 | zarq | 2002-06-09 18:23:12 +0200 (Sun, 09 Jun 2002) | 2 lines - * TODO: More items marked as done. +Added Alessandro Gatti -2001-06-29 17:38 Guus Sliepen +------------------------------------------------------------------------ +r1054 | zarq | 2002-06-09 18:19:20 +0200 (Sun, 09 Jun 2002) | 2 lines - * po/nl.po: Dutch translation updated. +Include netbsd's device.c in make dist -2001-06-29 17:33 Guus Sliepen +------------------------------------------------------------------------ +r1053 | zarq | 2002-06-09 18:12:04 +0200 (Sun, 09 Jun 2002) | 2 lines - * Makefile.am, redhat/tinc, redhat/tinc.spec: Update of RedHat - build scripts. +Include a few more header files -2001-06-29 17:32 Guus Sliepen +------------------------------------------------------------------------ +r1052 | zarq | 2002-06-09 17:58:05 +0200 (Sun, 09 Jun 2002) | 2 lines - * po/: es.po, nl.po, old/es.po: It appears that autogen.sh doesn't - like es.po if it isn't mentioned in the makefile/configure scripts. +Add /sw/{include,lib} to search paths if they exist -2001-06-29 17:32 Guus Sliepen +------------------------------------------------------------------------ +r1051 | zarq | 2002-06-09 17:50:12 +0200 (Sun, 09 Jun 2002) | 2 lines - * po/old/es.po: file es.po was initially added on branch CABAL. +getnameinfo fixes -2001-06-29 16:15 Guus Sliepen +------------------------------------------------------------------------ +r1050 | zarq | 2002-06-09 17:26:10 +0200 (Sun, 09 Jun 2002) | 2 lines - * m4/openssl.m4: Check for dlopen in standard libraries first - (needed for DEC OSF). +OSX support -2001-06-29 15:09 Guus Sliepen +------------------------------------------------------------------------ +r1048 | guus | 2002-06-08 16:08:57 +0200 (Sat, 08 Jun 2002) | 3 lines - * src/: connection.c, subnet.c: Fix gcc 3.0 warnings. +- netinet/* include files depend on netinet/in_systm.h. +- Squash bashism in configure.in. -2001-06-29 15:09 Guus Sliepen +------------------------------------------------------------------------ +r1047 | guus | 2002-06-08 15:46:43 +0200 (Sat, 08 Jun 2002) | 2 lines - * src/protocol.c: Log error if two hosts connect with same IP/port - tuple. +Use inttypes.h instead of stdint.h. -2001-06-29 13:09 Guus Sliepen +------------------------------------------------------------------------ +r1046 | guus | 2002-06-08 14:57:10 +0200 (Sat, 08 Jun 2002) | 5 lines - * Makefile.am: Also remove po/Makefile.in.in, which is generated by - autogen.sh. +Cleanup: + - Remove checks for specific OS's, instead check for #defines/#includes. + - Use uint??_t where appropriate. + - Mask handling functions use void pointers to get rid of silly casts. -2001-06-29 13:03 Guus Sliepen +------------------------------------------------------------------------ +r1045 | wsl | 2002-06-07 13:14:05 +0200 (Fri, 07 Jun 2002) | 2 lines - * po/es.po: es.po revived. +This should work much better. -2001-06-29 12:30 Guus Sliepen +------------------------------------------------------------------------ +r1044 | guus | 2002-06-05 02:25:55 +0200 (Wed, 05 Jun 2002) | 2 lines - * src/net.c: Execute tinc-down BEFORE tap device is closed. This is - a. more symmetric (tinc-up is started after tap device is opened) - and b. is needed for tun/tap device, where the interface does not - exist anymore after the device file is closed. +Use correct includes on NetBSD. -2001-06-29 12:27 Guus Sliepen +------------------------------------------------------------------------ +r1043 | guus | 2002-06-05 02:20:40 +0200 (Wed, 05 Jun 2002) | 2 lines - * configure.in: Don't build Spanish translation. +Make it work correctly with NetBSD tun device. -2001-06-29 12:27 Guus Sliepen +------------------------------------------------------------------------ +r1042 | guus | 2002-06-02 18:06:33 +0200 (Sun, 02 Jun 2002) | 3 lines - * ABOUT-NLS, Makefile.am: ABOUT-NLS is created by autogen.sh. +Support RSA_PUBKEYs (as opposed to RSAPublicKeys) so tinc accepts +public keys generated by the OpenSSL command line tools. -2001-06-29 12:23 Guus Sliepen +------------------------------------------------------------------------ +r1035 | guus | 2002-05-01 11:15:58 +0200 (Wed, 01 May 2002) | 2 lines - * po/es.po: Spanish translation removed. Nobody maintains it, and - it is severely outdated. +Only purge once when there are no more connections. -2001-06-27 00:00 Ivo Timmermans +------------------------------------------------------------------------ +r1033 | guus | 2002-04-29 22:05:07 +0200 (Mon, 29 Apr 2002) | 3 lines - * m4/tuntap.m4: Small fix to make it compile again +Fix very stupid bug in node_del(), which might have caused corruption of +subnets. -2001-06-21 20:28 Guus Sliepen +------------------------------------------------------------------------ +r1030 | guus | 2002-04-27 13:40:45 +0200 (Sat, 27 Apr 2002) | 2 lines - * m4/tuntap.m4: Reinstated search for if_tun.h in kernel source - tree, because apparently /usr/include/linux does not always have the - same contents as the include files from the currently running - kernel. +Informative log message if execl() failed. -2001-06-21 18:37 Guus Sliepen +------------------------------------------------------------------------ +r1029 | zarq | 2002-04-26 20:13:00 +0200 (Fri, 26 Apr 2002) | 2 lines - * src/net.c: Remove #warnings I used for debugging stuff. +Typo -2001-06-21 18:37 Guus Sliepen +------------------------------------------------------------------------ +r1028 | guus | 2002-04-25 21:17:24 +0200 (Thu, 25 Apr 2002) | 2 lines - * m4/openssl.m4: Check for and add -ldl. +Added Nick Patavalis for his RedHat package. -2001-06-21 18:16 Guus Sliepen +------------------------------------------------------------------------ +r1027 | guus | 2002-04-23 09:49:38 +0200 (Tue, 23 Apr 2002) | 2 lines - * src/: net.c, route.c: - - Solaris compile fixes - - Set mymac to broadcast MAC so that ifconfig hw ether <...> is - really not needed anymore. - - Forwarding of indirect packets when in switch mode (because the - kernel will not do it for us then). +Add BindToAddress variable, similar to the late BindToIP. -2001-06-20 23:32 Ivo Timmermans +------------------------------------------------------------------------ +r1026 | guus | 2002-04-19 16:06:40 +0200 (Fri, 19 Apr 2002) | 2 lines - * Makefile.am: Don't include the debian/ dir in a release +Support for MaxOS/X. -2001-06-09 12:00 Guus Sliepen +------------------------------------------------------------------------ +r1025 | zarq | 2002-04-18 22:09:05 +0200 (Thu, 18 Apr 2002) | 2 lines - * src/protocol.c: Woops - big bug in send_key_changed fixed. +Put #ifndef checks for HAVE_RAND_PSEUDO_BYTES in the correct places. -2001-06-08 20:02 Guus Sliepen +------------------------------------------------------------------------ +r981 | guus | 2002-04-09 13:44:47 +0200 (Tue, 09 Apr 2002) | 2 lines - * src/: net.c, net.h, protocol.c: Only reset seconds_till_retry - when we activate the outgoing connection. +Remarks about 1.0pre7 release. -2001-06-07 09:51 Guus Sliepen +------------------------------------------------------------------------ +r980 | guus | 2002-04-09 13:43:45 +0200 (Tue, 09 Apr 2002) | 2 lines - * m4/openssl.m4: Changed drastically because it didn't work - correctly: - - Don't cache the --with-openssl-* option arguments - - Only search for openssl/*.h, the openssl include files include - other files only from an openssl/ directory too - - Set CPPFLAGS before AC_CHECK_HEADERS +Updated dutch translation. -2001-06-07 09:48 Guus Sliepen +------------------------------------------------------------------------ +r979 | guus | 2002-04-09 13:43:29 +0200 (Tue, 09 Apr 2002) | 2 lines - * configure.in: Save configure cache more often. +masklength is better known as prefixlength -2001-06-06 21:12 Guus Sliepen +------------------------------------------------------------------------ +r978 | guus | 2002-04-09 13:42:48 +0200 (Tue, 09 Apr 2002) | 2 lines - * src/route.c: Fixes to make switching work between hosts that have - no meta-connection. +masklength is better known as prefixlength. -2001-06-06 21:11 Guus Sliepen +------------------------------------------------------------------------ +r977 | guus | 2002-04-08 15:27:09 +0200 (Mon, 08 Apr 2002) | 2 lines - * src/subnet.c: Log and warn about duplicate subnet_add()'s for the - same subnet. +Automake forgets about depcomp, remind it. -2001-06-05 21:45 Guus Sliepen +------------------------------------------------------------------------ +r976 | guus | 2002-04-05 11:11:38 +0200 (Fri, 05 Apr 2002) | 2 lines - * src/net.c: Add missing? counting of total_socket_in. +Fix maskcheck() and maskcmp(). -2001-06-05 21:39 Guus Sliepen +------------------------------------------------------------------------ +r975 | guus | 2002-04-01 23:28:39 +0200 (Mon, 01 Apr 2002) | 2 lines - * src/: conf.c, conf.h, net.c: You can now put an option "Mode" in - tinc.conf, and choose from: - - - Mode = router (default, work like tinc has always worked) - - Mode = switch (work like a switch) - - Mode = hub (work like a hub, broadcasting everything) +check_rsa() is broken, I don't know why, just remove it for now. -2001-06-05 20:07 Guus Sliepen +------------------------------------------------------------------------ +r974 | guus | 2002-04-01 23:28:05 +0200 (Mon, 01 Apr 2002) | 2 lines - * src/subnet.c: Fix bug where lookup_subnet_ipv4() could go into an - infinite loop. +Don't check_network_activity() if select() is interrupted by a signal. -2001-06-05 18:31 Guus Sliepen +------------------------------------------------------------------------ +r973 | guus | 2002-03-27 20:43:50 +0100 (Wed, 27 Mar 2002) | 2 lines - * src/route.c: - - This oneliner removes the need for ifconfig tap? hw ether - fe:fd:0:0:0:0 +Make configure --help output look nicer. -2001-06-05 18:15 Guus Sliepen +------------------------------------------------------------------------ +r972 | guus | 2002-03-27 17:26:26 +0100 (Wed, 27 Mar 2002) | 2 lines - * po/nl.po: Updated dutch translation. +Update with information about the pre6 release. -2001-06-05 18:13 Guus Sliepen +------------------------------------------------------------------------ +r971 | guus | 2002-03-27 17:00:49 +0100 (Wed, 27 Mar 2002) | 2 lines - * Makefile.am, configure.in: Changed some stuff to allow correct - generation of po/Makefile after a make cvs-clean. +Update dutch translation. -2001-06-05 18:09 Guus Sliepen +------------------------------------------------------------------------ +r970 | guus | 2002-03-27 17:00:38 +0100 (Wed, 27 Mar 2002) | 2 lines - * src/: connection.c, net.c, net.h, protocol.c, route.c, subnet.c, - tincd.c: - - tinc can now act as a switch or a hub too (as opposed to a router - only) - - cleaner initialisation of "UNKNOWN" and "MYSELF" names +Fix format strings. -2001-06-04 13:14 Guus Sliepen +------------------------------------------------------------------------ +r969 | guus | 2002-03-27 16:47:06 +0100 (Wed, 27 Mar 2002) | 2 lines - * src/route.c: Added proxy-arp support. No more ifconfig -arp - needed. Works like a charm under FreeBSD now :). +Remove symlink to device.c when doing a make dist. -2001-06-01 10:02 Guus Sliepen +------------------------------------------------------------------------ +r968 | guus | 2002-03-27 16:35:07 +0100 (Wed, 27 Mar 2002) | 2 lines - * src/subnet.c: Fix subnet_lookup() for overlapping subnets. Needs - rethinking. +Recent automake uses $(AMTAR) instead of $(TAR) -2001-05-28 10:56 Guus Sliepen +------------------------------------------------------------------------ +r967 | guus | 2002-03-27 16:26:44 +0100 (Wed, 27 Mar 2002) | 2 lines - * src/: net.c, tincd.c: Make sure Solaris is happy too. +Remove cruft. -2001-05-28 10:21 Guus Sliepen +------------------------------------------------------------------------ +r966 | guus | 2002-03-27 16:26:29 +0100 (Wed, 27 Mar 2002) | 2 lines - * src/: net.c, route.c: Small fixes to allow correct compilation - under FreeBSD (tested with 4.3) +Small updates. -2001-05-26 11:35 Ivo Timmermans +------------------------------------------------------------------------ +r965 | guus | 2002-03-27 16:01:37 +0100 (Wed, 27 Mar 2002) | 2 lines - * Makefile.am: Don't distribute autogen.sh in a release +Limit the amount of packets in a queue to 8. -2001-05-26 11:35 Ivo Timmermans +------------------------------------------------------------------------ +r964 | guus | 2002-03-27 16:01:16 +0100 (Wed, 27 Mar 2002) | 2 lines - * configure.in: Changed version number to 1.0-cvs +Extend list_t with the number of elements in the list. -2001-05-26 11:34 Ivo Timmermans +------------------------------------------------------------------------ +r963 | guus | 2002-03-27 15:02:36 +0100 (Wed, 27 Mar 2002) | 2 lines - * Makefile.am: New make target: `make release' +Merge do_prune() with build_fdset(). Probably fixes the invalid filedescriptor error. -2001-05-25 20:57 Guus Sliepen +------------------------------------------------------------------------ +r962 | guus | 2002-03-26 14:19:56 +0100 (Tue, 26 Mar 2002) | 2 lines - * doc/: SECURITY, sample-config/tinc-down, sample-config/tinc-up, - sample-config/hosts/alpha, sample-config/hosts/alpha.key, - sample-config/hosts/beta, sample-config/hosts/beta.key: Fix sample - configuration to show keys in PEM format and correct tapdevice. +Small correction. -2001-05-25 15:24 Guus Sliepen +------------------------------------------------------------------------ +r961 | guus | 2002-03-26 13:00:38 +0100 (Tue, 26 Mar 2002) | 2 lines - * TODO: Documents are merged. Now we only need to check the ports - and the TCPonly and IndirectData options. +Fix execute_script(). -2001-05-25 14:45 Guus Sliepen +------------------------------------------------------------------------ +r960 | guus | 2002-03-25 16:51:58 +0100 (Mon, 25 Mar 2002) | 2 lines - * doc/tinc.texi: Merged PROTOCOL, NETWORK and SECURITY2 with the - texinfo manual. +Send REQ_KEY only once until ANS_KEY has arrived. -2001-05-25 13:54 Guus Sliepen +------------------------------------------------------------------------ +r959 | guus | 2002-03-25 16:12:09 +0100 (Mon, 25 Mar 2002) | 2 lines - * src/: connection.h, meta.c, net.c, net.h, protocol.c, route.c: - TCPonly now works (in a relatively clean way too). +Tell a little bit more about security. -2001-05-25 12:08 Guus Sliepen +------------------------------------------------------------------------ +r958 | guus | 2002-03-25 16:01:32 +0100 (Mon, 25 Mar 2002) | 2 lines - * src/net.c: With recent kernels the tun device file is located in - /dev/net. +Updated documentation. -2001-05-25 12:06 Guus Sliepen +------------------------------------------------------------------------ +r957 | guus | 2002-03-25 14:54:49 +0100 (Mon, 25 Mar 2002) | 2 lines - * doc/: tinc.conf.5, tinc.texi, tincd.8: Small corrections to the - manuals. +Set myself->status.reachable. -2001-05-25 10:36 Guus Sliepen +------------------------------------------------------------------------ +r956 | guus | 2002-03-24 18:14:01 +0100 (Sun, 24 Mar 2002) | 2 lines - * src/: meta.c, net.c, protocol.c: Small fixes: - - - Fix compiler warnings (one was a real (but harmless) bug) - - Don't send PING packets if there is UDP traffic - - Correctly terminate strings containing salt for PING/PONG packets +Configuration variables were still handled case sensitively. -2001-05-24 23:52 Guus Sliepen +------------------------------------------------------------------------ +r955 | guus | 2002-03-24 18:08:38 +0100 (Sun, 24 Mar 2002) | 2 lines - * src/protocol.c: Only send key_changed if it was previously - requested. +OpenBSD tun device uses address family number instead of Ethernet type. -2001-05-24 23:32 Guus Sliepen +------------------------------------------------------------------------ +r954 | guus | 2002-03-24 17:50:58 +0100 (Sun, 24 Mar 2002) | 2 lines - * TODO: All features for 1.0 are implemented now, we just have to - check the FreeBSD and Solaris ports and merge some docs. +Respect type field. -2001-05-24 23:30 Guus Sliepen +------------------------------------------------------------------------ +r953 | guus | 2002-03-24 17:40:14 +0100 (Sun, 24 Mar 2002) | 2 lines - * src/protocol.h: Since this is incompatible with some earlier - versions, PROT_CURRENT is increased. +Updated dutch translation. -2001-05-24 23:29 Guus Sliepen +------------------------------------------------------------------------ +r952 | guus | 2002-03-24 17:36:56 +0100 (Sun, 24 Mar 2002) | 2 lines - * src/protocol.c: Add randomness to PING/PONG packets to prevent - crypto attacks on quiet tunnels. +Set $INTERFACE correctly when using ethertap while compiled with tun/tap support. -2001-05-24 22:40 Guus Sliepen +------------------------------------------------------------------------ +r951 | guus | 2002-03-24 17:28:27 +0100 (Sun, 24 Mar 2002) | 3 lines - * doc/tinc.conf.5: Changed URL from kernelnotes.org to - linuxdoc.org. +Execute hosts/name-up when a node becomes reachable, and hosts/name-down +when it becomes unreachable. -2001-05-24 22:24 Guus Sliepen +------------------------------------------------------------------------ +r950 | guus | 2002-03-24 17:22:59 +0100 (Sun, 24 Mar 2002) | 2 lines - * doc/tinc.texi: More revisions to the documentation: - - - Removed cruft - - Reordered some sections to make it more logical for the beginner - - Added small examples and hints about configuration files +Don't try to execute scripts unless they exist. -2001-05-19 17:50 Guus Sliepen +------------------------------------------------------------------------ +r949 | guus | 2002-03-23 21:21:10 +0100 (Sat, 23 Mar 2002) | 2 lines - * doc/tinc.texi: - - Make sure correct information is supplied for both old kernels - (with ethertap) and for new kernels (with TUN/TAP driver). - - Revised example configuration and made it conform to latest (CVS) - version of tinc. +Reset retry timeout when receiving the first PONG, not right after receiving the ACK. -2001-05-07 21:08 Guus Sliepen +------------------------------------------------------------------------ +r948 | guus | 2002-03-23 21:13:56 +0100 (Sat, 23 Mar 2002) | 2 lines - * ABOUT-NLS, src/net.c, src/net.h, src/netutl.c, src/protocol.c: - - s/ip_t/ipv4_t/g - - Add "salt" to the beginning of UDP packets. Replaces length field - which is not useful anyway. +Don't run graph algorithms if no edge is deleted in terminate_connection(). -2001-05-04 20:45 Guus Sliepen +------------------------------------------------------------------------ +r947 | guus | 2002-03-23 21:12:29 +0100 (Sat, 23 Mar 2002) | 2 lines - * TODO, src/net.c: Correctly cycle through ConnectTo variables. +free() request strings when deleting past requests from the tree. -2001-03-13 22:33 Guus Sliepen +------------------------------------------------------------------------ +r946 | guus | 2002-03-23 21:01:05 +0100 (Sat, 23 Mar 2002) | 2 lines - * src/protocol.c: Check indirectdata option before forwarding - certain requests. +send_ack() was broken. -2001-03-13 22:32 Guus Sliepen +------------------------------------------------------------------------ +r945 | guus | 2002-03-22 14:31:18 +0100 (Fri, 22 Mar 2002) | 2 lines - * src/net.c: Ignore alarm signals if we do not need to respond to - them. +Fix compiler warnings, strictly use long int and %lx for options. -2001-03-13 10:55 Guus Sliepen +------------------------------------------------------------------------ +r944 | guus | 2002-03-22 13:41:54 +0100 (Fri, 22 Mar 2002) | 2 lines - * src/process.c: Fixed bug in setup_signals() that would make tinc - die when unexpected signals were caught. +Fix add_edge_h(). -2001-03-13 00:58 Guus Sliepen +------------------------------------------------------------------------ +r943 | guus | 2002-03-22 12:43:48 +0100 (Fri, 22 Mar 2002) | 4 lines - * src/meta.c: Fixed a race condition triggered by receive_meta() - and the new authentication scheme. +- Added support for jumbograms. +- Remove tcpaddress from edges, it is not used at all. +- Last bits of code to prevent looping requests. -2001-03-04 15:00 Guus Sliepen +------------------------------------------------------------------------ +r942 | guus | 2002-03-22 00:11:53 +0100 (Fri, 22 Mar 2002) | 2 lines - * doc/NETWORKING: file NETWORKING was initially added on branch - CABAL. +Put a break on requests that run around in circles. -2001-03-04 15:00 Guus Sliepen +------------------------------------------------------------------------ +r941 | guus | 2002-03-19 23:48:25 +0100 (Tue, 19 Mar 2002) | 3 lines - * doc/NETWORKING: Added a description of what is going on in net.c - and route.c, and how packets flow through tinc. +Updated SSSP algorithm to automatically detect indirect links (if a node uses +different addresses for connections to other nodes). -2001-03-04 14:59 Guus Sliepen +------------------------------------------------------------------------ +r940 | guus | 2002-03-19 01:08:34 +0100 (Tue, 19 Mar 2002) | 2 lines - * po/: POTFILES.in, es.po, nl.po: Updated translation. +Updated dutch translation. -2001-03-04 14:59 Guus Sliepen +------------------------------------------------------------------------ +r939 | guus | 2002-03-19 01:08:23 +0100 (Tue, 19 Mar 2002) | 2 lines - * src/: Makefile.am, connection.c, connection.h, net.c, net.h, - protocol.c, route.c, route.h: - - route.c is now used to determine destination - - flags are removed, since they were not used at all. Use options - instead. - - indirectdata works now, tcponly almost... - - made functions that don't return useful information void +Don't use s6_addr[16|32] anymore. -2001-03-02 12:25 Guus Sliepen +------------------------------------------------------------------------ +r938 | guus | 2002-03-19 01:07:09 +0100 (Tue, 19 Mar 2002) | 2 lines - * src/protocol.c: Added explaination of our key exchange using RSA - encryption. +Cleanup. -2001-03-01 22:32 Guus Sliepen +------------------------------------------------------------------------ +r937 | guus | 2002-03-18 23:47:20 +0100 (Mon, 18 Mar 2002) | 3 lines - * src/: net.c, process.c, process.h, tincd.c: Various small fixes. +Remember sockaddrs of listening sockets, use appropriate one when sending +UDP packets. -2001-02-27 17:50 Guus Sliepen +------------------------------------------------------------------------ +r936 | guus | 2002-03-18 15:39:37 +0100 (Mon, 18 Mar 2002) | 2 lines - * lib/avl_tree.c: Removed compiler warning. +Fix #define s6_addr32. -2001-02-27 17:37 Guus Sliepen +------------------------------------------------------------------------ +r935 | guus | 2002-03-18 15:19:02 +0100 (Mon, 18 Mar 2002) | 2 lines - * src/: conf.h, net.c, net.h, protocol.c, tincd.c: Removed lots of - compiler warnings. +#define s6_addr32, needed for FreeBSD. -2001-02-27 17:17 Guus Sliepen +------------------------------------------------------------------------ +r934 | guus | 2002-03-17 17:08:39 +0100 (Sun, 17 Mar 2002) | 2 lines - * src/net.c: - - Fixed Interface option (untested) - - Removed error handling for non-critical socket options - - Added TCP_NODELAY and IPTOS_LOWDELAY options for meta sockets. +Only unmap IPv6 addresses. -2001-02-27 17:15 Ivo Timmermans +------------------------------------------------------------------------ +r933 | guus | 2002-03-17 16:59:29 +0100 (Sun, 17 Mar 2002) | 2 lines - * TODO: Authentication done +Unmap v4mapped sockaddrs. -2001-02-27 16:33 Guus Sliepen +------------------------------------------------------------------------ +r932 | guus | 2002-03-15 16:50:14 +0100 (Fri, 15 Mar 2002) | 2 lines - * src/net.c: Don't forget to reconnect if outgoing connection fails - during authentication. +Typo. -2001-02-26 12:37 Guus Sliepen +------------------------------------------------------------------------ +r931 | guus | 2002-03-15 16:40:40 +0100 (Fri, 15 Mar 2002) | 2 lines - * src/protocol.c: - - Make sure METAKEY is smaller than the modulus of the RSA key - - Get symmetric key from the least significant bytes of the RSA - message +Different way of detecting neighbor solicitation requests. -2001-02-25 21:17 Guus Sliepen +------------------------------------------------------------------------ +r930 | guus | 2002-03-15 16:08:21 +0100 (Fri, 15 Mar 2002) | 2 lines - * po/: POTFILES.in, es.po, nl.po: Added process.c to the translated - files. +Oops, don't forget to actually put the checksum in the response packet. -2001-02-25 20:09 Guus Sliepen +------------------------------------------------------------------------ +r929 | guus | 2002-03-15 15:41:57 +0100 (Fri, 15 Mar 2002) | 2 lines - * src/: net.c, protocol.c, protocol.h: Implemented new - authentication scheme from doc/SECURITY2. +Neighbor solicitation requests now work (I think). -2001-02-25 17:34 Guus Sliepen +------------------------------------------------------------------------ +r928 | guus | 2002-03-12 17:30:15 +0100 (Tue, 12 Mar 2002) | 2 lines - * src/: net.c, protocol.c: Encrypt network packets in CBC mode - instead of CFB mode. (This breaks compatibility with all previous - versions!) +Revert changes to Kruskal's algo. -2001-02-25 17:04 Guus Sliepen +------------------------------------------------------------------------ +r927 | guus | 2002-03-12 15:25:04 +0100 (Tue, 12 Mar 2002) | 2 lines - * src/net.c: Copy packets before putting them in the queue. +Put #ifdef NEIGHBORSOL around corresponding code. -2001-02-25 16:34 Guus Sliepen +------------------------------------------------------------------------ +r926 | guus | 2002-03-12 15:20:44 +0100 (Tue, 12 Mar 2002) | 2 lines - * lib/list.c: Free node->data and node, not node->data twice. +Remove silly cache thingy. -2001-02-25 15:51 Guus Sliepen +------------------------------------------------------------------------ +r925 | guus | 2002-03-12 15:19:51 +0100 (Tue, 12 Mar 2002) | 2 lines - * po/es.po, po/nl.po, src/tincd.c: Add missing \n. +Packet sequence number/authentication warnings only if debug_lvl >= 5. -2001-02-25 12:09 Guus Sliepen +------------------------------------------------------------------------ +r924 | guus | 2002-03-12 14:42:23 +0100 (Tue, 12 Mar 2002) | 2 lines - * src/: meta.c, protocol.c: Corrected check for errors after read() - calls. +Simplified implementation of Kruskal's minimum spanning tree algorithm. -2001-02-20 22:53 Wessel Dankers +------------------------------------------------------------------------ +r923 | guus | 2002-03-11 14:56:00 +0100 (Mon, 11 Mar 2002) | 2 lines - * lib/avl_tree.c: Important bugfix in avl_insert_before() and - avl_insert_after() +New strategy: forward icmp6 neighbor solicitations to intended target. -2001-02-18 03:13 Ivo Timmermans +------------------------------------------------------------------------ +r922 | guus | 2002-03-11 14:14:53 +0100 (Mon, 11 Mar 2002) | 2 lines - * m4/tuntap.m4: tinc_TUNTAP now substitutes the values outside the - AC_CACHE_CHECK block. configure should now correctly set - HAVE_TUNTAP. +Try to reply to neighbor solicitation requests. -2001-02-13 10:54 Guus Sliepen +------------------------------------------------------------------------ +r921 | guus | 2002-03-11 12:45:12 +0100 (Mon, 11 Mar 2002) | 2 lines - * doc/SECURITY2: Added description of the proposed new - authentication scheme. +prune_connections() before build_fdset(). -2001-02-13 10:54 Guus Sliepen +------------------------------------------------------------------------ +r920 | guus | 2002-03-11 12:23:04 +0100 (Mon, 11 Mar 2002) | 3 lines - * doc/SECURITY2: file SECURITY2 was initially added on branch - CABAL. +Cleanups, spelling fixes, allow symbol names for signals (-k option), +don't remove pidfile if other tincd is still running. -2001-02-11 12:55 Ivo Timmermans +------------------------------------------------------------------------ +r919 | guus | 2002-03-10 17:09:15 +0100 (Sun, 10 Mar 2002) | 2 lines - * doc/es/.cvsignore, lib/.cvsignore, redhat/.cvsignore: file - .cvsignore was initially added on branch CABAL. +Don't retry to make outgoing connections when exitting. -2001-02-11 12:55 Ivo Timmermans +------------------------------------------------------------------------ +r918 | guus | 2002-03-10 16:40:27 +0100 (Sun, 10 Mar 2002) | 2 lines - * .cvsignore, doc/.cvsignore, doc/es/.cvsignore, lib/.cvsignore, - redhat/.cvsignore, src/.cvsignore: More files to ignore in CVS +Small fixes to improve portability. -2001-02-11 12:50 Guus Sliepen +------------------------------------------------------------------------ +r917 | guus | 2002-03-10 15:07:08 +0100 (Sun, 10 Mar 2002) | 2 lines - * Makefile.am, autogen.sh, lib/Makefile.am, src/Makefile.am: - - Updated CVS_CREATED to remove intl/ directory and some other - autogenerated files. - - Checked if all INCLUDES/LIBS/etc directives inherit the global - variables. +Autodetect $MAKE/gmake/make. -2001-02-11 12:46 Guus Sliepen +------------------------------------------------------------------------ +r916 | guus | 2002-03-10 15:05:35 +0100 (Sun, 10 Mar 2002) | 2 lines - * src/.cvsignore: Ignore file for src/ +po/POTFILES and po/Makefile should not be generated by configure. -2001-02-11 12:44 Guus Sliepen +------------------------------------------------------------------------ +r915 | guus | 2002-03-10 15:04:48 +0100 (Sun, 10 Mar 2002) | 2 lines - * .cvsignore, doc/.cvsignore, m4/.cvsignore, po/.cvsignore: Added - .cvsignore files to get rid of warnings and prevent autogenerated - files from being added accidentaly. +Fix forwarding of IPv6 packets. -2001-02-11 12:44 Guus Sliepen +------------------------------------------------------------------------ +r914 | guus | 2002-03-01 16:14:29 +0100 (Fri, 01 Mar 2002) | 2 lines - * .cvsignore, doc/.cvsignore, m4/.cvsignore, po/.cvsignore, - src/.cvsignore: file .cvsignore was initially added on branch - CABAL. +Check if BindToDevice and PriorityInheritance are supported. -2001-02-06 11:42 Guus Sliepen +------------------------------------------------------------------------ +r913 | guus | 2002-03-01 15:33:48 +0100 (Fri, 01 Mar 2002) | 2 lines - * src/protocol.c: Removed another local definition of the variable - "errno" +Woops. -2001-02-06 11:13 Guus Sliepen +------------------------------------------------------------------------ +r912 | guus | 2002-03-01 15:25:10 +0100 (Fri, 01 Mar 2002) | 2 lines - * po/: es.po, nl.po: Updated dutch translation. +Document and clean up MAC address expiry. -2001-02-06 11:13 Guus Sliepen +------------------------------------------------------------------------ +r911 | guus | 2002-03-01 15:09:31 +0100 (Fri, 01 Mar 2002) | 4 lines - * lib/: avl_tree.c, avl_tree.h: Fix memory leak in avl_insert() if - item was already inserted. +- Global time_t now, so that we don't have to call time() too often. +- MAC addresses expire after a time configurable by MACExpire (default 600 + seconds) -2001-02-06 11:12 Guus Sliepen +------------------------------------------------------------------------ +r910 | guus | 2002-03-01 14:38:15 +0100 (Fri, 01 Mar 2002) | 2 lines - * lib/dropin.c, src/protocol.c: FreeBSD compile fixes (thanks to - XeF4) +Updated dutch translation. -2001-01-18 14:01 Ivo Timmermans +------------------------------------------------------------------------ +r909 | guus | 2002-03-01 14:38:02 +0100 (Fri, 01 Mar 2002) | 2 lines - * doc/: Makefile.am, Makefile.maint: Distribute the sample config - as a .tar.gz +Updated documentation. -2001-01-18 14:00 Ivo Timmermans +------------------------------------------------------------------------ +r908 | guus | 2002-03-01 14:18:54 +0100 (Fri, 01 Mar 2002) | 2 lines - * doc/tinc.texi: Fixed some errors +Create/bind TCP and UDP listening sockets in pairs. -2001-01-17 02:48 Ivo Timmermans +------------------------------------------------------------------------ +r907 | guus | 2002-03-01 13:26:56 +0100 (Fri, 01 Mar 2002) | 4 lines - * po/: es.po, nl.po: Get the PO files up to date with the current - source +If "PriorityInheritance = yes" is specified in tinc.conf, the value of the +TOS field of the tunneled packets will be passed on to the UDP packets tinc +sends out. -2001-01-17 02:40 Ivo Timmermans +------------------------------------------------------------------------ +r906 | guus | 2002-03-01 13:25:58 +0100 (Fri, 01 Mar 2002) | 2 lines - * doc/tinc.texi: Merged documentation with various updates I had - lying around +Fix listening sockets. -2001-01-17 02:34 Ivo Timmermans +------------------------------------------------------------------------ +r905 | guus | 2002-03-01 12:18:34 +0100 (Fri, 01 Mar 2002) | 2 lines - * NEWS: Second draft of the release notes +Make BindToInterface work. -2001-01-17 02:31 Ivo Timmermans +------------------------------------------------------------------------ +r904 | guus | 2002-02-27 23:37:55 +0100 (Wed, 27 Feb 2002) | 2 lines - * configure.in: Change version to 1.0pre4 +Fix send_request() bug. -2001-01-17 02:30 Ivo Timmermans +------------------------------------------------------------------------ +r903 | guus | 2002-02-27 00:26:41 +0100 (Wed, 27 Feb 2002) | 2 lines - * src/conf.c: Fix error reporting of read_config +Allow multiple listening sockets. -2001-01-13 17:36 Guus Sliepen +------------------------------------------------------------------------ +r902 | guus | 2002-02-26 23:47:51 +0100 (Tue, 26 Feb 2002) | 2 lines - * src/: conf.c, conf.h, net.c, tincd.c: - - Allow ASN1 style keys to be in the config files. - Note: tinc ignores private key in the main config file, tinc.conf, - because it should really be in a separate file. - - When generating new keys, check if name is known and by default - append the public key to the host configuration file (otherwise - rsa_key.pub). +Tweaking IPv6 support. -2001-01-13 15:38 Guus Sliepen +------------------------------------------------------------------------ +r901 | guus | 2002-02-20 23:37:38 +0100 (Wed, 20 Feb 2002) | 3 lines - * doc/sample-config/hosts/alpha: file alpha was initially added on - branch CABAL. +- Change SA_LEN to SALEN, former one is already defined on some platforms. +- Use SALEN everywhere appropriate. -2001-01-13 15:38 Guus Sliepen +------------------------------------------------------------------------ +r900 | guus | 2002-02-20 23:15:32 +0100 (Wed, 20 Feb 2002) | 4 lines - * doc/sample-config/hosts/alpha.key: file alpha.key was initially - added on branch CABAL. +- Use gai_strerror() where appropriate +- Clear hints before using them with getaddrinfo() +- Use sa_len on platforms that support them -2001-01-13 15:38 Guus Sliepen +------------------------------------------------------------------------ +r899 | guus | 2002-02-20 20:31:15 +0100 (Wed, 20 Feb 2002) | 2 lines - * doc/sample-config/hosts/beta: file beta was initially added on - branch CABAL. +Preserve inpkt->len, needed for broadcasts. -2001-01-13 15:38 Guus Sliepen +------------------------------------------------------------------------ +r898 | guus | 2002-02-20 20:25:09 +0100 (Wed, 20 Feb 2002) | 3 lines - * doc/sample-config/hosts/beta.key: file beta.key was initially - added on branch CABAL. +Protocol now also exchanges cipher/digest/maclength/compression for the +meta connection. -2001-01-13 15:38 Guus Sliepen +------------------------------------------------------------------------ +r897 | guus | 2002-02-20 18:16:15 +0100 (Wed, 20 Feb 2002) | 2 lines - * doc/sample-config/tinc-down: file tinc-down was initially added - on branch CABAL. +Cache results of lookup_subnet_...(). -2001-01-13 15:38 Guus Sliepen +------------------------------------------------------------------------ +r896 | guus | 2002-02-20 18:15:33 +0100 (Wed, 20 Feb 2002) | 2 lines - * doc/sample-config/tinc.conf: file tinc.conf was initially added - on branch CABAL. +Fix maskcmp() and maskcpy(). -2001-01-13 15:38 Guus Sliepen +------------------------------------------------------------------------ +r895 | guus | 2002-02-20 17:04:59 +0100 (Wed, 20 Feb 2002) | 2 lines - * doc/sample-config/rsa_key.priv: file rsa_key.priv was initially - added on branch CABAL. +Forward packets in router mode. -2001-01-13 15:38 Guus Sliepen +------------------------------------------------------------------------ +r894 | guus | 2002-02-20 17:04:39 +0100 (Wed, 20 Feb 2002) | 2 lines - * doc/sample-config/tinc-up: file tinc-up was initially added on - branch CABAL. +Use AF_UNSPEC for listening sockets if AddressFamily = any. -2001-01-13 15:38 Guus Sliepen +------------------------------------------------------------------------ +r893 | guus | 2002-02-20 17:04:07 +0100 (Wed, 20 Feb 2002) | 2 lines - * doc/: tinc.conf.sample, sample-config/rsa_key.priv, - sample-config/tinc-down, sample-config/tinc-up, - sample-config/tinc.conf, sample-config/hosts/alpha, - sample-config/hosts/alpha.key, sample-config/hosts/beta, - sample-config/hosts/beta.key: Added sample configuration directory. +Fix segfault when receiving HUP signal. -2001-01-11 12:19 Guus Sliepen +------------------------------------------------------------------------ +r892 | guus | 2002-02-18 17:25:19 +0100 (Mon, 18 Feb 2002) | 8 lines - * src/net.c: - - Only send out DEL_HOSTs for hosts with a meta connection +- Non-blocking connect()s. +- Socket handling revamped to use sockaddr_t. +- tinc can now tunnel over IPv6. +- Handle all addresses and subnets in network byte order. + Only convert them when they need to be printed. +- IPv6 subnets bigger than /128 now work. +- Use %s and strerror(errno) instead of %m. -2001-01-08 22:32 Guus Sliepen +------------------------------------------------------------------------ +r888 | guus | 2002-02-12 15:42:37 +0100 (Tue, 12 Feb 2002) | 2 lines - * src/subnet.h: - - Cleaned up subnet_t +Add check for NetBSD. -2001-01-08 22:32 Guus Sliepen +------------------------------------------------------------------------ +r887 | guus | 2002-02-12 15:40:12 +0100 (Tue, 12 Feb 2002) | 2 lines - * lib/avl_tree.c: - - Sign was wrong in search_closest_smaller/greater +Added device.c for NetBSD, actually a copy of the OpenBSD one. -2001-01-08 21:35 Guus Sliepen +------------------------------------------------------------------------ +r886 | guus | 2002-02-12 15:36:45 +0100 (Tue, 12 Feb 2002) | 2 lines - * src/protocol.c: - - Squashed another nasty bug. +Get rid of sys/signal.h. -2001-01-07 21:19 Guus Sliepen +------------------------------------------------------------------------ +r884 | guus | 2002-02-12 15:29:00 +0100 (Tue, 12 Feb 2002) | 2 lines - * src/: connection.h, net.c, net.h, protocol.c, protocol.h: - - Added indirectdata and tcponly functionality. +Don't use sa_sigaction (which NetBSD doesn't like) at all if we don't use siginfo. -2001-01-07 21:19 Guus Sliepen +------------------------------------------------------------------------ +r883 | guus | 2002-02-11 16:59:18 +0100 (Mon, 11 Feb 2002) | 4 lines - * src/subnet.c: - - Fixed IPv6 subnet lookup routine. +Added support for packet compression, thanks to Mark Glines. +Add "Compression = " to the host config files, where level can be +0 (off), or any integer between 1 (fast) and 9 (best). -2001-01-07 18:08 Guus Sliepen +------------------------------------------------------------------------ +r881 | guus | 2002-02-11 15:20:46 +0100 (Mon, 11 Feb 2002) | 2 lines - * README, THANKS, TODO, doc/tinc.texi, lib/avl_tree.c, - lib/avl_tree.h, lib/dropin.c, lib/dropin.h, lib/list.c, lib/list.h, - lib/utils.c, lib/utils.h, po/es.po, po/nl.po, src/conf.c, - src/conf.h, src/connection.c, src/connection.h, src/meta.c, - src/meta.h, src/net.c, src/net.h, src/netutl.c, src/netutl.h, - src/process.c, src/process.h, src/protocol.c, src/protocol.h, - src/route.c, src/route.h, src/subnet.c, src/subnet.h, src/tincd.c: - - It's 2001, all copyright notices are updated. +Small fix. -2001-01-07 18:08 Guus Sliepen +------------------------------------------------------------------------ +r880 | guus | 2002-02-11 15:20:21 +0100 (Mon, 11 Feb 2002) | 3 lines - * doc/: PROTOCOL, SECURITY: - - Description of protocol and authentication updated. +- If no PrivateKeyFile is specified, /etc/tinc/netname/rsa_key.priv is assumed. +- Check RSA key before using it. -2001-01-07 16:27 Guus Sliepen +------------------------------------------------------------------------ +r879 | guus | 2002-02-11 13:33:01 +0100 (Mon, 11 Feb 2002) | 2 lines - * src/route.h: file route.h was initially added on branch CABAL. +Sensible defaults for $INTERFACE. -2001-01-07 16:27 Guus Sliepen +------------------------------------------------------------------------ +r878 | guus | 2002-02-11 11:16:18 +0100 (Mon, 11 Feb 2002) | 2 lines - * src/route.h: - - Added header file for route.c. The routing routines in it are not - used yet, but have a look at the source for the ideas behind it. +Last bits of the merger. -2001-01-07 16:25 Guus Sliepen +------------------------------------------------------------------------ +r877 | guus | 2002-02-11 11:05:58 +0100 (Mon, 11 Feb 2002) | 2 lines - * src/: connection.c, connection.h, net.c, net.h, netutl.c, - process.c, process.h, protocol.c, route.c: - - Reinstated a queue for outgoing packets. +Forgot to merge new files from pre5. -2001-01-07 16:24 Guus Sliepen +------------------------------------------------------------------------ +r876 | guus | 2002-02-10 22:57:54 +0100 (Sun, 10 Feb 2002) | 2 lines - * lib/: list.c, list.h: - - Changed list routines to give it the same look'n'feel as the rbl - and avl tree library. +Merging of the entire pre5 branch. -2001-01-06 21:43 Guus Sliepen +------------------------------------------------------------------------ +r784 | zarq | 2001-11-16 23:41:38 +0100 (Fri, 16 Nov 2001) | 2 lines - * doc/tinc.conf.5: - - Typo. +Conversion to struct addrinfo is almost complete for this file. -2001-01-06 21:02 Guus Sliepen +------------------------------------------------------------------------ +r783 | zarq | 2001-11-16 23:40:26 +0100 (Fri, 16 Nov 2001) | 2 lines - * doc/tinc.texi: - - Updated texinfo manual. +Don't include netutl.h. -2001-01-06 19:44 Guus Sliepen +------------------------------------------------------------------------ +r782 | zarq | 2001-11-16 23:31:41 +0100 (Fri, 16 Nov 2001) | 2 lines - * doc/: tinc.conf.5, tincd.8: - - Updated manual pages. +Fixed silly typo: "np" instead of "no" -2001-01-06 19:21 Guus Sliepen +------------------------------------------------------------------------ +r781 | zarq | 2001-11-16 23:31:15 +0100 (Fri, 16 Nov 2001) | 2 lines - * lib/: avl_tree.c, avl_tree.h: - - Changed license of AVL tree library to GPL. +get_config_subnet needs to be fixed. -2001-01-06 19:03 Guus Sliepen +------------------------------------------------------------------------ +r780 | zarq | 2001-11-16 18:40:50 +0100 (Fri, 16 Nov 2001) | 2 lines - * src/: conf.c, protocol.c, tincd.c: - - Check and follow symlinks in is_safe_path - - By default write keys to tinc config directory - - Small fix in protocol.c +route_ipv4 and route_ipv6 replaced by route_ip. -2001-01-06 17:51 Guus Sliepen +------------------------------------------------------------------------ +r779 | zarq | 2001-11-16 18:39:59 +0100 (Fri, 16 Nov 2001) | 2 lines - * po/: es.po, nl.po: - - Updated dutch translation. +Don't include netutl.h. -2001-01-06 00:53 Guus Sliepen +------------------------------------------------------------------------ +r778 | zarq | 2001-11-16 18:39:38 +0100 (Fri, 16 Nov 2001) | 2 lines - * src/: conf.c, conf.h, connection.c, connection.h, meta.c, net.c, - process.c, protocol.c, route.c, subnet.c, subnet.h, tincd.c: - - Let user choose whether keys are in the config files or separate - - Use AVL trees instead of RBL trees - - Fixed a lot of annoying subtle bugs! Thanks to gdb... +lookup_node_udp changed. -2001-01-06 00:51 Guus Sliepen +------------------------------------------------------------------------ +r777 | zarq | 2001-11-16 18:38:39 +0100 (Fri, 16 Nov 2001) | 2 lines - * lib/: utils.c, utils.h: - - Doubled size of trace buffer for easier debugging. +First part of rewriting things to use struct addrinfo. -2001-01-06 00:50 Guus Sliepen +------------------------------------------------------------------------ +r776 | zarq | 2001-11-16 18:37:08 +0100 (Fri, 16 Nov 2001) | 2 lines - * lib/avl_tree.h: file avl_tree.h was initially added on branch - CABAL. +Added dropin replacements for get*info and helper functions. -2001-01-06 00:50 Guus Sliepen +------------------------------------------------------------------------ +r775 | zarq | 2001-11-16 17:16:33 +0100 (Fri, 16 Nov 2001) | 2 lines - * lib/avl_tree.c: file avl_tree.c was initially added on branch - CABAL. +Added HAVE_STRUCT_ADDRINFO -2001-01-06 00:50 Guus Sliepen +------------------------------------------------------------------------ +r774 | zarq | 2001-11-16 16:56:44 +0100 (Fri, 16 Nov 2001) | 2 lines - * lib/: Makefile.am, avl_tree.c, avl_tree.h: - - AVL tree routines: faster than RBL, and also more stable. +(re)added port to struct node_t -2000-12-22 22:34 Guus Sliepen +------------------------------------------------------------------------ +r773 | zarq | 2001-11-16 13:22:02 +0100 (Fri, 16 Nov 2001) | 2 lines - * acconfig.h, configure.in, m4/gnuscanf.m4, src/conf.c, src/conf.h, - src/net.c, src/net.h, src/protocol.c: - - Don't even think about using sscanf with %as anymore - - Allow keys to be inside the config files or in a seperate file - - Small fixes +Don't include netutl.h. -2000-12-22 18:15 Ivo Timmermans +------------------------------------------------------------------------ +r772 | zarq | 2001-11-16 13:21:22 +0100 (Fri, 16 Nov 2001) | 2 lines - * src/Makefile.am: Added lint target, requires lclint. +Obsoleted. -2000-12-22 18:10 Ivo Timmermans +------------------------------------------------------------------------ +r771 | zarq | 2001-11-16 13:16:28 +0100 (Fri, 16 Nov 2001) | 2 lines - * po/POTFILES.in: Forget router.c +Don't compile/link netutl.c. -2000-12-22 17:59 Ivo Timmermans +------------------------------------------------------------------------ +r770 | zarq | 2001-11-16 13:14:20 +0100 (Fri, 16 Nov 2001) | 2 lines - * Makefile.am: Include autogen.sh (needed for the Debian package). +get_config_{ip,port} removed. -2000-12-06 14:33 Ivo Timmermans +------------------------------------------------------------------------ +r769 | zarq | 2001-11-16 13:13:34 +0100 (Fri, 16 Nov 2001) | 2 lines - * src/: conf.c, conf.h: Re-introduced MyVirtualIP and VpnMask, as - dummy options. +Changed to use struct addrinfo where needed. -2000-12-05 09:59 Ivo Timmermans +------------------------------------------------------------------------ +r768 | zarq | 2001-11-16 13:10:54 +0100 (Fri, 16 Nov 2001) | 2 lines - * src/: net.c, protocol.c: Tiny bits of code beautifying +Obsoleted all IP types in favor of struct addrinfo -2000-12-05 09:56 Ivo Timmermans +------------------------------------------------------------------------ +r767 | zarq | 2001-11-16 13:08:38 +0100 (Fri, 16 Nov 2001) | 2 lines - * src/conf.c: Oops. I did some VERY wrong things with readline(). - Fixed now. +Removed definitions of ipv4_t, ipv6_t, port_t -2000-12-05 09:54 Ivo Timmermans +------------------------------------------------------------------------ +r766 | zarq | 2001-11-16 13:02:17 +0100 (Fri, 16 Nov 2001) | 2 lines - * doc/tinc.texi: Massive long awaited documentation update. It's - not finished yet, most notably the example configuration is still - old. +Changed lookup_connection to use struct addrinfo -2000-12-03 13:23 Ivo Timmermans +------------------------------------------------------------------------ +r765 | zarq | 2001-11-16 13:01:48 +0100 (Fri, 16 Nov 2001) | 2 lines - * src/tincd.c: Option -d accepts an argument to set the debug level - immediately. +Changed prototype for lookup_connection to use struct addrinfo -2000-12-03 13:22 Ivo Timmermans +------------------------------------------------------------------------ +r764 | zarq | 2001-11-16 01:23:28 +0100 (Fri, 16 Nov 2001) | 3 lines - * src/conf.c: Sort configuration directives +Use struct addrinfo in connection_t to hold all host data such as IP +address and port -2000-12-03 13:21 Ivo Timmermans +------------------------------------------------------------------------ +r763 | zarq | 2001-11-16 01:13:08 +0100 (Fri, 16 Nov 2001) | 2 lines - * TODO: Added documentation merger +Deprecated get_config_ip and get_config_port -2000-12-01 14:46 Ivo Timmermans +------------------------------------------------------------------------ +r762 | zarq | 2001-11-16 00:49:46 +0100 (Fri, 16 Nov 2001) | 2 lines - * Makefile.am: Include COPYING.README in the distribution. +Check for struct addrinfo -2000-12-01 14:45 Ivo Timmermans +------------------------------------------------------------------------ +r761 | zarq | 2001-11-16 00:28:58 +0100 (Fri, 16 Nov 2001) | 2 lines - * COPYING.README: Stated that distributing executables linked with - OpenSSL is permitted provided that all other requirements of the GPL - are complied with. +Credit OpenSSH -2000-12-01 14:45 Ivo Timmermans +------------------------------------------------------------------------ +r760 | zarq | 2001-11-16 00:26:27 +0100 (Fri, 16 Nov 2001) | 2 lines - * COPYING.README: file COPYING.README was initially added on branch - CABAL. +Check for getnameinfo, gai_strerror, freeaddrinfo -2000-12-01 13:38 Ivo Timmermans +------------------------------------------------------------------------ +r759 | zarq | 2001-11-16 00:05:34 +0100 (Fri, 16 Nov 2001) | 2 lines - * src/conf.c: Use buffer instead of line in read_config_file(), - line may be assigned NULL, so buffer always holds the pointer to the - allocated space. +Check for getaddrinfo -2000-12-01 13:36 Ivo Timmermans +------------------------------------------------------------------------ +r758 | guus | 2001-11-05 20:09:08 +0100 (Mon, 05 Nov 2001) | 2 lines - * src/conf.c: readline() accepts two extra parameters, buf and - buflen, to avoid mallocing and freeing for every line that is read. +More fixes for Solaris. -2000-12-01 00:44 Ivo Timmermans +------------------------------------------------------------------------ +r757 | guus | 2001-11-05 20:06:07 +0100 (Mon, 05 Nov 2001) | 2 lines - * TODO: Tagged `Storing private key in separate file' as done. +Various fixes needed for Solaris. -2000-12-01 00:39 Ivo Timmermans +------------------------------------------------------------------------ +r756 | guus | 2001-11-05 00:48:27 +0100 (Mon, 05 Nov 2001) | 2 lines - * doc/tinc.texi: All full stops have two spaces after them. (Silly - commit, I know.) +Correctly check if subnet owner exists. -2000-12-01 00:18 Ivo Timmermans +------------------------------------------------------------------------ +r755 | guus | 2001-11-05 00:29:50 +0100 (Mon, 05 Nov 2001) | 2 lines - * src/: net.c, net.h, protocol.c: New function - read_rsa_public_key(); In net.c/setup_myself deleted old code to - read the public key (which is now implicitly read in together with - the private key). +Be liberal in what you accept: allow unknown edges to be deleted. -2000-11-30 23:48 Ivo Timmermans +------------------------------------------------------------------------ +r754 | guus | 2001-11-03 23:53:02 +0100 (Sat, 03 Nov 2001) | 2 lines - * src/net.c: Avoid printing duplicate messages from read_rsa_keys +*** empty log message *** -2000-11-30 23:33 Ivo Timmermans +------------------------------------------------------------------------ +r753 | guus | 2001-11-03 22:22:02 +0100 (Sat, 03 Nov 2001) | 2 lines - * src/net.c: Better error checking when reading the RSA private - key. +Several bugfixes. -2000-11-30 23:32 Ivo Timmermans +------------------------------------------------------------------------ +r752 | guus | 2001-11-03 22:21:04 +0100 (Sat, 03 Nov 2001) | 2 lines - * src/conf.c: In readline(): initialise the line to zero length; In - read_config_file(): Test for EOF, and print the variable name that - caused an error. +Use PEM functions as suggested by OpenSSL docs. -2000-11-30 22:11 Ivo Timmermans +------------------------------------------------------------------------ +r751 | guus | 2001-10-31 21:37:54 +0100 (Wed, 31 Oct 2001) | 2 lines - * src/conf.c: The file is safe if it doesn't exist. +Some very small fixes -2000-11-30 21:08 Ivo Timmermans +------------------------------------------------------------------------ +r750 | guus | 2001-10-31 21:22:52 +0100 (Wed, 31 Oct 2001) | 2 lines - * src/net.c: Read the PEM file pointed to by the configuration - directive PrivateKey. This means thatt he meaning of this variable - has changed, it no longer should contain the private key directly. - - WARNING: This code is untested. +Avoid connecting to another node twice, and check name of outgoing connections. -2000-11-30 01:24 Ivo Timmermans +------------------------------------------------------------------------ +r749 | guus | 2001-10-31 21:07:17 +0100 (Wed, 31 Oct 2001) | 2 lines - * src/conf.c: Implemented is_safe_path, and extended - ask_and_safe_open. - - is_safe_path needs more work before it is useable. +Show cfg->variable instead of cfg->value when complaining about wrong type. -2000-11-29 16:22 Ivo Timmermans +------------------------------------------------------------------------ +r748 | guus | 2001-10-31 21:02:06 +0100 (Wed, 31 Oct 2001) | 2 lines - * po/nl.po: Updated Dutch translation +Don't forget to read public RSA key when making an outgoing connection. -2000-11-29 15:30 Ivo Timmermans +------------------------------------------------------------------------ +r747 | guus | 2001-10-31 13:50:24 +0100 (Wed, 31 Oct 2001) | 5 lines - * src/conf.c: Also free the pointer returned by readline(). +- Small fixes to graph algorithms +- More control over tap device, ability to set interface name to something + other than the netname. +- Export NETNAME, DEVICE and INTERFACE environment variables to scripts. -2000-11-29 15:27 Ivo Timmermans +------------------------------------------------------------------------ +r746 | guus | 2001-10-30 17:34:32 +0100 (Tue, 30 Oct 2001) | 2 lines - * src/conf.c: Use readline() in read_config_file() instead of - fgets. +More updates to protocol handlers and reimplemented terminate_connection(). -2000-11-29 15:24 Ivo Timmermans +------------------------------------------------------------------------ +r745 | guus | 2001-10-30 13:59:12 +0100 (Tue, 30 Oct 2001) | 2 lines - * src/: conf.c, conf.h, tincd.c: Implemented a readline() function - that will read an entire line into a dynamically allocated buffer; - - Ask for a file name in ask_and_safe_open(). +Various fixes, tinc is now somewhat capable of actually working again. -2000-11-29 15:23 Ivo Timmermans +------------------------------------------------------------------------ +r744 | guus | 2001-10-29 14:14:57 +0100 (Mon, 29 Oct 2001) | 2 lines - * lib/: xalloc.h, xmalloc.c: xstrdup now takes a const pointer as - an argument. +Working version of Kruskal's algorithm. The running time is very bad though. -2000-11-29 02:37 Ivo Timmermans +------------------------------------------------------------------------ +r742 | guus | 2001-10-28 23:42:49 +0100 (Sun, 28 Oct 2001) | 4 lines - * m4/gnuscanf.m4: file gnuscanf.m4 was initially added on branch - CABAL. +- More changes needed for Kruskal's algorithm +- Implemented a breadth-first search algorithm as a cheap substitution for a + single-source shortest path algorithm. -2000-11-29 02:37 Ivo Timmermans +------------------------------------------------------------------------ +r741 | guus | 2001-10-28 11:16:18 +0100 (Sun, 28 Oct 2001) | 3 lines - * acconfig.h, configure.in, system.h, m4/gnuscanf.m4: Added a check - for a scanf that knows about %as. +- More s/vertex/edge/g +- Implementation of Kruskal's minimum spanning tree algorithm. -2000-11-29 01:33 Ivo Timmermans +------------------------------------------------------------------------ +r739 | guus | 2001-10-28 09:41:19 +0100 (Sun, 28 Oct 2001) | 2 lines - * configure.in, lib/dropin.c, lib/dropin.h: Check for - get_current_dir_name. There is a replacement function in dropin.c. +What was I thinking? s/vertex/edge/g. -2000-11-29 00:23 Ivo Timmermans +------------------------------------------------------------------------ +r736 | guus | 2001-10-27 17:19:13 +0200 (Sat, 27 Oct 2001) | 2 lines - * lib/dropin.c: file dropin.c was initially added on branch CABAL. +Various small fixes to make tinc runnable again. -2000-11-29 00:23 Ivo Timmermans +------------------------------------------------------------------------ +r735 | guus | 2001-10-27 15:13:35 +0200 (Sat, 27 Oct 2001) | 2 lines - * lib/: Makefile.am, daemon.c, daemon.h, dropin.c, dropin.h: - dropin.c/h contain a set of drop-in replacements for non-standard C - library functions (read: GNU extensions). +Make sure everything links. -2000-11-29 00:23 Ivo Timmermans +------------------------------------------------------------------------ +r734 | guus | 2001-10-27 14:13:17 +0200 (Sat, 27 Oct 2001) | 8 lines - * lib/dropin.h: file dropin.h was initially added on branch CABAL. +Big bad commit: +- Transition to new node/vertex/connection structures +- Use new configuration handling everywhere +- Linux tun/tap device handling cleanup +- Start of IPv6 support in route.c -2000-11-29 00:12 Ivo Timmermans +It compiles, but it won't link. - * m4/openssl.m4, src/conf.c, src/tincd.c: Save RSA public and - private keys to a separate file, instead of wanting to copy them - into a configuration file. +------------------------------------------------------------------------ +r733 | guus | 2001-10-13 15:53:07 +0200 (Sat, 13 Oct 2001) | 2 lines -2000-11-28 09:59 Ivo Timmermans +Support new files (node/vertex/device.[ch]) and OpenBSD. - * src/process.c: Use sigaction to set signal handlers, the previous - commit (1.1.2.16) already contained a large portion of what should - have gone in this one. +------------------------------------------------------------------------ +r732 | guus | 2001-10-12 17:52:03 +0200 (Fri, 12 Oct 2001) | 2 lines -2000-11-27 21:52 Ivo Timmermans +Forgot the tun specific stuff. - * TODO: Sort items to either 1.0 or future release goals. +------------------------------------------------------------------------ +r731 | guus | 2001-10-12 17:49:11 +0200 (Fri, 12 Oct 2001) | 2 lines -2000-11-26 23:46 Ivo Timmermans +Added OpenBSD tun device handling. Untested though. - * configure.in, system.h: Check for the function strsignal, and - define it to "" if it is not available. +------------------------------------------------------------------------ +r729 | guus | 2001-10-12 17:38:35 +0200 (Fri, 12 Oct 2001) | 2 lines -2000-11-26 23:42 Ivo Timmermans +Forgot to remove some old #ifdef stuff. - * src/process.c: Give an error message if daemon() failed. +------------------------------------------------------------------------ +r728 | guus | 2001-10-12 17:33:21 +0200 (Fri, 12 Oct 2001) | 2 lines -2000-11-26 23:32 Ivo Timmermans +Solaris tun device handling cleaned up a bit and added. - * po/es.po: Updated Spanish translation, provided by Enrique - Zanardi. +------------------------------------------------------------------------ +r726 | guus | 2001-10-12 17:22:59 +0200 (Fri, 12 Oct 2001) | 2 lines -2000-11-25 14:33 Guus Sliepen +Added FreeBSD tap device handling. - * acconfig.h, autogen.sh, configure.in, src/net.c, src/process.c, - src/protocol.c: - - Use only one socket for all UDP traffic (for compatibility) - - Write pidfile again after detaching - - Check OS (for handling FreeBSD/Solaris tun/tap stuff) +------------------------------------------------------------------------ +r724 | guus | 2001-10-12 17:16:03 +0200 (Fri, 12 Oct 2001) | 4 lines -2000-11-25 00:30 Guus Sliepen +- Split tap device stuff out of net.[ch] +- Each OS gets it's own device.c to get rid of evil #ifdefs. +- Cleaned up Linux ethertap and tun/tap handling. - * lib/: daemon.c, daemon.h: - - Added daemon() replacement. +------------------------------------------------------------------------ +r721 | guus | 2001-10-10 22:35:10 +0200 (Wed, 10 Oct 2001) | 2 lines -2000-11-25 00:30 Guus Sliepen +More updates to new node/vertex/connection combo. - * lib/daemon.c: file daemon.c was initially added on branch CABAL. +------------------------------------------------------------------------ +r720 | guus | 2001-10-10 22:34:27 +0200 (Wed, 10 Oct 2001) | 6 lines -2000-11-25 00:30 Guus Sliepen +Revamp configuration handling: +- Store everything in AVL trees (fast lookup) +- No need for hazahaza anymore +- Parse values when needed +- This simplifies a lot of config variable lookups. - * lib/daemon.h: file daemon.h was initially added on branch CABAL. +------------------------------------------------------------------------ +r719 | guus | 2001-10-10 11:42:29 +0200 (Wed, 10 Oct 2001) | 3 lines -2000-11-25 00:14 Guus Sliepen +Removed everything from connection.c that has already been moved to node.c and +vertex.c. - * THANKS: - - Added Armijn to the list +------------------------------------------------------------------------ +r718 | guus | 2001-10-10 10:49:47 +0200 (Wed, 10 Oct 2001) | 3 lines -2000-11-25 00:12 Guus Sliepen +Further implementation of doc/CONNECTIVITY. connection.[ch] is now split into a +node, vertex and connection part. - * configure.in, lib/Makefile.am, lib/rbl.c, lib/rbl.h, - src/connection.c, src/net.c, src/process.c, src/process.h, - src/subnet.c, src/tincd.c: Another big & bad commit: - - Added some extra search functions to rbl routines - - Fix subnet_lookup() - - Reorder some syslog messages to make more sense - - daemon() is back - - Don't let scripts execute in parallel (gives race conditions, and - anyway something MIGHT just be configured which is necessary for - further execution of tinc itself) - - Accidently merged check_child() with execute_script(). - - Small fixes +------------------------------------------------------------------------ +r715 | wsl | 2001-10-09 21:41:56 +0200 (Tue, 09 Oct 2001) | 2 lines -2000-11-24 15:13 Ivo Timmermans +make is not always GNU make. - * doc/tinc.texi: Explain how to tell configure where OpenSSL lives. +------------------------------------------------------------------------ +r714 | guus | 2001-10-09 21:37:10 +0200 (Tue, 09 Oct 2001) | 2 lines -2000-11-24 15:13 Ivo Timmermans +Small corrections. - * lib/pidfile.c: Set errno to 0 before trying to kill the other - process. +------------------------------------------------------------------------ +r713 | guus | 2001-10-09 21:30:30 +0200 (Tue, 09 Oct 2001) | 2 lines -2000-11-24 15:12 Ivo Timmermans +Started implementing doc/CONNECTIVITY. - * m4/openssl.m4: Alter CFLAGS, somehow INCLUDES doesn't propagate - properly. Still doesn't work exactly like it should, but getting - there. +------------------------------------------------------------------------ +r710 | guus | 2001-10-08 17:47:30 +0200 (Mon, 08 Oct 2001) | 2 lines -2000-11-24 15:00 Ivo Timmermans +Updated dutch translation. - * cvsusers: file cvsusers was initially added on branch CABAL. +------------------------------------------------------------------------ +r709 | guus | 2001-10-08 17:37:14 +0200 (Mon, 08 Oct 2001) | 3 lines -2000-11-24 15:00 Ivo Timmermans +Fix bug when dropping an old connection in favour of a new one from the +same host. - * Makefile.am, cvsusers: Use cvs2cl instead of rcs2log to generate - the ChangeLog. +------------------------------------------------------------------------ +r708 | guus | 2001-10-08 15:37:30 +0200 (Mon, 08 Oct 2001) | 4 lines -2000-11-24 14:33 Ivo Timmermans +- Use ping timeout mechanism to close connections that don't authenticate + in time. +- Fix potential segmentation fault in check_dead_connections(). - * Makefile.am: Do not attempt to retreive ChangeLog information - only from the CABAL tag, it doesn't work anyway. +------------------------------------------------------------------------ +r707 | guus | 2001-10-08 13:59:08 +0200 (Mon, 08 Oct 2001) | 3 lines -2000-11-24 14:32 Ivo Timmermans +Fix bug where tinc would crash because of a portscan or a connection from a +tinc daemon with a different version. - * configure.in: Do not check for the daemon() system call +------------------------------------------------------------------------ +r706 | guus | 2001-10-08 13:47:55 +0200 (Mon, 08 Oct 2001) | 4 lines -2000-11-24 13:44 Ivo Timmermans +- Renamed lastbutonehop to prevhop. +- Added connection_t *via to connection_t, this keeps record of where + to send UDP packets to. - * src/process.c: Do not use the C library's daemon() call. +------------------------------------------------------------------------ +r705 | guus | 2001-09-25 15:39:11 +0200 (Tue, 25 Sep 2001) | 2 lines -2000-11-23 10:30 Guus Sliepen +Fill in next- and lastbutonehop for myself. - * autogen.sh, configure.in: - - Don't link with -ldl anymore - - Let's not use bash' built-in pwd function anymore... it does not - follow symlinks. +------------------------------------------------------------------------ +r704 | guus | 2001-09-25 15:35:45 +0200 (Tue, 25 Sep 2001) | 2 lines -2000-11-23 00:09 Guus Sliepen +Try next connectto instead of the same over and over. - * lib/list.c: - - #include instead of +------------------------------------------------------------------------ +r703 | guus | 2001-09-24 16:16:29 +0200 (Mon, 24 Sep 2001) | 2 lines -2000-11-22 23:18 Guus Sliepen +Show next- and lastbutonehop when dumping connectionlist to syslog. - * lib/list.c, src/connection.c, src/connection.h, src/process.c, - src/process.h: - - Fixed all (except 2) compiler warnings gcc -Wall gave. +------------------------------------------------------------------------ +r702 | guus | 2001-09-24 16:12:00 +0200 (Mon, 24 Sep 2001) | 4 lines -2000-11-22 23:05 Guus Sliepen +Not only keep track of nexthop, but also of lastbutonehop. If destination cl +wants indirectdata, send it to the lastbutonehop instead, unless it too has +requested so, and so on. - * configure.in, lib/list.c, src/process.c, src/protocol.c: - - More porting to FreeBSD and Solaris. +------------------------------------------------------------------------ +r701 | guus | 2001-09-24 15:31:15 +0200 (Mon, 24 Sep 2001) | 3 lines -2000-11-22 21:25 Guus Sliepen +- Try old TUN/TAP ioctl() request if the one from if_tun.h fails. +- Be more verbose about the kind of tap device used. - * src/protocol.c: - - Work with the correct key buffer in ans_key_h +------------------------------------------------------------------------ +r700 | zarq | 2001-09-05 20:38:09 +0200 (Wed, 05 Sep 2001) | 3 lines -2000-11-22 20:55 Guus Sliepen +Killing tincd with SIGINT causes it to toggle between the current +debug level and level 5. Useful to debug a running tincd. - * src/: protocol.c, protocol.h: - - No more %as. +------------------------------------------------------------------------ +r699 | guus | 2001-09-01 14:46:49 +0200 (Sat, 01 Sep 2001) | 2 lines -2000-11-22 20:14 Guus Sliepen +config_t* is a const parameter in get_config_val(). - * lib/rbl.c, src/process.c, src/tincd.c: - - Write pidfile AFTER detaching... - - Minor cleanups +------------------------------------------------------------------------ +r698 | guus | 2001-09-01 14:36:53 +0200 (Sat, 01 Sep 2001) | 2 lines -2000-11-22 19:54 Guus Sliepen +Optional signal number for -k option. - * lib/rbl.c, src/connection.c, src/netutl.c, src/protocol.c: - - Cleaned up and checked for some more NULL pointers in rbl.c - - Two connection lists: one for incoming connections, sorted on - ip/port, one for connections whose identity we know, sorted on id - ofcourse... +------------------------------------------------------------------------ +r697 | guus | 2001-09-01 14:36:06 +0200 (Sat, 01 Sep 2001) | 2 lines -2000-11-22 18:49 Ivo Timmermans +Revised reconnection mechanism, always try out all ConnectTo lines. - * src/process.c: Declare fd. +------------------------------------------------------------------------ +r696 | guus | 2001-09-01 14:02:39 +0200 (Sat, 01 Sep 2001) | 3 lines -2000-11-22 18:48 Ivo Timmermans +Remove IndirectData support for now, new implementation will be added +later. - * src/process.c: Add more checks to ensure that filedescriptors are - right in _execute_script(). +------------------------------------------------------------------------ +r695 | guus | 2001-08-28 22:52:39 +0200 (Tue, 28 Aug 2001) | 2 lines -2000-11-22 17:19 Ivo Timmermans +Fix signed comparison bug in lookup_subnet_ipv4(). - * src/: Makefile.am, tincd.c: Honor the --localstatedir option to - configure, instead of hardcoded /var. +------------------------------------------------------------------------ +r694 | guus | 2001-08-17 20:14:04 +0200 (Fri, 17 Aug 2001) | 2 lines -2000-11-21 10:13 Guus Sliepen +Don't send DEL_HOSTs when !status.meta - * lib/: rbl.c, xalloc.h, xmalloc.c: - - Check for NULL tree->delete callback - - Add xstrdup() function +------------------------------------------------------------------------ +r693 | guus | 2001-07-24 22:14:30 +0200 (Tue, 24 Jul 2001) | 2 lines -2000-11-21 00:29 Guus Sliepen +Explicitly log which type of tunnel device is used. - * src/: net.c, process.c: - - More fixes. +------------------------------------------------------------------------ +r692 | guus | 2001-07-24 22:13:42 +0200 (Tue, 24 Jul 2001) | 2 lines -2000-11-20 23:13 Guus Sliepen +The val variable in a config_t is never used as a long. - * lib/list.c, src/connection.c, src/connection.h, src/net.c, - src/process.c, src/process.h, src/subnet.c, src/tincd.c: - - Various small fixes. +------------------------------------------------------------------------ +r691 | guus | 2001-07-24 22:04:22 +0200 (Tue, 24 Jul 2001) | 3 lines -2000-11-20 20:56 Ivo Timmermans +Write public key to rsa_key.pub instead of rsa_key.priv (if not host +configuration file is found). - * configure.in: Get rid of all libtool references at once. libtool - was only used by libblowfish, which was superseded by openssl. +------------------------------------------------------------------------ +r690 | guus | 2001-07-24 22:03:40 +0200 (Tue, 24 Jul 2001) | 2 lines -2000-11-20 20:41 Guus Sliepen +Don't use %m in fprintf(). - * src/: connection.c, net.c, subnet.c, subnet.h: - - Proper initialization of rbltree structures. +------------------------------------------------------------------------ +r689 | guus | 2001-07-24 10:51:36 +0200 (Tue, 24 Jul 2001) | 2 lines -2000-11-20 20:12 Guus Sliepen +More on edges. - * src/connection.h: file connection.h was initially added on branch - CABAL. +------------------------------------------------------------------------ +r688 | guus | 2001-07-24 00:06:22 +0200 (Tue, 24 Jul 2001) | 2 lines -2000-11-20 20:12 Guus Sliepen +Discuss how sending ADD_EDGEs would be better than sending ADD_HOSTs. - * src/connection.c: file connection.c was initially added on branch - CABAL. +------------------------------------------------------------------------ +r687 | guus | 2001-07-22 19:41:52 +0200 (Sun, 22 Jul 2001) | 2 lines -2000-11-20 20:12 Guus Sliepen +Written down a possible solution. - * lib/Makefile.am, lib/rbl.c, lib/rbl.h, po/POTFILES.in, - src/Makefile.am, src/conf.c, src/connection.c, src/connection.h, - src/connlist.c, src/connlist.h, src/meta.c, src/meta.h, src/net.c, - src/net.h, src/process.c, src/protocol.c, src/protocol.h, - src/route.c, src/subnet.c, src/subnet.h: - - Integrate rbl trees into tinc. +------------------------------------------------------------------------ +r686 | guus | 2001-07-22 17:25:13 +0200 (Sun, 22 Jul 2001) | 2 lines -2000-11-20 19:06 Ivo Timmermans +Correctie. - * src/tincd.c: Also include process.h +------------------------------------------------------------------------ +r685 | guus | 2001-07-22 16:58:18 +0200 (Sun, 22 Jul 2001) | 2 lines -2000-11-20 19:05 Ivo Timmermans +Small update. - * configure.in: More function and header checks +------------------------------------------------------------------------ +r684 | guus | 2001-07-22 16:46:11 +0200 (Sun, 22 Jul 2001) | 2 lines -2000-11-20 19:02 Ivo Timmermans +Described problem in more detail. - * NEWS: Added this release +------------------------------------------------------------------------ +r683 | guus | 2001-07-22 16:04:38 +0200 (Sun, 22 Jul 2001) | 2 lines -2000-11-19 23:12 Guus Sliepen +Started writing a document about how daemons connect to each other. - * lib/: rbl.c, rbl.h: - - Small fixes +------------------------------------------------------------------------ +r681 | guus | 2001-07-21 22:21:25 +0200 (Sat, 21 Jul 2001) | 3 lines -2000-11-19 12:05 Guus Sliepen +Woohoo! tinc now compiles, runs and actually *works* on Solaris! +Tested on a SparcStation 20MP running Solaris 7. (Thanks, jiggel!) - * lib/: rbl.c, rbl.h: - - Deletion also works now. +------------------------------------------------------------------------ +r680 | guus | 2001-07-21 17:46:34 +0200 (Sat, 21 Jul 2001) | 2 lines -2000-11-19 03:04 Guus Sliepen +Always close all sockets in terminate_connection(). - * lib/: rbl.c, rbl.h: - - Fixed a lot of small things. Tested everything except deletions. +------------------------------------------------------------------------ +r679 | guus | 2001-07-21 17:34:18 +0200 (Sat, 21 Jul 2001) | 3 lines -2000-11-19 00:22 Guus Sliepen +Updated terminate_connection() so you can choose if DEL_HOSTs should be +sent or not. - * lib/rbl.c: - - Fix tree head/tail upon insertion +------------------------------------------------------------------------ +r678 | guus | 2001-07-20 22:25:10 +0200 (Fri, 20 Jul 2001) | 6 lines -2000-11-19 00:21 Guus Sliepen +Added purge_tree for connection_t's which are no longer in the connection, +active or id trees, but which may still be referenced. This tree is flushed +when it is safe, this replaces purge_connection_tree(). - * lib/: rbl.c, rbl.h: - - Implemented deletions - - Added rbl_foreach() function +Also lots of bugfixes related to the new trees. -2000-11-18 19:14 Guus Sliepen +------------------------------------------------------------------------ +r677 | guus | 2001-07-20 15:54:19 +0200 (Fri, 20 Jul 2001) | 2 lines - * lib/: rbl.c, rbl.h: - - Fixed searching - - Insertion implemented +Remove all unnecessary status.meta and status.active checks. -2000-11-17 11:03 Guus Sliepen +------------------------------------------------------------------------ +r676 | guus | 2001-07-19 14:29:40 +0200 (Thu, 19 Jul 2001) | 2 lines - * src/: Makefile.am, process.c: - - Removed stray @INCLUDE@ (how did that get there?) - - Use 0 instead of FALSE +Correctly use the active_tree. -2000-11-17 01:56 Guus Sliepen +------------------------------------------------------------------------ +r675 | guus | 2001-07-15 20:07:31 +0200 (Sun, 15 Jul 2001) | 6 lines - * src/process.c: - - Simplified do_detach +Split connection list into two lists: + - one list to handle all incoming/outgoing TCP connections + - another list to handle all UDP connections -2000-11-16 23:13 Ivo Timmermans +This will prevent race conditions. - * lib/: list.c, list.h, xalloc.h: Use proper prototypes. +------------------------------------------------------------------------ +r674 | guus | 2001-07-15 16:21:12 +0200 (Sun, 15 Jul 2001) | 2 lines -2000-11-16 23:12 Ivo Timmermans +Correct inclusion of standard if_tun.h header file. - * src/: process.c, process.h, tincd.c: Move more functions from - tincd.c into process.c. +------------------------------------------------------------------------ +r673 | guus | 2001-07-04 10:43:32 +0200 (Wed, 04 Jul 2001) | 2 lines -2000-11-16 23:11 Ivo Timmermans +Don't load table of verbose OpenSSL errormessages. - * src/net.c: Delete struct ifr +------------------------------------------------------------------------ +r672 | guus | 2001-07-04 10:41:36 +0200 (Wed, 04 Jul 2001) | 3 lines -2000-11-16 19:06 Ivo Timmermans +- Always use instead of just +- Check if RAND_pseudo_bytes() exists, otherwise just use RAND_bytes() - * lib/xmalloc.c: New function: xmalloc_and_zero, which initialises - the allocated memory to all zeroes. +------------------------------------------------------------------------ +r671 | guus | 2001-07-01 23:42:13 +0200 (Sun, 01 Jul 2001) | 2 lines -2000-11-16 18:54 Ivo Timmermans +Check for all potential duplicate entries in the id tree. - * src/process.c: file process.c was initially added on branch - CABAL. +------------------------------------------------------------------------ +r670 | guus | 2001-07-01 11:21:14 +0200 (Sun, 01 Jul 2001) | 2 lines -2000-11-16 18:54 Ivo Timmermans +Fix compiler warning. - * src/process.h: file process.h was initially added on branch - CABAL. +------------------------------------------------------------------------ +r669 | guus | 2001-07-01 11:21:01 +0200 (Sun, 01 Jul 2001) | 2 lines -2000-11-16 18:54 Ivo Timmermans +Fix printf format bug. - * src/: Makefile.am, net.c, process.c, process.h, tincd.c: Move all - process-related functions into process.c. +------------------------------------------------------------------------ +r668 | guus | 2001-07-01 11:06:17 +0200 (Sun, 01 Jul 2001) | 2 lines -2000-11-16 10:18 Guus Sliepen +More items marked as done. - * lib/rbl.c: file rbl.c was initially added on branch CABAL. +------------------------------------------------------------------------ +r667 | guus | 2001-06-29 17:38:40 +0200 (Fri, 29 Jun 2001) | 2 lines -2000-11-16 10:18 Guus Sliepen +Dutch translation updated. - * lib/rbl.h: file rbl.h was initially added on branch CABAL. +------------------------------------------------------------------------ +r666 | guus | 2001-06-29 17:33:18 +0200 (Fri, 29 Jun 2001) | 2 lines -2000-11-16 10:18 Guus Sliepen +Update of RedHat build scripts. - * lib/: rbl.c, rbl.h: - - Added balanced tree management stuff as well. (It is not finished - yet.) +------------------------------------------------------------------------ +r665 | guus | 2001-06-29 17:32:26 +0200 (Fri, 29 Jun 2001) | 3 lines -2000-11-15 23:07 Ivo Timmermans +It appears that autogen.sh doesn't like es.po if it isn't mentioned in +the makefile/configure scripts. - * src/net.c: Keep a list of running children, and in each loop in - main_loop(), check if one has exited. +------------------------------------------------------------------------ +r663 | guus | 2001-06-29 16:15:46 +0200 (Fri, 29 Jun 2001) | 2 lines -2000-11-15 23:04 Ivo Timmermans +Check for dlopen in standard libraries first (needed for DEC OSF). - * lib/: Makefile.am, list.c, list.h: List management and - manipulation routines. +------------------------------------------------------------------------ +r662 | guus | 2001-06-29 15:09:55 +0200 (Fri, 29 Jun 2001) | 2 lines -2000-11-15 14:33 Guus Sliepen +Fix gcc 3.0 warnings. - * src/: Makefile.am, meta.c, net.c, protocol.c: Porting to FreeBSD: - - Reorganized and added some #includes +------------------------------------------------------------------------ +r661 | guus | 2001-06-29 15:09:32 +0200 (Fri, 29 Jun 2001) | 2 lines -2000-11-15 02:28 Ivo Timmermans +Log error if two hosts connect with same IP/port tuple. - * src/net.c: Let the output from an executed script in - execute_script() go to syslog, with proper error detection. +------------------------------------------------------------------------ +r660 | guus | 2001-06-29 13:09:13 +0200 (Fri, 29 Jun 2001) | 2 lines -2000-11-15 02:06 Ivo Timmermans +Also remove po/Makefile.in.in, which is generated by autogen.sh. - * src/: connlist.h, meta.c, net.c, protocol.c, tincd.c: Use the - HAVE_OPENSSL_xxx_H defined from m4/openssl.m4 during configure. +------------------------------------------------------------------------ +r659 | guus | 2001-06-29 13:03:27 +0200 (Fri, 29 Jun 2001) | 2 lines -2000-11-15 02:02 Ivo Timmermans +es.po revived. - * m4/openssl.m4: Also check for sha.h. +------------------------------------------------------------------------ +r658 | guus | 2001-06-29 12:30:18 +0200 (Fri, 29 Jun 2001) | 5 lines -2000-11-15 01:57 Ivo Timmermans +Execute tinc-down BEFORE tap device is closed. This is a. more symmetric +(tinc-up is started after tap device is opened) and b. is needed for +tun/tap device, where the interface does not exist anymore after the +device file is closed. - * m4/openssl.m4: Also check for rand.h and err.h. If any of these - files does not exist, try the next alternative path. +------------------------------------------------------------------------ +r657 | guus | 2001-06-29 12:27:57 +0200 (Fri, 29 Jun 2001) | 2 lines -2000-11-15 00:18 Ivo Timmermans +Don't build Spanish translation. - * m4/tuntap.m4: Get rid of the annoying empty line +------------------------------------------------------------------------ +r656 | guus | 2001-06-29 12:27:33 +0200 (Fri, 29 Jun 2001) | 2 lines -2000-11-15 00:02 Ivo Timmermans +ABOUT-NLS is created by autogen.sh. - * m4/openssl.m4: Oops, small error. +------------------------------------------------------------------------ +r655 | guus | 2001-06-29 12:23:46 +0200 (Fri, 29 Jun 2001) | 3 lines -2000-11-14 23:57 Ivo Timmermans +Spanish translation removed. Nobody maintains it, and it is severely +outdated. - * m4/openssl.m4: Better checks for OpenSSL. I think it can now - detect almost all conceivable installations. +------------------------------------------------------------------------ +r654 | zarq | 2001-06-27 00:00:57 +0200 (Wed, 27 Jun 2001) | 2 lines -2000-11-13 23:29 Ivo Timmermans +Small fix to make it compile again - * configure.in: Identify version as 1.0pre4-cvs +------------------------------------------------------------------------ +r653 | guus | 2001-06-21 20:28:52 +0200 (Thu, 21 Jun 2001) | 4 lines -2000-11-13 23:01 Ivo Timmermans +Reinstated search for if_tun.h in kernel source tree, because apparently +/usr/include/linux does not always have the same contents as the include +files from the currently running kernel. - * m4/openssl.m4: file openssl.m4 was initially added on branch - CABAL. +------------------------------------------------------------------------ +r652 | guus | 2001-06-21 18:37:47 +0200 (Thu, 21 Jun 2001) | 2 lines -2000-11-13 23:01 Ivo Timmermans +Remove #warnings I used for debugging stuff. - * configure.in, m4/openssl.m4: Add a check for openssl that accepts - explicit file locations. +------------------------------------------------------------------------ +r651 | guus | 2001-06-21 18:37:05 +0200 (Thu, 21 Jun 2001) | 2 lines -2000-11-09 22:33 Ivo Timmermans +Check for and add -ldl. - * src/netutl.h: Add prototype for destroy_queue +------------------------------------------------------------------------ +r650 | guus | 2001-06-21 18:16:32 +0200 (Thu, 21 Jun 2001) | 6 lines -2000-11-09 22:29 Ivo Timmermans +- Solaris compile fixes +- Set mymac to broadcast MAC so that ifconfig hw ether <...> is really not + needed anymore. +- Forwarding of indirect packets when in switch mode (because the kernel + will not do it for us then). - * doc/tinc.texi: Updates, updates +------------------------------------------------------------------------ +r649 | zarq | 2001-06-20 23:32:40 +0200 (Wed, 20 Jun 2001) | 2 lines -2000-11-09 21:42 Ivo Timmermans +Don't include the debian/ dir in a release - * README: Wrapped text to 70 (72?) columns for easy reading +------------------------------------------------------------------------ +r648 | guus | 2001-06-09 12:00:34 +0200 (Sat, 09 Jun 2001) | 2 lines -2000-11-09 21:41 Ivo Timmermans +Woops - big bug in send_key_changed fixed. - * NEWS: Final release notes added, also edited release notes for - 1.0pre2 to what the announcement on the mailing list looked like. +------------------------------------------------------------------------ +r647 | guus | 2001-06-08 20:02:10 +0200 (Fri, 08 Jun 2001) | 2 lines -2000-11-08 21:52 Guus Sliepen +Only reset seconds_till_retry when we activate the outgoing connection. - * acconfig.h, configure.in, lib/utils.c, lib/utils.h, src/tincd.c: - - Make checkpoint tracing a compile time option (off by default) +------------------------------------------------------------------------ +r646 | guus | 2001-06-07 09:51:04 +0200 (Thu, 07 Jun 2001) | 6 lines -2000-11-08 19:05 Guus Sliepen +Changed drastically because it didn't work correctly: +- Don't cache the --with-openssl-* option arguments +- Only search for openssl/*.h, the openssl include files include other + files only from an openssl/ directory too +- Set CPPFLAGS before AC_CHECK_HEADERS - * THANKS: - - Add Jamie :) +------------------------------------------------------------------------ +r645 | guus | 2001-06-07 09:48:11 +0200 (Thu, 07 Jun 2001) | 2 lines -2000-11-08 18:56 Guus Sliepen +Save configure cache more often. - * src/net.c: - - Applied Jamie Brigg's patch (close sockets after error) +------------------------------------------------------------------------ +r644 | guus | 2001-06-06 21:12:38 +0200 (Wed, 06 Jun 2001) | 2 lines -2000-11-08 01:20 Guus Sliepen +Fixes to make switching work between hosts that have no meta-connection. - * src/tincd.c: - - Fixed --config - - Show warning when both netname and config directory are given. +------------------------------------------------------------------------ +r643 | guus | 2001-06-06 21:11:16 +0200 (Wed, 06 Jun 2001) | 2 lines -2000-11-08 01:10 Guus Sliepen +Log and warn about duplicate subnet_add()'s for the same subnet. - * configure.in, lib/utils.c, src/net.c, src/tincd.c: Porting to - SunOS 5.8: - - More #includes Linux doesn't seem to need - - Don't do unsetenv() on SunOS - - Use a replacement asprintf() in case the OS doesn't support it It - now compiles properly under SunOS. +------------------------------------------------------------------------ +r642 | guus | 2001-06-05 21:45:47 +0200 (Tue, 05 Jun 2001) | 2 lines -2000-11-07 23:33 Guus Sliepen +Add missing? counting of total_socket_in. - * configure.in, lib/pidfile.c: Porting to SunOS 5.8: - - Include all header files necessary - - Check for flock() function +------------------------------------------------------------------------ +r641 | guus | 2001-06-05 21:39:54 +0200 (Tue, 05 Jun 2001) | 6 lines -2000-11-07 23:02 Guus Sliepen +You can now put an option "Mode" in tinc.conf, and choose from: - * src/protocol.c: - - Open UDP connection for all known hosts. Comments please. +- Mode = router (default, work like tinc has always worked) +- Mode = switch (work like a switch) +- Mode = hub (work like a hub, broadcasting everything) -2000-11-07 22:43 Guus Sliepen +------------------------------------------------------------------------ +r640 | guus | 2001-06-05 20:07:14 +0200 (Tue, 05 Jun 2001) | 2 lines - * src/net.c: Changed execution of tinc-up: - - Do not free() strings that have been putenv()d, see man page of - the latter. - - Do not set IFNAME anymore, it appears that the ioctl to get the - name of the interface does not work at all. Since it is set to - NETNAME in case of tun/tap and it is known beforehand in case of - ethertap, there is no need for it anyway... (though it would've - simplified things). +Fix bug where lookup_subnet_ipv4() could go into an infinite loop. -2000-11-04 23:57 Guus Sliepen +------------------------------------------------------------------------ +r639 | guus | 2001-06-05 18:31:59 +0200 (Tue, 05 Jun 2001) | 2 lines - * src/: conf.c, conf.h, connlist.c, net.c, net.h, netutl.c, - protocol.c, route.c, subnet.c: - - Prepended config_ to all configuration option names, because it - confused everything (including myself). - - Use connection oriented UDP sockets for both incoming and outgoing - packets. +- This oneliner removes the need for ifconfig tap? hw ether fe:fd:0:0:0:0 -2000-11-04 21:44 Guus Sliepen +------------------------------------------------------------------------ +r638 | guus | 2001-06-05 18:15:48 +0200 (Tue, 05 Jun 2001) | 2 lines - * src/: connlist.h, meta.c, net.c, protocol.c: - - Simplified ping mechanism. +Updated dutch translation. -2000-11-04 18:09 Guus Sliepen +------------------------------------------------------------------------ +r637 | guus | 2001-06-05 18:13:41 +0200 (Tue, 05 Jun 2001) | 3 lines - * src/net.c: - - Check for packets that are looping back. +Changed some stuff to allow correct generation of po/Makefile after a +make cvs-clean. -2000-11-04 18:04 Ivo Timmermans +------------------------------------------------------------------------ +r636 | guus | 2001-06-05 18:09:55 +0200 (Tue, 05 Jun 2001) | 3 lines - * po/nl.po: Updated Dutch translation +- tinc can now act as a switch or a hub too (as opposed to a router only) +- cleaner initialisation of "UNKNOWN" and "MYSELF" names -2000-11-04 18:01 Ivo Timmermans +------------------------------------------------------------------------ +r635 | guus | 2001-06-04 13:14:35 +0200 (Mon, 04 Jun 2001) | 3 lines - * po/POTFILES.in: Add route.c to the list of source files. +Added proxy-arp support. No more ifconfig -arp needed. Works like a charm +under FreeBSD now :). -2000-11-04 17:54 Guus Sliepen +------------------------------------------------------------------------ +r634 | guus | 2001-06-01 10:02:09 +0200 (Fri, 01 Jun 2001) | 2 lines - * src/protocol.c: - - Forward keys in hex notation, not as binary data. +Fix subnet_lookup() for overlapping subnets. Needs rethinking. -2000-11-04 17:39 Guus Sliepen +------------------------------------------------------------------------ +r633 | guus | 2001-05-28 10:56:57 +0200 (Mon, 28 May 2001) | 2 lines - * src/protocol.c: - - Don't forget to set packet cipher for added hosts. +Make sure Solaris is happy too. -2000-11-04 16:34 Guus Sliepen +------------------------------------------------------------------------ +r632 | guus | 2001-05-28 10:21:43 +0200 (Mon, 28 May 2001) | 2 lines - * po/POTFILES.in, po/es.po, po/nl.po, src/connlist.c: - - connlist.c added to translation +Small fixes to allow correct compilation under FreeBSD (tested with 4.3) -2000-11-04 16:32 Ivo Timmermans +------------------------------------------------------------------------ +r631 | zarq | 2001-05-26 11:35:28 +0200 (Sat, 26 May 2001) | 2 lines - * src/net.c: In execute_script: - - add an environment variable NETNAME. - - chdir to the configuration directory before execing the script. +Don't distribute autogen.sh in a release -2000-11-04 16:17 Guus Sliepen +------------------------------------------------------------------------ +r630 | zarq | 2001-05-26 11:35:00 +0200 (Sat, 26 May 2001) | 2 lines - * doc/: Makefile.am, genauth.8: - - Removed manpage for no longer existing genauth. +Changed version number to 1.0-cvs -2000-11-04 15:52 Guus Sliepen +------------------------------------------------------------------------ +r629 | zarq | 2001-05-26 11:34:11 +0200 (Sat, 26 May 2001) | 2 lines - * src/net.c: - - Resolve scriptname after fork() +New make target: `make release' -2000-11-04 15:16 Ivo Timmermans +------------------------------------------------------------------------ +r628 | guus | 2001-05-25 20:57:37 +0200 (Fri, 25 May 2001) | 2 lines - * src/net.c: Use putenv() instead of clumsy do-it-yourself in - execute_script. +Fix sample configuration to show keys in PEM format and correct tapdevice. -2000-11-04 14:25 Ivo Timmermans +------------------------------------------------------------------------ +r627 | guus | 2001-05-25 15:24:34 +0200 (Fri, 25 May 2001) | 3 lines - * src/net.c: Small change to the way the environment is copied. +Documents are merged. Now we only need to check the ports and the TCPonly +and IndirectData options. -2000-11-04 12:49 Guus Sliepen +------------------------------------------------------------------------ +r626 | guus | 2001-05-25 14:45:37 +0200 (Fri, 25 May 2001) | 2 lines - * src/: connlist.c, connlist.h, net.c, netutl.h, subnet.c: - - Removed even more warnings. +Merged PROTOCOL, NETWORK and SECURITY2 with the texinfo manual. -2000-11-04 11:37 Guus Sliepen +------------------------------------------------------------------------ +r625 | guus | 2001-05-25 13:54:28 +0200 (Fri, 25 May 2001) | 2 lines - * src/net.c: - - Removed unused MAC strip/add functions. +TCPonly now works (in a relatively clean way too). -2000-11-03 23:35 Ivo Timmermans +------------------------------------------------------------------------ +r624 | guus | 2001-05-25 12:08:11 +0200 (Fri, 25 May 2001) | 2 lines - * src/: conf.c, connlist.c, connlist.h, protocol.c, protocol.h, - subnet.c: Warnings removal pass: always include config.h first; add - a few prototypes in the header files. - - This also fixes a few lint errors/warnings. +With recent kernels the tun device file is located in /dev/net. -2000-11-03 23:33 Ivo Timmermans +------------------------------------------------------------------------ +r623 | guus | 2001-05-25 12:06:13 +0200 (Fri, 25 May 2001) | 2 lines - * src/net.c: Run the scripts tinc-up and tinc-down from a separate - function, which sets the environment as it should be and checks for - errors. +Small corrections to the manuals. -2000-11-03 23:31 Ivo Timmermans +------------------------------------------------------------------------ +r622 | guus | 2001-05-25 10:36:11 +0200 (Fri, 25 May 2001) | 6 lines - * src/tincd.c: Save the environment on startup. +Small fixes: -2000-11-02 23:05 Ivo Timmermans +- Fix compiler warnings (one was a real (but harmless) bug) +- Don't send PING packets if there is UDP traffic +- Correctly terminate strings containing salt for PING/PONG packets - * src/net.c, po/nl.po: Changed a few messages wrt. system calls; - updated and changed the Dutch translation a bit. +------------------------------------------------------------------------ +r621 | guus | 2001-05-24 23:52:26 +0200 (Thu, 24 May 2001) | 2 lines -2000-11-02 22:43 Ivo Timmermans +Only send key_changed if it was previously requested. - * AUTHORS: Mention fileutils, add a pointer to THANKS for more - details +------------------------------------------------------------------------ +r620 | guus | 2001-05-24 23:32:30 +0200 (Thu, 24 May 2001) | 3 lines -2000-11-02 22:41 Ivo Timmermans +All features for 1.0 are implemented now, we just have to check the +FreeBSD and Solaris ports and merge some docs. - * Makefile.am: Change wsl to Wessel's name and email address in the - ChangeLog creation +------------------------------------------------------------------------ +r619 | guus | 2001-05-24 23:30:36 +0200 (Thu, 24 May 2001) | 3 lines -2000-11-02 22:40 Ivo Timmermans +Since this is incompatible with some earlier versions, PROT_CURRENT is +increased. - * NEWS: More exhaustive list of changes - perhaps it can be worded - differently? +------------------------------------------------------------------------ +r618 | guus | 2001-05-24 23:29:09 +0200 (Thu, 24 May 2001) | 3 lines -2000-11-02 22:39 Ivo Timmermans +Add randomness to PING/PONG packets to prevent crypto attacks on quiet +tunnels. - * THANKS: Changed `I' to `We' - small change, lots of difference :) +------------------------------------------------------------------------ +r617 | guus | 2001-05-24 22:40:13 +0200 (Thu, 24 May 2001) | 2 lines -2000-11-02 22:38 Ivo Timmermans +Changed URL from kernelnotes.org to linuxdoc.org. - * configure.in: Only check for linux/if_tun.h once +------------------------------------------------------------------------ +r616 | guus | 2001-05-24 22:24:12 +0200 (Thu, 24 May 2001) | 6 lines -2000-11-02 22:34 Ivo Timmermans +More revisions to the documentation: - * doc/tinc.texi: Added a perl example to turn an IP address into a - MAC address. +- Removed cruft +- Reordered some sections to make it more logical for the beginner +- Added small examples and hints about configuration files -2000-11-02 22:26 Ivo Timmermans +------------------------------------------------------------------------ +r615 | guus | 2001-05-19 17:50:51 +0200 (Sat, 19 May 2001) | 5 lines - * src/Makefile.am: Do not include $(top_srcdir)/cipher, it does no - longer exist. +- Make sure correct information is supplied for both old kernels (with + ethertap) and for new kernels (with TUN/TAP driver). +- Revised example configuration and made it conform to latest (CVS) version of + tinc. -2000-10-31 17:10 Guus Sliepen +------------------------------------------------------------------------ +r614 | guus | 2001-05-07 21:08:46 +0200 (Mon, 07 May 2001) | 4 lines - * NEWS, README, TODO: - - Update. +- s/ip_t/ipv4_t/g +- Add "salt" to the beginning of UDP packets. Replaces length field which + is not useful anyway. -2000-10-30 11:19 Guus Sliepen +------------------------------------------------------------------------ +r613 | guus | 2001-05-04 20:45:02 +0200 (Fri, 04 May 2001) | 2 lines - * doc/tinc.conf.5, doc/tincd.8, src/tincd.c: - - Fixed some spelling mistakes and terminology here and there. +Correctly cycle through ConnectTo variables. -2000-10-30 01:22 Guus Sliepen +------------------------------------------------------------------------ +r612 | guus | 2001-04-13 12:30:04 +0200 (Fri, 13 Apr 2001) | 2 lines - * doc/tinc.conf.5, doc/tincd.8, po/es.po, po/nl.po, src/net.c, - src/tincd.c: - - Small cleanups - - Updated dutch translation - - Updated man pages +Depend on new ssl package and install alias for universal TUN/TAP module. -2000-10-29 23:55 Guus Sliepen +------------------------------------------------------------------------ +r611 | guus | 2001-03-13 22:33:31 +0100 (Tue, 13 Mar 2001) | 2 lines - * src/: connlist.h, meta.c, protocol.c, protocol.h, tincd.c: - - Finishing touch: encrypt the meta connections +Check indirectdata option before forwarding certain requests. -2000-10-29 23:10 Guus Sliepen +------------------------------------------------------------------------ +r610 | guus | 2001-03-13 22:32:24 +0100 (Tue, 13 Mar 2001) | 2 lines - * src/: connlist.h, net.c, protocol.c, tincd.c: - - Use CFB mode for encrypting packets: it works and we don't need - padding. +Ignore alarm signals if we do not need to respond to them. -2000-10-29 11:39 Guus Sliepen +------------------------------------------------------------------------ +r609 | guus | 2001-03-13 10:55:14 +0100 (Tue, 13 Mar 2001) | 3 lines - * src/: net.c, protocol.c: - - Small fixes - - Do proper key exchange - - Encrypt packets - it works, but there is something wrong with the - MAC header after decryption... +Fixed bug in setup_signals() that would make tinc die when unexpected +signals were caught. -2000-10-29 10:19 Guus Sliepen +------------------------------------------------------------------------ +r608 | guus | 2001-03-13 00:58:19 +0100 (Tue, 13 Mar 2001) | 3 lines - * src/: encr.c, encr.h, net.c, net.h, netutl.c, protocol.c, - tincd.c: - - Removed old encr stuff +Fixed a race condition triggered by receive_meta() and the new +authentication scheme. -2000-10-29 03:07 Guus Sliepen +------------------------------------------------------------------------ +r607 | guus | 2001-03-04 15:00:24 +0100 (Sun, 04 Mar 2001) | 3 lines - * po/es.po, po/nl.po, src/connlist.c, src/net.c, src/tincd.c: - - Updated dutch translation. - - Shutdown properly. +Added a description of what is going on in net.c and route.c, and how +packets flow through tinc. -2000-10-29 02:27 Guus Sliepen +------------------------------------------------------------------------ +r606 | guus | 2001-03-04 14:59:53 +0100 (Sun, 04 Mar 2001) | 2 lines - * src/: connlist.h, net.h: - - Moved connlist stuff to the proper header file. +Updated translation. -2000-10-29 02:08 Guus Sliepen +------------------------------------------------------------------------ +r605 | guus | 2001-03-04 14:59:32 +0100 (Sun, 04 Mar 2001) | 5 lines - * src/protocol.c: - - Enforce correct order of authentication requests +- route.c is now used to determine destination +- flags are removed, since they were not used at all. Use options instead. +- indirectdata works now, tcponly almost... +- made functions that don't return useful information void -2000-10-29 02:46 Guus Sliepen +------------------------------------------------------------------------ +r603 | guus | 2001-03-02 12:25:56 +0100 (Fri, 02 Mar 2001) | 2 lines - * src/net.c: - - Hit people who can't figure out subnet address/mask pairs with a - (clue)bat. +Added explaination of our key exchange using RSA encryption. -2000-10-29 02:24 Guus Sliepen +------------------------------------------------------------------------ +r602 | guus | 2001-03-01 22:32:04 +0100 (Thu, 01 Mar 2001) | 2 lines - * src/: conf.c, conf.h, protocol.c: - - Fixed ans_key_h - - Removed tapsubnet configuration option. +Various small fixes. -2000-10-29 02:02 Guus Sliepen +------------------------------------------------------------------------ +r601 | guus | 2001-02-27 17:50:29 +0100 (Tue, 27 Feb 2001) | 2 lines - * src/: conf.c, connlist.c, connlist.h, meta.c, net.c, protocol.c, - subnet.c, tincd.c: - - Very big cleanup. +Removed compiler warning. -2000-10-28 23:52 Guus Sliepen +------------------------------------------------------------------------ +r600 | guus | 2001-02-27 17:37:31 +0100 (Tue, 27 Feb 2001) | 2 lines - * src/net.c: - - Override destination ethernet address on incoming packets with - FE:FD:00:00:00:00 +Removed lots of compiler warnings. -2000-10-28 23:25 Guus Sliepen +------------------------------------------------------------------------ +r599 | guus | 2001-02-27 17:17:04 +0100 (Tue, 27 Feb 2001) | 4 lines - * src/: net.c, net.h: - - Fixed offsets when reading/writing from/to tap device +- Fixed Interface option (untested) +- Removed error handling for non-critical socket options +- Added TCP_NODELAY and IPTOS_LOWDELAY options for meta sockets. -2000-10-28 23:05 Guus Sliepen +------------------------------------------------------------------------ +r598 | zarq | 2001-02-27 17:15:14 +0100 (Tue, 27 Feb 2001) | 2 lines - * lib/utils.c, lib/utils.h, src/net.c, src/protocol.c, - src/protocol.h, src/subnet.c, src/subnet.h, src/tincd.c: - - Lots of small fixes - - Exchange subnets on acknowledgement of connection - - Do proper lookup when incoming packets from tap - - off-by-a small number-error when reading/sending tap packets +Authentication done -2000-10-28 21:34 Ivo Timmermans +------------------------------------------------------------------------ +r597 | guus | 2001-02-27 16:33:39 +0100 (Tue, 27 Feb 2001) | 3 lines - * m4/tuntap.m4: Skip the check for Linux kernel sources +Don't forget to reconnect if outgoing connection fails during +authentication. -2000-10-28 18:41 Guus Sliepen +------------------------------------------------------------------------ +r596 | guus | 2001-02-26 12:37:20 +0100 (Mon, 26 Feb 2001) | 3 lines - * src/: connlist.c, connlist.h, net.c, subnet.c, subnet.h: - - Updated subnet list handling. Subnets are added to two lists now, - the owner's list and a global list. It is all fucked up but it - probably works anyway, good enough for pre3 :). +- Make sure METAKEY is smaller than the modulus of the RSA key +- Get symmetric key from the least significant bytes of the RSA message -2000-10-24 17:46 Guus Sliepen +------------------------------------------------------------------------ +r595 | guus | 2001-02-25 21:17:46 +0100 (Sun, 25 Feb 2001) | 2 lines - * src/: conf.c, conf.h, connlist.c, meta.c, net.c, netutl.c, - protocol.c, subnet.c: - - Lots of little stuff modified - - Succesfully reads in subnets from host config file now and adds - them to the list. +Added process.c to the translated files. -2000-10-23 23:56 Ivo Timmermans +------------------------------------------------------------------------ +r594 | guus | 2001-02-25 20:09:45 +0100 (Sun, 25 Feb 2001) | 2 lines - * configure.in: Oops, echelon change committed to cabal... :) +Implemented new authentication scheme from doc/SECURITY2. -2000-10-23 15:52 Guus Sliepen +------------------------------------------------------------------------ +r593 | guus | 2001-02-25 17:34:19 +0100 (Sun, 25 Feb 2001) | 3 lines - * src/route.c: file route.c was initially added on branch CABAL. +Encrypt network packets in CBC mode instead of CFB mode. +(This breaks compatibility with all previous versions!) -2000-10-23 15:52 Guus Sliepen +------------------------------------------------------------------------ +r592 | guus | 2001-02-25 17:04:00 +0100 (Sun, 25 Feb 2001) | 2 lines - * src/route.c: - - route.c will contain the routing logic. +Copy packets before putting them in the queue. -2000-10-22 15:47 Ivo Timmermans +------------------------------------------------------------------------ +r591 | guus | 2001-02-25 16:34:50 +0100 (Sun, 25 Feb 2001) | 2 lines - * src/conf.c: read_server_config: Check for result of - read_config_file. +Free node->data and node, not node->data twice. -2000-10-22 15:37 Ivo Timmermans +------------------------------------------------------------------------ +r590 | guus | 2001-02-25 15:51:42 +0100 (Sun, 25 Feb 2001) | 2 lines - * src/net.c: Include linux/sockios.h and net/if.h anyway, - regardless of the value of HAVE_TUNTAP. +Add missing \n. -2000-10-21 13:52 Guus Sliepen +------------------------------------------------------------------------ +r589 | guus | 2001-02-25 12:09:29 +0100 (Sun, 25 Feb 2001) | 2 lines - * lib/utils.h, src/meta.c, src/net.c, src/protocol.c, src/tincd.c: - - Fixed all debug levels. - - Seed PRNG before generating a challenge - - Strange thing in challenge decryption: it fails if first bit is - set!? +Corrected check for errors after read() calls. -2000-10-20 21:46 Guus Sliepen +------------------------------------------------------------------------ +r588 | wsl | 2001-02-20 22:53:18 +0100 (Tue, 20 Feb 2001) | 2 lines - * src/: Makefile.am, net.c, tincd.c: - - Removed last reference to genauth from Makefile.am - - Tinc spawns tinc-up and tinc-down scripts which can be used to - configure the network device. The environment variable IFNAME is set - to the name of the interface. +Important bugfix in avl_insert_before() and avl_insert_after() -2000-10-20 18:49 Guus Sliepen +------------------------------------------------------------------------ +r587 | zarq | 2001-02-18 03:13:26 +0100 (Sun, 18 Feb 2001) | 3 lines - * doc/es/Makefile.am: file Makefile.am was initially added on - branch CABAL. +tinc_TUNTAP now substitutes the values outside the AC_CACHE_CHECK +block. configure should now correctly set HAVE_TUNTAP. -2000-10-20 18:49 Guus Sliepen +------------------------------------------------------------------------ +r586 | guus | 2001-02-13 10:54:29 +0100 (Tue, 13 Feb 2001) | 2 lines - * doc/es/Makefile.am, po/POTFILES.in, po/es.po, po/nl.po, - src/Makefile.am, src/genauth.c, src/tincd.c: - - Made Makefile.am stub for doc/es/ - - Merged genauth into tincd - - Updated dutch translation +Added description of the proposed new authentication scheme. -2000-10-20 18:44 Ivo Timmermans +------------------------------------------------------------------------ +r584 | zarq | 2001-02-11 12:55:28 +0100 (Sun, 11 Feb 2001) | 2 lines - * lib/: hash.c, hash.h, list.c, list.h: Generalized list and hash - handling functions +More files to ignore in CVS -2000-10-20 18:43 Ivo Timmermans +------------------------------------------------------------------------ +r582 | guus | 2001-02-11 12:50:09 +0100 (Sun, 11 Feb 2001) | 4 lines - * lib/: xmalloc.c, xalloc.h: New function: xalloc_and_zero() +- Updated CVS_CREATED to remove intl/ directory and some other + autogenerated files. +- Checked if all INCLUDES/LIBS/etc directives inherit the global variables. -2000-10-20 18:42 Ivo Timmermans +------------------------------------------------------------------------ +r581 | guus | 2001-02-11 12:46:14 +0100 (Sun, 11 Feb 2001) | 2 lines - * lib/Makefile.am: Add all the new files to the sources list for - the utility library +Ignore file for src/ -2000-10-20 17:34 Guus Sliepen +------------------------------------------------------------------------ +r580 | guus | 2001-02-11 12:44:32 +0100 (Sun, 11 Feb 2001) | 3 lines - * src/: connlist.c, connlist.h, genauth.c, net.c, protocol.c, - protocol.h: - - tinc now really does public/private key encryption! It even works, - whee! +Added .cvsignore files to get rid of warnings and prevent autogenerated +files from being added accidentaly. -2000-10-19 22:56 Ivo Timmermans +------------------------------------------------------------------------ +r578 | guus | 2001-02-06 11:42:27 +0100 (Tue, 06 Feb 2001) | 2 lines - * lib/: error.c, error.h: Generalized error handling functions +Removed another local definition of the variable "errno" -2000-10-19 22:39 Ivo Timmermans +------------------------------------------------------------------------ +r577 | guus | 2001-02-06 11:13:44 +0100 (Tue, 06 Feb 2001) | 2 lines - * configure.in: Add check for the syslog function +Updated dutch translation. -2000-10-19 16:42 Guus Sliepen +------------------------------------------------------------------------ +r576 | guus | 2001-02-06 11:13:22 +0100 (Tue, 06 Feb 2001) | 2 lines - * src/genauth.c: - - Seed the PRNG using /dev/random before generating the keys. +Fix memory leak in avl_insert() if item was already inserted. -2000-10-18 22:12 Ivo Timmermans +------------------------------------------------------------------------ +r575 | guus | 2001-02-06 11:12:51 +0100 (Tue, 06 Feb 2001) | 2 lines - * AUTHORS, Makefile.am, README, THANKS, TODO, acconfig.h, - configure.in, doc/Makefile.am, doc/tinc.conf.5, doc/tinc.texi, - lib/Makefile.am, lib/utils.c, lib/utils.h, lib/xalloc.h, - lib/xmalloc.c, po/POTFILES.in, po/nl.po, redhat/tinc.spec, - src/Makefile.am, src/conf.c, src/conf.h, src/encr.c, src/encr.h, - src/genauth.c, src/net.c, src/net.h, src/netutl.c, src/netutl.h, - src/protocol.c, src/protocol.h, src/tincd.c: Bring head revision up - to date with cabal (try #3) +FreeBSD compile fixes (thanks to XeF4) -2000-10-18 21:44 Ivo Timmermans +------------------------------------------------------------------------ +r574 | zarq | 2001-01-18 14:02:34 +0100 (Thu, 18 Jan 2001) | 2 lines - * THANKS, configure.in: Get the head revision up to date with cabal +Unpack sample-config.tar.gz when installing -2000-10-17 12:15 Ivo Timmermans +------------------------------------------------------------------------ +r573 | zarq | 2001-01-18 14:01:42 +0100 (Thu, 18 Jan 2001) | 2 lines - * lib/xmalloc.c: Don't declare cp_file and cp_line in xmalloc() +Distribute the sample config as a .tar.gz -2000-10-17 12:14 Ivo Timmermans +------------------------------------------------------------------------ +r572 | zarq | 2001-01-18 14:00:57 +0100 (Thu, 18 Jan 2001) | 2 lines - * doc/Makefile.am: Process subdir es/ +Fixed some errors -2000-10-16 21:04 Guus Sliepen +------------------------------------------------------------------------ +r570 | zarq | 2001-01-17 02:48:44 +0100 (Wed, 17 Jan 2001) | 2 lines - * src/: connlist.c, net.c, protocol.c: - - More fixing. Tinc daemons can now even create activated - connections. +Get the PO files up to date with the current source -2000-10-16 18:33 Guus Sliepen +------------------------------------------------------------------------ +r569 | zarq | 2001-01-17 02:47:39 +0100 (Wed, 17 Jan 2001) | 2 lines - * lib/utils.c, src/conf.c, src/connlist.c, src/net.c, - src/protocol.c: - - Fixing little things - - Two tinc daemons can connect to eachother now (but they disconnect - right after the ACKs). +Get the Debian changelog up to date -2000-10-16 13:35 Ivo Timmermans +------------------------------------------------------------------------ +r568 | zarq | 2001-01-17 02:40:46 +0100 (Wed, 17 Jan 2001) | 2 lines - * configure.in: Output doc/es/Makefile +Merged documentation with various updates I had lying around -2000-10-15 22:30 Guus Sliepen +------------------------------------------------------------------------ +r567 | zarq | 2001-01-17 02:34:08 +0100 (Wed, 17 Jan 2001) | 2 lines - * src/net.c: Corrected #ifdefs for tun/tap support. +Second draft of the release notes -2000-10-15 22:21 Ivo Timmermans +------------------------------------------------------------------------ +r566 | zarq | 2001-01-17 02:31:56 +0100 (Wed, 17 Jan 2001) | 2 lines - * m4/tuntap.m4: Really #include the if_tun.h files now +Change version to 1.0pre4 -2000-10-15 22:13 Ivo Timmermans +------------------------------------------------------------------------ +r565 | zarq | 2001-01-17 02:30:32 +0100 (Wed, 17 Jan 2001) | 2 lines - * m4/tuntap.m4: Linearized checks for if_tun.h +Set Architecture to `any' -2000-10-15 21:53 Ivo Timmermans +------------------------------------------------------------------------ +r564 | zarq | 2001-01-17 02:30:05 +0100 (Wed, 17 Jan 2001) | 2 lines - * src/net.c: Wrap the tun/tap code in #ifdef HAVE_TUNTAP +Fix error reporting of read_config -2000-10-15 19:26 Ivo Timmermans +------------------------------------------------------------------------ +r563 | guus | 2001-01-13 17:36:23 +0100 (Sat, 13 Jan 2001) | 6 lines - * m4/tuntap.m4: file tuntap.m4 was initially added on branch CABAL. +- Allow ASN1 style keys to be in the config files. + Note: tinc ignores private key in the main config file, tinc.conf, + because it should really be in a separate file. +- When generating new keys, check if name is known and by default append + the public key to the host configuration file (otherwise rsa_key.pub). -2000-10-15 19:26 Ivo Timmermans +------------------------------------------------------------------------ +r562 | guus | 2001-01-13 15:56:46 +0100 (Sat, 13 Jan 2001) | 2 lines - * acconfig.h, configure.in, m4/tuntap.m4: Add checks for the - presence of the universal tun/tap device driver. +- Copy entire sample-config directory to /etc/tinc/example upon installing. -2000-10-15 02:59 Guus Sliepen +------------------------------------------------------------------------ +r561 | guus | 2001-01-13 15:38:18 +0100 (Sat, 13 Jan 2001) | 2 lines - * lib/utils.c, lib/utils.h, po/POTFILES.in, po/es.po, po/nl.po, - src/conf.c, src/conf.h, src/connlist.c, src/genauth.c, src/meta.c, - src/net.c, src/net.h, src/protocol.c, src/protocol.h, src/subnet.c, - src/tincd.c: - - The daemon actually runs now (somewhat) - - Added support for tun/tap driver (autodetect!) - - More sophisticated checkpoint functionality - - Updated dutch translation +Added sample configuration directory. -2000-10-15 00:22 Ivo Timmermans +------------------------------------------------------------------------ +r552 | guus | 2001-01-11 12:19:08 +0100 (Thu, 11 Jan 2001) | 2 lines - * doc/tinc.texi: Add CVS id lines +- Only send out DEL_HOSTs for hosts with a meta connection -2000-10-15 00:17 Ivo Timmermans +------------------------------------------------------------------------ +r551 | guus | 2001-01-08 22:32:30 +0100 (Mon, 08 Jan 2001) | 2 lines - * doc/tinc.texi: Fix `Requirements'-section for GMP and OpenSSL - libraries. +- Cleaned up subnet_t -2000-10-14 19:04 Guus Sliepen +------------------------------------------------------------------------ +r550 | guus | 2001-01-08 22:32:00 +0100 (Mon, 08 Jan 2001) | 2 lines - * lib/utils.c, lib/utils.h, src/conf.c, src/conf.h, src/connlist.c, - src/connlist.h, src/net.c, src/net.h, src/protocol.c, src/tincd.c: - - Second fixing-things pass: it even links now. - - Lots of FIXME comments added to the source code. +- Sign was wrong in search_closest_smaller/greater -2000-10-14 01:34 Ivo Timmermans +------------------------------------------------------------------------ +r549 | guus | 2001-01-08 21:35:30 +0100 (Mon, 08 Jan 2001) | 2 lines - * configure.in: Don't look for GMP header files +- Squashed another nasty bug. -2000-10-14 01:30 Ivo Timmermans +------------------------------------------------------------------------ +r548 | guus | 2001-01-07 21:19:35 +0100 (Sun, 07 Jan 2001) | 2 lines - * README: Updated new requirements, pointers to the manual +- Added indirectdata and tcponly functionality. -2000-10-14 01:29 Ivo Timmermans +------------------------------------------------------------------------ +r547 | guus | 2001-01-07 21:19:08 +0100 (Sun, 07 Jan 2001) | 2 lines - * configure.in: Link with OpenSSL, forget libGMP +- Fixed IPv6 subnet lookup routine. -2000-10-12 00:00 Guus Sliepen +------------------------------------------------------------------------ +r546 | guus | 2001-01-07 18:09:07 +0100 (Sun, 07 Jan 2001) | 2 lines - * lib/xalloc.h, src/conf.c, src/conf.h, src/connlist.c, - src/connlist.h, src/meta.c, src/net.c, src/net.h, src/netutl.c, - src/netutl.h, src/protocol.c, src/protocol.h, src/subnet.c, - src/subnet.h, src/tincd.c: - - Fixing-things pass: every source file compiles into an object file - now, but linking tincd does not work yet (must link with openssl - libs and define some missing functions). +- It's 2001, all copyright notices are updated. -2000-10-11 15:42 Guus Sliepen +------------------------------------------------------------------------ +r545 | guus | 2001-01-07 18:08:03 +0100 (Sun, 07 Jan 2001) | 2 lines - * src/: conf.c, conf.h, protocol.c: - - Generalized config file parsing to support multiple configuration - trees. +- Description of protocol and authentication updated. -2000-10-11 14:07 Guus Sliepen +------------------------------------------------------------------------ +r544 | guus | 2001-01-07 16:27:30 +0100 (Sun, 07 Jan 2001) | 3 lines - * src/genauth.c: - - Changed genauth to produce rsa keypairs instead of random - passphrases. +- Added header file for route.c. The routing routines in it are not used + yet, but have a look at the source for the ideas behind it. -2000-10-11 12:35 Guus Sliepen +------------------------------------------------------------------------ +r543 | guus | 2001-01-07 16:25:49 +0100 (Sun, 07 Jan 2001) | 2 lines - * src/connlist.h: file connlist.h was initially added on branch - CABAL. +- Reinstated a queue for outgoing packets. -2000-10-11 12:35 Guus Sliepen +------------------------------------------------------------------------ +r542 | guus | 2001-01-07 16:24:52 +0100 (Sun, 07 Jan 2001) | 3 lines - * src/connlist.c: file connlist.c was initially added on branch - CABAL. +- Changed list routines to give it the same look'n'feel as the rbl and + avl tree library. -2000-10-11 12:35 Guus Sliepen +------------------------------------------------------------------------ +r540 | guus | 2001-01-06 21:43:03 +0100 (Sat, 06 Jan 2001) | 2 lines - * AUTHORS, Makefile.am, configure.in, src/Makefile.am, - src/connlist.c, src/connlist.h, src/encr.h, src/meta.c, src/meta.h, - src/net.c, src/net.h, src/netutl.c, src/netutl.h, src/protocol.h, - src/subnet.c, src/subnet.h: Big and bad commit of my current - tree... - - Added seperate file for connection list handling - - Updating everything to use connlist, meta and subnet files - - Removed dependency on libgmp - - Lots of other stuff... +- Typo. -2000-10-01 05:21 Guus Sliepen +------------------------------------------------------------------------ +r539 | guus | 2001-01-06 21:02:21 +0100 (Sat, 06 Jan 2001) | 2 lines - * src/subnet.c: file subnet.c was initially added on branch CABAL. +- Updated texinfo manual. -2000-10-01 05:21 Guus Sliepen +------------------------------------------------------------------------ +r538 | guus | 2001-01-06 19:44:55 +0100 (Sat, 06 Jan 2001) | 2 lines - * src/: meta.h, net.h, subnet.c, subnet.h: - - Added subnet handling code - - Other small changes to header files +- Updated manual pages. -2000-10-01 05:21 Guus Sliepen +------------------------------------------------------------------------ +r537 | guus | 2001-01-06 19:21:17 +0100 (Sat, 06 Jan 2001) | 2 lines - * src/subnet.h: file subnet.h was initially added on branch CABAL. +- Changed license of AVL tree library to GPL. -2000-09-27 22:32 Ivo Timmermans +------------------------------------------------------------------------ +r536 | guus | 2001-01-06 19:03:41 +0100 (Sat, 06 Jan 2001) | 4 lines - * doc/tinc.texi: Many updates, parts rewritten, added, shuffled - around. +- Check and follow symlinks in is_safe_path +- By default write keys to tinc config directory +- Small fix in protocol.c -2000-09-26 16:06 Guus Sliepen +------------------------------------------------------------------------ +r535 | guus | 2001-01-06 17:51:14 +0100 (Sat, 06 Jan 2001) | 2 lines - * src/meta.h: file meta.h was initially added on branch CABAL. +- Updated dutch translation. -2000-09-26 16:06 Guus Sliepen +------------------------------------------------------------------------ +r534 | guus | 2001-01-06 00:53:53 +0100 (Sat, 06 Jan 2001) | 4 lines - * src/meta.c: file meta.c was initially added on branch CABAL. +- Let user choose whether keys are in the config files or separate +- Use AVL trees instead of RBL trees +- Fixed a lot of annoying subtle bugs! Thanks to gdb... -2000-09-26 16:06 Guus Sliepen +------------------------------------------------------------------------ +r533 | guus | 2001-01-06 00:51:41 +0100 (Sat, 06 Jan 2001) | 2 lines - * src/: meta.c, meta.h, net.c, protocol.c, protocol.h: - - Added meta.c which contains functions to send, receive and - broadcast metadata. It will also handle encryption and decryption, - and possibly compression and checksumming. - - Moved request dispatcher to protocol.c. +- Doubled size of trace buffer for easier debugging. -2000-09-25 22:08 Guus Sliepen +------------------------------------------------------------------------ +r532 | guus | 2001-01-06 00:50:56 +0100 (Sat, 06 Jan 2001) | 2 lines - * doc/SECURITY: - - Very detailed example of the authentication phase. +- AVL tree routines: faster than RBL, and also more stable. -2000-09-22 18:20 Guus Sliepen +------------------------------------------------------------------------ +r529 | guus | 2000-12-22 22:34:24 +0100 (Fri, 22 Dec 2000) | 4 lines - * src/: net.c, protocol.c: - - Removed options "string" stuff. It was a bad idea... - - free() everything that is allocated. +- Don't even think about using sscanf with %as anymore +- Allow keys to be inside the config files or in a seperate file +- Small fixes -2000-09-22 17:06 Guus Sliepen +------------------------------------------------------------------------ +r528 | zarq | 2000-12-22 18:15:26 +0100 (Fri, 22 Dec 2000) | 2 lines - * src/protocol.c: - - Severe code reduction and simplification of challenge requests - - "Finished" [add|del]_subnet_h - - Added lots of sanity checks to [add|del]_host_h +Added lint target, requires lclint. -2000-09-17 23:42 Guus Sliepen +------------------------------------------------------------------------ +r527 | zarq | 2000-12-22 18:10:25 +0100 (Fri, 22 Dec 2000) | 2 lines - * src/protocol.c: - - Updated authentication scheme. - - Removed all trailing spaces from all lines. - - Added things to add_ and del_subnet_h. +Forget router.c -2000-09-17 22:11 Guus Sliepen +------------------------------------------------------------------------ +r526 | zarq | 2000-12-22 17:59:16 +0100 (Fri, 22 Dec 2000) | 2 lines - * doc/SECURITY: - - Included authentication scheme from protocol.c - - Added a few comments about the symmetric cipher. +Include autogen.sh (needed for the Debian package). -2000-09-17 21:57 Guus Sliepen +------------------------------------------------------------------------ +r525 | zarq | 2000-12-22 17:54:56 +0100 (Fri, 22 Dec 2000) | 2 lines - * doc/SECURITY: Added document about the used cryptographic - algorithms and the reasons behind them. Feel very free to comment on - this! +Various small changes. -2000-09-17 21:57 Guus Sliepen +------------------------------------------------------------------------ +r524 | zarq | 2000-12-06 14:33:49 +0100 (Wed, 06 Dec 2000) | 2 lines - * doc/SECURITY: file SECURITY was initially added on branch CABAL. +Re-introduced MyVirtualIP and VpnMask, as dummy options. -2000-09-17 12:28 Ivo Timmermans +------------------------------------------------------------------------ +r523 | zarq | 2000-12-05 10:04:32 +0100 (Tue, 05 Dec 2000) | 2 lines - * doc/es/: tinc-es.html, tinc_toc-es.html: Added Spanish - translation of the docs by Matias Carrasco +Give a warning about having to re-create the keys -2000-09-17 12:28 Ivo Timmermans +------------------------------------------------------------------------ +r522 | zarq | 2000-12-05 10:03:41 +0100 (Tue, 05 Dec 2000) | 2 lines - * doc/es/tinc_toc-es.html: file tinc_toc-es.html was initially - added on branch CABAL. +Ported it back to /bin/sh. -2000-09-17 12:28 Ivo Timmermans +------------------------------------------------------------------------ +r521 | zarq | 2000-12-05 10:03:19 +0100 (Tue, 05 Dec 2000) | 3 lines - * doc/es/tinc-es.html: file tinc-es.html was initially added on - branch CABAL. +Install a file in /etc/modutils/tinc, containing all necessary aliases +and options for kernel modules. -2000-09-15 14:58 Ivo Timmermans +------------------------------------------------------------------------ +r520 | zarq | 2000-12-05 09:59:30 +0100 (Tue, 05 Dec 2000) | 2 lines - * src/: encr.c, net.c, net.h, netutl.c, protocol.c: Second round of - fixes +Tiny bits of code beautifying -2000-09-14 23:51 Ivo Timmermans +------------------------------------------------------------------------ +r518 | zarq | 2000-12-05 09:56:44 +0100 (Tue, 05 Dec 2000) | 2 lines - * src/: net.c, net.h, netutl.c, protocol.c: First round of needed - fixes after the overhaul +Oops. I did some VERY wrong things with readline(). Fixed now. -2000-09-14 16:34 Ivo Timmermans +------------------------------------------------------------------------ +r517 | zarq | 2000-12-05 09:54:22 +0100 (Tue, 05 Dec 2000) | 3 lines - * src/: conf.c, conf.h: New directive: Name. +Massive long awaited documentation update. It's not finished yet, +most notably the example configuration is still old. -2000-09-14 16:32 Ivo Timmermans +------------------------------------------------------------------------ +r516 | zarq | 2000-12-03 13:23:06 +0100 (Sun, 03 Dec 2000) | 2 lines - * lib/utils.h, src/net.h: Added some structures and types that are - needed for the overhaul. +Option -d accepts an argument to set the debug level immediately. -2000-09-14 13:54 Guus Sliepen +------------------------------------------------------------------------ +r515 | zarq | 2000-12-03 13:22:19 +0100 (Sun, 03 Dec 2000) | 2 lines - * src/: net.c, protocol.c: - - Lots of small changes. +Sort configuration directives -2000-09-11 13:40 Ivo Timmermans +------------------------------------------------------------------------ +r514 | zarq | 2000-12-03 13:21:20 +0100 (Sun, 03 Dec 2000) | 2 lines - * configure.in: Better checks for SunOS libraries +Added documentation merger -2000-09-11 12:05 Guus Sliepen +------------------------------------------------------------------------ +r513 | zarq | 2000-12-01 14:46:26 +0100 (Fri, 01 Dec 2000) | 2 lines - * src/: protocol.c, protocol.h: - - Fixed modulo in keylength check - - Updated header file to reflect new protocol code +Include COPYING.README in the distribution. -2000-09-11 01:11 Guus Sliepen +------------------------------------------------------------------------ +r512 | zarq | 2000-12-01 14:45:46 +0100 (Fri, 01 Dec 2000) | 3 lines - * src/protocol.c: - - Some key exchange stuff. (Last commit before going to bed.) +Stated that distributing executables linked with OpenSSL is permitted +provided that all other requirements of the GPL are complied with. -2000-09-11 00:49 Guus Sliepen +------------------------------------------------------------------------ +r510 | zarq | 2000-12-01 13:38:42 +0100 (Fri, 01 Dec 2000) | 3 lines - * src/protocol.c: - - Lots of functions added for the new protocol. +Use buffer instead of line in read_config_file(), line may be assigned +NULL, so buffer always holds the pointer to the allocated space. -2000-09-10 23:57 Ivo Timmermans +------------------------------------------------------------------------ +r509 | zarq | 2000-12-01 13:36:36 +0100 (Fri, 01 Dec 2000) | 3 lines - * src/protocol.h: Add Guus' name and shift out old protocol - requests +readline() accepts two extra parameters, buf and buflen, to avoid +mallocing and freeing for every line that is read. -2000-09-10 20:37 Ivo Timmermans +------------------------------------------------------------------------ +r508 | zarq | 2000-12-01 00:44:07 +0100 (Fri, 01 Dec 2000) | 2 lines - * doc/tinc.texi: Correct filenames for passphrases given in the - example +Tagged `Storing private key in separate file' as done. -2000-09-10 18:15 Guus Sliepen +------------------------------------------------------------------------ +r507 | zarq | 2000-12-01 00:39:55 +0100 (Fri, 01 Dec 2000) | 2 lines - * src/protocol.c: - - Added more function skeletons for the new protocol. +All full stops have two spaces after them. (Silly commit, I know.) -2000-09-10 17:18 Guus Sliepen +------------------------------------------------------------------------ +r506 | zarq | 2000-12-01 00:18:21 +0100 (Fri, 01 Dec 2000) | 4 lines - * src/protocol.c: - - New protocol. Will break everything else for now. +New function read_rsa_public_key(); +In net.c/setup_myself deleted old code to read the public key (which +is now implicitly read in together with the private key). -2000-09-10 17:16 Ivo Timmermans +------------------------------------------------------------------------ +r505 | zarq | 2000-11-30 23:48:48 +0100 (Thu, 30 Nov 2000) | 2 lines - * configure.in: Support for -lsocket and -lnsl on SunOS +Avoid printing duplicate messages from read_rsa_keys -2000-09-10 17:07 Ivo Timmermans +------------------------------------------------------------------------ +r504 | zarq | 2000-11-30 23:33:16 +0100 (Thu, 30 Nov 2000) | 2 lines - * doc/PROTOCOL: Updated text, removed protocol flowchart +Better error checking when reading the RSA private key. -2000-09-10 17:05 Ivo Timmermans +------------------------------------------------------------------------ +r503 | zarq | 2000-11-30 23:32:14 +0100 (Thu, 30 Nov 2000) | 4 lines - * configure.in: Link with OpenSSL crypto libraries instead of own - blowfish library +In readline(): initialise the line to zero length; +In read_config_file(): Test for EOF, and print the variable name that +caused an error. -2000-09-06 13:49 Guus Sliepen +------------------------------------------------------------------------ +r502 | zarq | 2000-11-30 22:11:03 +0100 (Thu, 30 Nov 2000) | 2 lines - * src/: conf.c, net.c, netutl.c, tincd.c: - - Use strerror() instead of sys_errlist[] for increased portability - (Needed for SunOS) +The file is safe if it doesn't exist. -2000-08-27 13:05 Ivo Timmermans +------------------------------------------------------------------------ +r501 | zarq | 2000-11-30 21:08:41 +0100 (Thu, 30 Nov 2000) | 6 lines - * Makefile.am: Changed CVSROOT path in `make ChangeLog' +Read the PEM file pointed to by the configuration directive +PrivateKey. This means thatt he meaning of this variable has changed, +it no longer should contain the private key directly. -2000-08-21 22:35 Ivo Timmermans +WARNING: This code is untested. - * Makefile.am: Added a rule to create an rpm +------------------------------------------------------------------------ +r500 | zarq | 2000-11-30 01:24:13 +0100 (Thu, 30 Nov 2000) | 4 lines -2000-08-21 14:50 Guus Sliepen +Implemented is_safe_path, and extended ask_and_safe_open. - * doc/tinc.conf.5: Updated tinc.conf manual. +is_safe_path needs more work before it is useable. -2000-08-18 16:45 Guus Sliepen +------------------------------------------------------------------------ +r499 | zarq | 2000-11-29 16:22:04 +0100 (Wed, 29 Nov 2000) | 2 lines - * doc/tinc.texi: Updated the manual: - - incorporated comments from Stefan Hartsuiker - - updated configuration variables section - - added some text about key types +Updated Dutch translation -2000-08-18 13:17 Guus Sliepen +------------------------------------------------------------------------ +r498 | zarq | 2000-11-29 15:30:07 +0100 (Wed, 29 Nov 2000) | 2 lines - * src/encr.c: Commented on some size calculations. +Also free the pointer returned by readline(). -2000-08-17 19:22 Guus Sliepen +------------------------------------------------------------------------ +r497 | zarq | 2000-11-29 15:27:24 +0100 (Wed, 29 Nov 2000) | 2 lines - * po/: es.po, nl.po: Ran update-po and updated dutch translation. +Use readline() in read_config_file() instead of fgets. -2000-08-17 18:51 Guus Sliepen +------------------------------------------------------------------------ +r496 | zarq | 2000-11-29 15:23:08 +0100 (Wed, 29 Nov 2000) | 2 lines - * src/: encr.c, netutl.c, tincd.c: Fixed all sprintf() spl01ts. +xstrdup now takes a const pointer as an argument. -2000-08-09 16:02 Guus Sliepen +------------------------------------------------------------------------ +r495 | zarq | 2000-11-29 15:24:40 +0100 (Wed, 29 Nov 2000) | 5 lines - * src/: conf.c, conf.h, net.c: - - Added two extra configuration options, Interface and InterfaceIP, - to bind the listen socket to a network device or a specific IP. +Implemented a readline() function that will read an entire line into a +dynamically allocated buffer; -2000-08-09 11:34 Guus Sliepen +Ask for a file name in ask_and_safe_open(). - * src/net.c: - - Reinstated O_NONBLOCK for meta socket - - Set SO_KEEPALIVE on meta socket +------------------------------------------------------------------------ +r494 | zarq | 2000-11-29 02:37:50 +0100 (Wed, 29 Nov 2000) | 2 lines -2000-08-08 19:07 Guus Sliepen +Added a check for a scanf that knows about %as. - * src/: net.c, net.h, protocol.c: - - Moved TCP packet reception to meta handler: less kludgy and less - buggy! +------------------------------------------------------------------------ +r492 | zarq | 2000-11-29 01:33:15 +0100 (Wed, 29 Nov 2000) | 3 lines -2000-08-08 16:54 Guus Sliepen +Check for get_current_dir_name. There is a replacement function in +dropin.c. - * src/tincd.c: - - Added date/time of build and protocol number to --version output. +------------------------------------------------------------------------ +r491 | zarq | 2000-11-29 00:23:41 +0100 (Wed, 29 Nov 2000) | 3 lines -2000-08-08 15:47 Guus Sliepen +dropin.c/h contain a set of drop-in replacements for non-standard C +library functions (read: GNU extensions). - * src/: net.c, protocol.c: Removed calling add_queue for tcponly - packets. +------------------------------------------------------------------------ +r488 | zarq | 2000-11-29 00:12:57 +0100 (Wed, 29 Nov 2000) | 3 lines -2000-08-08 10:48 Guus Sliepen +Save RSA public and private keys to a separate file, instead of +wanting to copy them into a configuration file. - * src/protocol.c: Fixed PACKET read loop. +------------------------------------------------------------------------ +r487 | zarq | 2000-11-28 09:59:27 +0100 (Tue, 28 Nov 2000) | 4 lines -2000-08-07 18:27 Guus Sliepen +Use sigaction to set signal handlers, the previous commit (1.1.2.16) +already contained a large portion of what should have gone in this +one. - * src/: conf.h, net.c, net.h, protocol.c, protocol.h: - - Lots o' buglets fixed (-Wall helps) - - Made TCPonly work :) +------------------------------------------------------------------------ +r486 | zarq | 2000-11-27 21:52:55 +0100 (Mon, 27 Nov 2000) | 2 lines -2000-08-07 16:52 Guus Sliepen +Sort items to either 1.0 or future release goals. - * src/: conf.c, conf.h, net.c, net.h, protocol.c, protocol.h: - - Added experimental hackish tunneling-over-TCP support. - Just use TCPonly = true in the configuration file. +------------------------------------------------------------------------ +r485 | zarq | 2000-11-26 23:46:53 +0100 (Sun, 26 Nov 2000) | 3 lines -2000-07-02 15:40 Guus Sliepen +Check for the function strsignal, and define it to "" if it is not +available. - * src/net.c: - - Fixed typo. +------------------------------------------------------------------------ +r484 | zarq | 2000-11-26 23:42:34 +0100 (Sun, 26 Nov 2000) | 2 lines -2000-07-02 15:36 Guus Sliepen +Give an error message if daemon() failed. - * src/: conf.c, net.c: - - Delayed address resolving for ConnectTo lines in configuration - file to allow DynDNS to work without restarting tincd. +------------------------------------------------------------------------ +r483 | zarq | 2000-11-26 23:32:52 +0100 (Sun, 26 Nov 2000) | 2 lines -2000-07-02 14:48 Guus Sliepen +Updated Spanish translation, provided by Enrique Zanardi. - * THANKS: - - Updated THANKS file +------------------------------------------------------------------------ +r482 | guus | 2000-11-25 14:33:33 +0100 (Sat, 25 Nov 2000) | 4 lines -2000-07-02 14:41 Ivo Timmermans +- Use only one socket for all UDP traffic (for compatibility) +- Write pidfile again after detaching +- Check OS (for handling FreeBSD/Solaris tun/tap stuff) - * configure.in: Include the Spanish translation in the - distribution/build process. +------------------------------------------------------------------------ +r481 | guus | 2000-11-25 00:30:50 +0100 (Sat, 25 Nov 2000) | 2 lines -2000-07-02 14:35 Guus Sliepen +- Added daemon() replacement. - * po/es.po: file es.po was initially added on branch CABAL. +------------------------------------------------------------------------ +r478 | guus | 2000-11-25 00:14:52 +0100 (Sat, 25 Nov 2000) | 2 lines -2000-07-02 14:35 Guus Sliepen +- Added Armijn to the list - * po/es.po: - - Added Spanish translation from Enrique Zanardi. +------------------------------------------------------------------------ +r477 | guus | 2000-11-25 00:13:07 +0100 (Sat, 25 Nov 2000) | 11 lines -2000-07-01 16:40 Guus Sliepen +Another big & bad commit: +- Added some extra search functions to rbl routines +- Fix subnet_lookup() +- Reorder some syslog messages to make more sense +- daemon() is back +- Don't let scripts execute in parallel (gives race conditions, and + anyway something MIGHT just be configured which is necessary for further + execution of tinc itself) +- Accidently merged check_child() with execute_script(). +- Small fixes - * doc/tincd.8: - - Forgot to mention ourselves in the tincd manual page! :) +------------------------------------------------------------------------ +r476 | zarq | 2000-11-24 17:52:57 +0100 (Fri, 24 Nov 2000) | 3 lines -2000-07-01 16:32 Guus Sliepen +Add default tinc-up and tinc-down scripts for a Debian system. These +do not yet work, it's just old code from init.d. - * doc/: Makefile.am, PROTOCOL, tincd.8, tincd.x: - - Updated PROTOCOL (a bit) - - Included a real tincd.8 describing the options, signals, debug - levels and files used by tincd. +------------------------------------------------------------------------ +r473 | zarq | 2000-11-24 15:15:20 +0100 (Fri, 24 Nov 2000) | 4 lines -2000-07-01 16:32 Guus Sliepen +Call autogen.sh instead of configure alone; and make cvs-clean instead +of distclean. This way you can just cvs checkout && dpkg-buildpackage +in one go. - * doc/tincd.8: file tincd.8 was initially added on branch CABAL. +------------------------------------------------------------------------ +r472 | zarq | 2000-11-24 15:13:51 +0100 (Fri, 24 Nov 2000) | 2 lines -2000-07-01 12:39 Ivo Timmermans +Explain how to tell configure where OpenSSL lives. - * po/Makefile.in.in: Autogenerated by gettextize. +------------------------------------------------------------------------ +r471 | zarq | 2000-11-24 15:13:06 +0100 (Fri, 24 Nov 2000) | 2 lines -2000-07-01 09:49 Guus Sliepen +Set errno to 0 before trying to kill the other process. - * src/net.h: - - Removed a single unused bit from status_bits_t. +------------------------------------------------------------------------ +r470 | zarq | 2000-11-24 15:12:31 +0100 (Fri, 24 Nov 2000) | 3 lines -2000-07-01 09:29 Wessel Dankers +Alter CFLAGS, somehow INCLUDES doesn't propagate properly. Still +doesn't work exactly like it should, but getting there. - * doc/HOWTO: Added architecture section, made a start with the - kernel section. ToDo: install tinc myself to see if everything is - as I say =) +------------------------------------------------------------------------ +r469 | zarq | 2000-11-24 15:04:49 +0100 (Fri, 24 Nov 2000) | 2 lines -2000-07-01 00:38 Guus Sliepen +Set CFLAGS to -O2 -Wall when running configure - * doc/PROTOCOL: file PROTOCOL was initially added on branch CABAL. +------------------------------------------------------------------------ +r468 | zarq | 2000-11-24 15:00:32 +0100 (Fri, 24 Nov 2000) | 2 lines -2000-07-01 00:38 Guus Sliepen +Use cvs2cl instead of rcs2log to generate the ChangeLog. - * doc/PROTOCOL: - - Added documentation for the protocols (most important the meta - protocol) used by tinc. +------------------------------------------------------------------------ +r467 | zarq | 2000-11-24 15:03:13 +0100 (Fri, 24 Nov 2000) | 2 lines -2000-06-30 23:16 Wessel Dankers +Set localstatedir to /var - * doc/HOWTO: Grrr, recommit +------------------------------------------------------------------------ +r465 | zarq | 2000-11-24 14:33:48 +0100 (Fri, 24 Nov 2000) | 3 lines -2000-06-30 23:11 Wessel Dankers +Do not attempt to retreive ChangeLog information only from the CABAL +tag, it doesn't work anyway. - * doc/HOWTO: This file is now only in the CABAL revision. +------------------------------------------------------------------------ +r464 | zarq | 2000-11-24 14:32:26 +0100 (Fri, 24 Nov 2000) | 2 lines -2000-06-30 23:09 Wessel Dankers +Do not check for the daemon() system call - * doc/HOWTO: More about keys +------------------------------------------------------------------------ +r463 | zarq | 2000-11-24 13:44:39 +0100 (Fri, 24 Nov 2000) | 2 lines -2000-06-30 23:03 Guus Sliepen +Do not use the C library's daemon() call. - * src/: encr.c, net.c, protocol.c: - - Made tinc even more silent if no -d flag is given at all. +------------------------------------------------------------------------ +r462 | guus | 2000-11-23 10:30:33 +0100 (Thu, 23 Nov 2000) | 4 lines -2000-06-30 22:57 Wessel Dankers +- Don't link with -ldl anymore +- Let's not use bash' built-in pwd function anymore... it does not follow + symlinks. - * doc/HOWTO: Added extra bit about keys. +------------------------------------------------------------------------ +r461 | guus | 2000-11-23 00:09:38 +0100 (Thu, 23 Nov 2000) | 2 lines -2000-06-30 22:50 Wessel Dankers +- #include instead of - * doc/HOWTO: File added to CABAL (hopefully) +------------------------------------------------------------------------ +r460 | guus | 2000-11-22 23:18:03 +0100 (Wed, 22 Nov 2000) | 2 lines -2000-06-30 22:42 Wessel Dankers +- Fixed all (except 2) compiler warnings gcc -Wall gave. - * doc/HOWTO: added bit on config file, split up sections, added Id: - tag +------------------------------------------------------------------------ +r459 | guus | 2000-11-22 23:05:37 +0100 (Wed, 22 Nov 2000) | 2 lines -2000-06-30 22:16 Wessel Dankers +- More porting to FreeBSD and Solaris. - * doc/HOWTO: Initial revision. Lots of loose ends, not usable yet. +------------------------------------------------------------------------ +r458 | guus | 2000-11-22 21:25:27 +0100 (Wed, 22 Nov 2000) | 2 lines -2000-06-30 14:41 Guus Sliepen +- Work with the correct key buffer in ans_key_h - * po/nl.po, src/net.c, src/protocol.c: - - Instead of logging an error when remote end closes the connection, - we print a nice message if appropiate debug level is set. - - If we get ADD_HOSTs or DEL_HOSTs for ourself, then connection - lists are really messed up. We restart, and hope our problems go - away. +------------------------------------------------------------------------ +r457 | guus | 2000-11-22 20:55:53 +0100 (Wed, 22 Nov 2000) | 2 lines -2000-06-30 13:45 Guus Sliepen +- No more %as. - * po/nl.po, src/conf.c, src/conf.h, src/net.c, src/tincd.c: - - Removed segfault bug in conf.c (must have been there for ages!) - - Made main_loop() signal proof - - #defined MAXTIMEOUT (15 minutes) - - If something really really bad happens, close all connections, - wait for MAXTIMEOUT seconds, and then restart tinc +------------------------------------------------------------------------ +r456 | guus | 2000-11-22 20:14:09 +0100 (Wed, 22 Nov 2000) | 3 lines -2000-06-29 21:47 Guus Sliepen +- Write pidfile AFTER detaching... +- Minor cleanups - * po/nl.po, src/conf.c, src/conf.h, src/net.c, src/protocol.c, - src/tincd.c: - - Fixed memory leak. - - Implemented SIGHUP configuration file reloading. - - Other small changes. +------------------------------------------------------------------------ +r455 | guus | 2000-11-22 19:54:08 +0100 (Wed, 22 Nov 2000) | 4 lines -2000-06-29 19:09 Guus Sliepen +- Cleaned up and checked for some more NULL pointers in rbl.c +- Two connection lists: one for incoming connections, sorted on ip/port, + one for connections whose identity we know, sorted on id ofcourse... - * po/nl.po, src/net.c, src/netutl.c, src/protocol.c, - src/protocol.h, src/tincd.c: - - New semantics for BASIC_INFO, ADD_HOST and DEL_HOST requests. This - will improve connection list consistency, ensures the tree property, - and allows for recovery from situations where track of connections - is lost. +------------------------------------------------------------------------ +r454 | zarq | 2000-11-22 18:49:16 +0100 (Wed, 22 Nov 2000) | 2 lines -2000-06-29 15:04 Guus Sliepen +Declare fd. - * po/nl.po, src/net.c, src/net.h, src/netutl.c, src/protocol.c: - - Removed all IP_ADDR_S macros, because gettext doesn't like them. - Each connection now has two hostnames: real_hostname (replacing the - old), and vpn_hostname. In those places where hostnames really - aren't usefull IP_ADDR_S has been replaced by %d.%d.%d.%d. +------------------------------------------------------------------------ +r453 | zarq | 2000-11-22 18:48:15 +0100 (Wed, 22 Nov 2000) | 3 lines -2000-06-29 09:11 Guus Sliepen +Add more checks to ensure that filedescriptors are right in +_execute_script(). - * po/nl.po: - - Updated Dutch translation. +------------------------------------------------------------------------ +r452 | zarq | 2000-11-22 17:19:07 +0100 (Wed, 22 Nov 2000) | 2 lines -2000-06-28 23:06 Ivo Timmermans +Honor the --localstatedir option to configure, instead of hardcoded /var. - * po/nl.po: Oops, and mention Guus too. +------------------------------------------------------------------------ +r451 | guus | 2000-11-21 10:13:59 +0100 (Tue, 21 Nov 2000) | 3 lines -2000-06-28 23:01 Ivo Timmermans +- Check for NULL tree->delete callback +- Add xstrdup() function - * po/nl.po: Removed Free Software Foundation copyright, because - Guus Sliepen contributed significantly. +------------------------------------------------------------------------ +r450 | guus | 2000-11-21 00:29:47 +0100 (Tue, 21 Nov 2000) | 2 lines -2000-06-28 16:34 Guus Sliepen +- More fixes. - * po/nl.po, src/tincd.c: - - Added log message when SIGCHLD is received ("thanks" to Ivo van - Dong) +------------------------------------------------------------------------ +r449 | guus | 2000-11-20 23:13:14 +0100 (Mon, 20 Nov 2000) | 2 lines -2000-06-28 15:41 Guus Sliepen +- Various small fixes. - * po/nl.po, src/protocol.c: - - Fixed a message in nl.po - - Woops, we forgot to send our connection list to our uplink when we - connect to it... Fixed. +------------------------------------------------------------------------ +r448 | zarq | 2000-11-20 20:56:01 +0100 (Mon, 20 Nov 2000) | 3 lines -2000-06-28 13:39 Guus Sliepen +Get rid of all libtool references at once. libtool was only used by +libblowfish, which was superseded by openssl. - * po/nl.po: - - Fixed missing " in nl.po +------------------------------------------------------------------------ +r447 | guus | 2000-11-20 20:41:13 +0100 (Mon, 20 Nov 2000) | 2 lines -2000-06-28 13:38 Guus Sliepen +- Proper initialization of rbltree structures. - * po/nl.po, src/protocol.c, src/tincd.c: - - Fixed some spelling errors. - - Paar zpelvautjes gerepareerd, en de Nederlandse vertaling weer bij - de tijd gebracht. +------------------------------------------------------------------------ +r446 | guus | 2000-11-20 20:12:17 +0100 (Mon, 20 Nov 2000) | 2 lines -2000-06-28 12:11 Guus Sliepen +- Integrate rbl trees into tinc. - * src/net.c: - - Extra check op EINTR bij inlezen requests +------------------------------------------------------------------------ +r443 | zarq | 2000-11-20 19:06:17 +0100 (Mon, 20 Nov 2000) | 2 lines -2000-06-27 23:05 Guus Sliepen +Also include process.h - * src/net.c: - - Fixes a silly little insignificant buglet. +------------------------------------------------------------------------ +r442 | zarq | 2000-11-20 19:05:34 +0100 (Mon, 20 Nov 2000) | 2 lines -2000-06-27 22:55 Guus Sliepen +More function and header checks - * src/protocol.c: - - Purge old connections that are ADD_HOSTed. +------------------------------------------------------------------------ +r441 | zarq | 2000-11-20 19:02:15 +0100 (Mon, 20 Nov 2000) | 2 lines -2000-06-27 22:10 Guus Sliepen +Added this release - * src/: conf.c, conf.h, net.c, protocol.c: - - Improved handling of errors on connection attempts. +------------------------------------------------------------------------ +r440 | guus | 2000-11-19 23:12:46 +0100 (Sun, 19 Nov 2000) | 2 lines -2000-06-27 17:08 Guus Sliepen +- Small fixes - * src/: conf.c, conf.h, net.c: - - Fixed indirectdata=no problem - - Added support for multiple ConnectTo lines in tinc.conf. +------------------------------------------------------------------------ +r439 | guus | 2000-11-19 12:05:59 +0100 (Sun, 19 Nov 2000) | 2 lines -2000-06-27 14:58 Guus Sliepen +- Deletion also works now. - * src/protocol.c: - - Fixed KEY_CHANGED notification. A lot of notify_others() calls - were wrong (first two arguments swapped). Should probably be - doublechecked. - - Don't retry to connect to hosts with different protocol versions. +------------------------------------------------------------------------ +r438 | guus | 2000-11-19 03:04:29 +0100 (Sun, 19 Nov 2000) | 2 lines -2000-06-26 22:30 Guus Sliepen +- Fixed a lot of small things. Tested everything except deletions. - * src/: net.c, protocol.c: - - Moved all connection messages to debug level 1, without -d's only - the startup message will be logged. - - Fixed DEL_HOST rebound. +------------------------------------------------------------------------ +r437 | guus | 2000-11-19 00:22:44 +0100 (Sun, 19 Nov 2000) | 2 lines -2000-06-26 21:39 Guus Sliepen +- Fix tree head/tail upon insertion - * src/: net.c, netutl.c, protocol.c: - - Indirectdata finally REALLY REALLY works now! - - More precise debug messages +------------------------------------------------------------------------ +r436 | guus | 2000-11-19 00:21:01 +0100 (Sun, 19 Nov 2000) | 3 lines -2000-06-26 19:20 Guus Sliepen +- Implemented deletions +- Added rbl_foreach() function - * src/: net.c, protocol.c: Fixes some hostlookups. Fixes - indirectdata for real now (hopefully). +------------------------------------------------------------------------ +r435 | guus | 2000-11-18 19:14:57 +0100 (Sat, 18 Nov 2000) | 3 lines -2000-06-25 22:52 Ivo Timmermans +- Fixed searching +- Insertion implemented - * configure.in: Version 1.0pre3. +------------------------------------------------------------------------ +r434 | guus | 2000-11-17 11:03:02 +0100 (Fri, 17 Nov 2000) | 3 lines -2000-06-25 18:39 Guus Sliepen +- Removed stray @INCLUDE@ (how did that get there?) +- Use 0 instead of FALSE - * src/: netutl.c, protocol.c: - - More verbose connection list - - Added "myself" as hostname when logging indirect ADD_HOSTs +------------------------------------------------------------------------ +r433 | guus | 2000-11-17 01:56:49 +0100 (Fri, 17 Nov 2000) | 2 lines -2000-06-25 18:20 Guus Sliepen +- Simplified do_detach - * src/: net.c, protocol.c: Hostlookup() is actually being called - now. +------------------------------------------------------------------------ +r432 | zarq | 2000-11-16 23:13:09 +0100 (Thu, 16 Nov 2000) | 2 lines -2000-06-25 18:01 Guus Sliepen +Use proper prototypes. - * src/: net.c, net.h, netutl.c, protocol.c: Hostnames are back! +------------------------------------------------------------------------ +r431 | zarq | 2000-11-16 23:12:23 +0100 (Thu, 16 Nov 2000) | 2 lines -2000-06-25 17:45 Guus Sliepen +Move more functions from tincd.c into process.c. - * src/protocol.c: - - Log possible spoofing attacks. - - Don't broadcast DEL_HOSTs for hosts that haven't been activated - yet. - - If a host sends a TERMREQ, deactivate them. +------------------------------------------------------------------------ +r430 | zarq | 2000-11-16 23:11:40 +0100 (Thu, 16 Nov 2000) | 2 lines -2000-06-25 17:42 Ivo Timmermans +Delete struct ifr - * configure.in, redhat/tinc.spec: Changed version number to - 1.0pre3. +------------------------------------------------------------------------ +r429 | zarq | 2000-11-16 19:06:39 +0100 (Thu, 16 Nov 2000) | 3 lines -2000-06-25 17:22 Guus Sliepen +New function: xmalloc_and_zero, which initialises the allocated memory +to all zeroes. - * src/: encr.h, net.h, netutl.h, protocol.h: Added CVS Id tags to - header files. +------------------------------------------------------------------------ +r428 | zarq | 2000-11-16 18:54:29 +0100 (Thu, 16 Nov 2000) | 2 lines -2000-06-25 17:16 Guus Sliepen +Move all process-related functions into process.c. - * src/: encr.c, net.c, net.h, netutl.c, protocol.c, tincd.c: Large - cleanup: - - Removed hostname lookup (it blocks, and you can always do it - yourself) - - Reorganized debug levels (after hints from Axel Müller): - 0 Startup message and errors - 1 Connection logging - 2 Meta protocol information - 3 Verbose meta protocol (includes copy of transmitted requests) - 4 Packet information (logs transmission/errors of UDP packets) - 5 Verbose packet information (every single byte, not implemented - yet to protect ourselves from filling up /var/log directories) - - Made log messages more consistent +------------------------------------------------------------------------ +r425 | guus | 2000-11-16 10:18:38 +0100 (Thu, 16 Nov 2000) | 2 lines -2000-06-24 14:35 Guus Sliepen +- Added balanced tree management stuff as well. (It is not finished yet.) - * src/net.c: If we have "indirectdata" flag set, we only send data - to our uplink. +------------------------------------------------------------------------ +r422 | zarq | 2000-11-15 23:07:36 +0100 (Wed, 15 Nov 2000) | 3 lines -2000-06-23 21:27 Guus Sliepen +Keep a list of running children, and in each loop in main_loop(), +check if one has exited. - * TODO, src/net.c, src/net.h, src/protocol.c, src/protocol.h: First - step for implementation of the "indirectdata" directive. This should - allow _leaf_ tincds to be behind firewalls. The protocol has - changed and is INCOMPATIBLE with previous versions. The PROT_CURRENT - value has been incremented. +------------------------------------------------------------------------ +r421 | zarq | 2000-11-15 23:04:48 +0100 (Wed, 15 Nov 2000) | 2 lines -2000-06-17 22:55 Ivo Timmermans +List management and manipulation routines. - * src/: conf.c, conf.h: Configuration directive `IndirectData'. +------------------------------------------------------------------------ +r420 | guus | 2000-11-15 14:33:27 +0100 (Wed, 15 Nov 2000) | 3 lines -2000-06-17 22:30 Ivo Timmermans +Porting to FreeBSD: +- Reorganized and added some #includes - * redhat/tinc: Merge changes from 1.6-1.8. +------------------------------------------------------------------------ +r419 | zarq | 2000-11-15 02:28:21 +0100 (Wed, 15 Nov 2000) | 3 lines -2000-06-17 10:30 Guus Sliepen +Let the output from an executed script in execute_script() go to +syslog, with proper error detection. - * redhat/tinc: Added another semicolon for bash2 compliance (thanks - to Jamie Briggs) +------------------------------------------------------------------------ +r418 | zarq | 2000-11-15 02:06:13 +0100 (Wed, 15 Nov 2000) | 3 lines -2000-06-16 07:44 Guus Sliepen +Use the HAVE_OPENSSL_xxx_H defined from m4/openssl.m4 during +configure. - * redhat/tinc: Applied patch from Jamie Briggs for bash2 - conformance. +------------------------------------------------------------------------ +r417 | zarq | 2000-11-15 02:02:30 +0100 (Wed, 15 Nov 2000) | 2 lines -2000-06-06 12:24 Ivo Timmermans +Also check for sha.h. - * lib/Makefile.am, src/Makefile.am: Include ../intl in the include - path, and add @INTLLIBS@ to the list of libraries. +------------------------------------------------------------------------ +r416 | zarq | 2000-11-15 01:57:26 +0100 (Wed, 15 Nov 2000) | 3 lines -2000-06-04 14:14 Ivo Timmermans +Also check for rand.h and err.h. If any of these files does not +exist, try the next alternative path. - * po/Makefile.in.in: These files are created by gettextize (run by - autogen.sh) (should have known that). +------------------------------------------------------------------------ +r415 | zarq | 2000-11-15 00:18:19 +0100 (Wed, 15 Nov 2000) | 2 lines -2000-06-04 13:50 Ivo Timmermans +Get rid of the annoying empty line - * configure.in: Check for __gmpz_powm for libgmp3. +------------------------------------------------------------------------ +r414 | zarq | 2000-11-15 00:02:08 +0100 (Wed, 15 Nov 2000) | 2 lines -2000-06-03 10:27 Guus Sliepen +Oops, small error. - * TODO: Removed items in TODO list that are already implemented. - Only two items left. +------------------------------------------------------------------------ +r413 | zarq | 2000-11-14 23:57:19 +0100 (Tue, 14 Nov 2000) | 2 lines -2000-06-02 19:30 Ivo Timmermans +Better checks for OpenSSL. I think it can now detect almost all conceivable installations. - * THANKS: Alphabetized the list, added Lubomír Bulej, removed - Sander Smeenk and Tijs van Bakel, put merits after all names. +------------------------------------------------------------------------ +r412 | zarq | 2000-11-13 23:29:22 +0100 (Mon, 13 Nov 2000) | 2 lines -2000-05-31 20:23 Ivo Timmermans +Identify version as 1.0pre4-cvs - * src/: net.c, encr.c, netutl.c, tincd.c: Miscellaneous copyright - updates. +------------------------------------------------------------------------ +r411 | zarq | 2000-11-13 23:01:27 +0100 (Mon, 13 Nov 2000) | 2 lines -2000-05-31 20:21 Ivo Timmermans +Add a check for openssl that accepts explicit file locations. - * src/genauth.c: Handle locale settings. +------------------------------------------------------------------------ +r409 | zarq | 2000-11-09 22:33:18 +0100 (Thu, 09 Nov 2000) | 2 lines -2000-05-31 20:18 Ivo Timmermans +Add prototype for destroy_queue - * po/nl.po: Updated Dutch translation. +------------------------------------------------------------------------ +r408 | zarq | 2000-11-09 22:29:58 +0100 (Thu, 09 Nov 2000) | 2 lines -2000-05-31 20:17 Ivo Timmermans +Updates, updates - * NEWS: Include news for 1.0pre2. +------------------------------------------------------------------------ +r407 | zarq | 2000-11-09 21:59:35 +0100 (Thu, 09 Nov 2000) | 2 lines -2000-05-30 23:36 Ivo Timmermans +Bop version number to 1.0pre3-1 - * src/protocol.c: Only accept an ADD_HOST request for a host that - already exists in our conn_list if the nexthop field matches the - sender. This is a workaround for older clients. +------------------------------------------------------------------------ +r406 | zarq | 2000-11-09 21:42:16 +0100 (Thu, 09 Nov 2000) | 2 lines -2000-05-30 14:38 Ivo Timmermans +Wrapped text to 70 (72?) columns for easy reading - * src/net.c: In terminate_connection, only send a notification to - hosts that are directly connected to us. (DEL_HOST gets forwarded - automatically.) +------------------------------------------------------------------------ +r405 | zarq | 2000-11-09 21:41:13 +0100 (Thu, 09 Nov 2000) | 2 lines -2000-05-30 14:31 Ivo Timmermans +Final release notes added, also edited release notes for 1.0pre2 to what the announcement on the mailing list looked like. - * src/net.c: When a connection is terminated, all hosts that are - still connected get notified of the lost connections. +------------------------------------------------------------------------ +r404 | guus | 2000-11-08 21:52:37 +0100 (Wed, 08 Nov 2000) | 2 lines -2000-05-30 13:18 Ivo Timmermans +- Make checkpoint tracing a compile time option (off by default) - * src/: conf.c, conf.h, netutl.c: Added new configuration directive - `Hostnames', which controls the resolving of IP addresses to - hostnames. +------------------------------------------------------------------------ +r403 | guus | 2000-11-08 19:05:06 +0100 (Wed, 08 Nov 2000) | 2 lines -2000-05-30 01:40 Guus Sliepen +- Add Jamie :) - * src/: net.c, protocol.c: Only activate a connection upon - receiving it's public key if it's an incoming connection. When it's - outgoing, we need to receive an ack first. +------------------------------------------------------------------------ +r402 | guus | 2000-11-08 18:56:34 +0100 (Wed, 08 Nov 2000) | 2 lines -2000-05-30 00:27 Ivo Timmermans +- Applied Jamie Brigg's patch (close sockets after error) - * NEWS: Updated changes list for version 1.0pre2. +------------------------------------------------------------------------ +r401 | guus | 2000-11-08 01:20:06 +0100 (Wed, 08 Nov 2000) | 3 lines -2000-05-30 00:20 Ivo Timmermans +- Fixed --config +- Show warning when both netname and config directory are given. - * src/net.c: Bounds check for request id (between 0 and 255). +------------------------------------------------------------------------ +r400 | guus | 2000-11-08 01:10:50 +0100 (Wed, 08 Nov 2000) | 6 lines -2000-05-30 00:15 Ivo Timmermans +Porting to SunOS 5.8: +- More #includes Linux doesn't seem to need +- Don't do unsetenv() on SunOS +- Use a replacement asprintf() in case the OS doesn't support it +It now compiles properly under SunOS. - * po/nl.po: Dutch translation of tinc. +------------------------------------------------------------------------ +r399 | guus | 2000-11-07 23:33:33 +0100 (Tue, 07 Nov 2000) | 4 lines -2000-05-29 23:40 Ivo Timmermans +Porting to SunOS 5.8: +- Include all header files necessary +- Check for flock() function - * src/Makefile.am: Define LOCALEDIR in CFLAGS. +------------------------------------------------------------------------ +r398 | guus | 2000-11-07 23:02:14 +0100 (Tue, 07 Nov 2000) | 2 lines -2000-05-29 23:40 Ivo Timmermans +- Open UDP connection for all known hosts. Comments please. - * configure.in: Include GNU gettext checks. +------------------------------------------------------------------------ +r397 | guus | 2000-11-07 22:43:28 +0100 (Tue, 07 Nov 2000) | 8 lines -2000-05-29 23:38 Ivo Timmermans +Changed execution of tinc-up: +- Do not free() strings that have been putenv()d, see man page of the + latter. +- Do not set IFNAME anymore, it appears that the ioctl to get the name of + the interface does not work at all. Since it is set to NETNAME in case + of tun/tap and it is known beforehand in case of ethertap, there is no + need for it anyway... (though it would've simplified things). - * acconfig.h: Update acconfig.h to include values for gettext - inclusion. +------------------------------------------------------------------------ +r396 | zarq | 2000-11-05 03:19:58 +0100 (Sun, 05 Nov 2000) | 2 lines -2000-05-29 23:36 Ivo Timmermans +Build-Depends on gettext - * ABOUT-NLS, Makefile.am, system.h: Include system.h and ABOUT-NLS. +------------------------------------------------------------------------ +r395 | guus | 2000-11-04 23:57:33 +0100 (Sat, 04 Nov 2000) | 5 lines -2000-05-29 23:04 Ivo Timmermans +- Prepended config_ to all configuration option names, because it confused + everything (including myself). +- Use connection oriented UDP sockets for both incoming and outgoing + packets. - * Makefile.am: Include intl/ directory in the list of subdirs. +------------------------------------------------------------------------ +r394 | guus | 2000-11-04 21:44:28 +0100 (Sat, 04 Nov 2000) | 2 lines -2000-05-29 23:01 Ivo Timmermans +- Simplified ping mechanism. - * po/Makefile.in.in, po/POTFILES.in, Makefile.am, configure.in, - src/conf.c, src/encr.c, src/genauth.c, src/net.c, src/netutl.c, - src/protocol.c, src/tincd.c: Internationalization of tinc. +------------------------------------------------------------------------ +r393 | zarq | 2000-11-04 18:29:45 +0100 (Sat, 04 Nov 2000) | 2 lines -2000-05-27 22:23 Guus Sliepen +Build-depends on libtool - * src/: net.c, protocol.c: Terminate a connection on any error. - Furthermore, disallow del_host, add_host and other important - requests until remote host has properly authenticated itself. +------------------------------------------------------------------------ +r392 | guus | 2000-11-04 18:09:10 +0100 (Sat, 04 Nov 2000) | 2 lines -2000-05-27 21:44 Guus Sliepen +- Check for packets that are looping back. - * src/net.c: Made tinc persistent. If no outgoing connection can be - established right after the start of the daemon, it won't quit - anymore but will retry in 5 minutes. Also, 5 minutes is now the - maximum time to wait for a retry. +------------------------------------------------------------------------ +r391 | zarq | 2000-11-04 18:04:17 +0100 (Sat, 04 Nov 2000) | 2 lines -2000-05-27 21:23 Guus Sliepen +Updated Dutch translation - * src/: net.c, netutl.c, protocol.c: Fixed typos. When terminating - a connection, it's status is not only set to remove=1 but also - active=0. +------------------------------------------------------------------------ +r390 | zarq | 2000-11-04 18:01:55 +0100 (Sat, 04 Nov 2000) | 2 lines -2000-05-27 21:04 Guus Sliepen +Add route.c to the list of source files. - * src/: net.c, netutl.c, protocol.c: Fix for a DoS attack: - A remote user could telnet to the tinc daemon and type only this - line: 61 6 00000000/00000000:28f - This would deny any packets to be sent to other tinc networks - (except for to the hosts that run tincd's themselves). Solution is - to skip hosts in lookup_conn() that have not been activated yet. - Fixed potential conn_list table corruption: - If a new connection is accepted but a connection with the same - subnet would already exist in the connection list, the OLD - connection is terminated. +------------------------------------------------------------------------ +r389 | guus | 2000-11-04 17:54:21 +0100 (Sat, 04 Nov 2000) | 2 lines -2000-05-27 15:21 Guus Sliepen +- Forward keys in hex notation, not as binary data. - * doc/: tinc.conf.5, tinc.texi: Documentation updates. Removed all - references to configuration variable "AllowConnect", since it is NOT - used in tinc. Added information about "VpnMask". Elaborated a bit - about "private" and "virtual" networks. +------------------------------------------------------------------------ +r388 | guus | 2000-11-04 17:39:19 +0100 (Sat, 04 Nov 2000) | 2 lines -2000-05-26 13:25 Ivo Timmermans +- Don't forget to set packet cipher for added hosts. - * redhat/tinc: Updated by Lubomir Bulej and Mads Kiilerich: it uses - /etc/tinc/nets.boot and the VpnMask directive in the config files. +------------------------------------------------------------------------ +r387 | guus | 2000-11-04 16:34:07 +0100 (Sat, 04 Nov 2000) | 2 lines -2000-05-22 00:38 Ivo Timmermans +- connlist.c added to translation - * doc/tinc.conf.sample: Add an example of using VpnMask. +------------------------------------------------------------------------ +r386 | zarq | 2000-11-04 16:32:05 +0100 (Sat, 04 Nov 2000) | 4 lines -2000-05-19 02:33 Ivo Timmermans +In execute_script: +- add an environment variable NETNAME. +- chdir to the configuration directory before execing the script. - * README: Updated copyright notice. +------------------------------------------------------------------------ +r385 | zarq | 2000-11-04 16:18:58 +0100 (Sat, 04 Nov 2000) | 2 lines -2000-05-16 18:07 Guus Sliepen +Do not include the passphrases directory - * TODO: TODO file reinstated: - - Append your name to items if you're working on them. - - Remove them if you fixed the problem/implemented that feature. - - Add any (suspected) bugs. +------------------------------------------------------------------------ +r384 | guus | 2000-11-04 16:17:02 +0100 (Sat, 04 Nov 2000) | 2 lines -2000-05-16 15:09 Guus Sliepen +- Removed manpage for no longer existing genauth. - * src/: conf.c, conf.h: Stub for VpnMask config directive. +------------------------------------------------------------------------ +r383 | guus | 2000-11-04 15:52:40 +0100 (Sat, 04 Nov 2000) | 2 lines -2000-05-15 20:28 Ivo Timmermans +- Resolve scriptname after fork() - * src/conf.c, THANKS, doc/tinc.conf.sample: Unlimited length in the - config file, thanks to Cris van Pelt. +------------------------------------------------------------------------ +r382 | zarq | 2000-11-04 15:16:46 +0100 (Sat, 04 Nov 2000) | 2 lines -2000-05-15 17:54 Ivo Timmermans +Use putenv() instead of clumsy do-it-yourself in execute_script. - * redhat/tinc.spec: Updated to newer version. +------------------------------------------------------------------------ +r381 | zarq | 2000-11-04 14:25:15 +0100 (Sat, 04 Nov 2000) | 2 lines -2000-05-14 23:07 Ivo Timmermans +Small change to the way the environment is copied. - * src/net.c: Give IP address instead of hex number when connecting - tcp socket failed. +------------------------------------------------------------------------ +r380 | guus | 2000-11-04 12:49:58 +0100 (Sat, 04 Nov 2000) | 2 lines -2000-05-14 23:04 Ivo Timmermans +- Removed even more warnings. - * configure.in: Changed version to 1.0pre2. +------------------------------------------------------------------------ +r379 | guus | 2000-11-04 11:37:27 +0100 (Sat, 04 Nov 2000) | 2 lines -2000-05-14 22:56 Ivo Timmermans +- Removed unused MAC strip/add functions. - * configure.in: Add check for mpz_powm in libgmp3. +------------------------------------------------------------------------ +r378 | zarq | 2000-11-03 23:35:12 +0100 (Fri, 03 Nov 2000) | 5 lines -2000-05-14 15:50 Ivo Timmermans +Warnings removal pass: always include config.h first; add a few +prototypes in the header files. - * src/protocol.c: Only print an error with send_termreq if - debug_lvl is 2 or more. +This also fixes a few lint errors/warnings. -2000-05-14 15:06 Guus Sliepen +------------------------------------------------------------------------ +r377 | zarq | 2000-11-03 23:33:16 +0100 (Fri, 03 Nov 2000) | 3 lines - * src/net.c: Fixed typos. +Run the scripts tinc-up and tinc-down from a separate function, which +sets the environment as it should be and checks for errors. -2000-05-14 15:02 Guus Sliepen +------------------------------------------------------------------------ +r376 | zarq | 2000-11-03 23:31:55 +0100 (Fri, 03 Nov 2000) | 2 lines - * src/: net.c, net.h: Changed ping behaviour (backwards - compatible). If we don't have any data to send, we don't need to - check if the connection is still alive. Furthermore, if we receive - any kind of data from the other end, we know it's alive, so we don't - need to check it either. So, PING requests are only sent if we send - packets but there is no response. +Save the environment on startup. -2000-05-14 14:22 Guus Sliepen +------------------------------------------------------------------------ +r375 | zarq | 2000-11-03 00:02:49 +0100 (Fri, 03 Nov 2000) | 2 lines - * AUTHORS, README, THANKS, doc/tinc.conf.5, doc/tinc.texi, - src/conf.c, src/conf.h, src/encr.c, src/encr.h, src/genauth.c, - src/net.c, src/net.h, src/netutl.c, src/netutl.h, src/protocol.c, - src/protocol.h, src/tincd.c: Cleanups. +Minor cosmetic change. -2000-05-14 13:39 Guus Sliepen +------------------------------------------------------------------------ +r374 | zarq | 2000-11-02 23:51:16 +0100 (Thu, 02 Nov 2000) | 5 lines - * src/: conf.c, conf.h, net.c: Proxymode removed. +- If necessary, patch po/Makefile.in from po-Makefile.in.in.diff to +get DESTDIR installation (required to get locales installed +correctly). +- Use dh_perl to get accurate perl dependencies. -2000-05-12 15:31 Ivo Timmermans +------------------------------------------------------------------------ +r372 | zarq | 2000-11-02 23:11:18 +0100 (Thu, 02 Nov 2000) | 2 lines - * doc/tinc.texi: Deleted the protocol description. +Oops, and include doc-base.tinc (new file). -2000-05-08 20:44 Guus Sliepen +------------------------------------------------------------------------ +r371 | zarq | 2000-11-02 23:10:09 +0100 (Thu, 02 Nov 2000) | 2 lines - * src/: conf.c, conf.h, net.c: Added new config variable - "ProxyMode". If enabled, all outgoing packets are sent to the uplink - (ConnectTo), which will have to forward them for us (kernel should - do that). This is for people behind firewalls. +Don't include shlibs, as it no longer exists. -2000-05-05 12:48 Ivo Timmermans +------------------------------------------------------------------------ +r370 | zarq | 2000-11-02 23:05:36 +0100 (Thu, 02 Nov 2000) | 2 lines - * redhat/tinc: Added semicolons required by bash2 (Mads Kiilerich). +Changed a few messages wrt. system calls; updated and changed the Dutch translation a bit. -2000-05-05 01:17 Ivo Timmermans +------------------------------------------------------------------------ +r369 | zarq | 2000-11-02 22:43:03 +0100 (Thu, 02 Nov 2000) | 2 lines - * src/: encr.c, protocol.c: Include sys/types.h. +Mention fileutils, add a pointer to THANKS for more details -2000-05-05 01:16 Ivo Timmermans +------------------------------------------------------------------------ +r368 | zarq | 2000-11-02 22:41:53 +0100 (Thu, 02 Nov 2000) | 2 lines - * src/Makefile.am: Don't link in libdl. +Change wsl to Wessel's name and email address in the ChangeLog creation -2000-05-04 02:01 Ivo Timmermans +------------------------------------------------------------------------ +r367 | zarq | 2000-11-02 22:40:33 +0100 (Thu, 02 Nov 2000) | 2 lines - * configure.in: Check for the existance of libdl. +More exhaustive list of changes - perhaps it can be worded differently? -2000-05-04 02:00 Ivo Timmermans +------------------------------------------------------------------------ +r366 | zarq | 2000-11-02 22:39:57 +0100 (Thu, 02 Nov 2000) | 2 lines - * acconfig.h: More for getopt support. +Changed `I' to `We' - small change, lots of difference :) -2000-05-04 02:00 Ivo Timmermans +------------------------------------------------------------------------ +r365 | zarq | 2000-11-02 22:38:55 +0100 (Thu, 02 Nov 2000) | 2 lines - * lib/xmalloc.c: Include stdio.h for fprintf. +Only check for linux/if_tun.h once -2000-05-04 01:47 Ivo Timmermans +------------------------------------------------------------------------ +r364 | zarq | 2000-11-02 22:34:45 +0100 (Thu, 02 Nov 2000) | 2 lines - * lib/: Makefile.am, getopt.c, getopt1.c, getopt.h: getopt_long() - support for platforms that don't have it. +Added a perl example to turn an IP address into a MAC address. -2000-05-04 01:00 Ivo Timmermans +------------------------------------------------------------------------ +r363 | zarq | 2000-11-02 22:26:51 +0100 (Thu, 02 Nov 2000) | 2 lines - * lib/xmalloc.c: Don't use error.h or error(), put #error in front - of cpp errors. +Do not include $(top_srcdir)/cipher, it does no longer exist. -2000-05-03 20:02 Guus Sliepen +------------------------------------------------------------------------ +r362 | zarq | 2000-11-02 21:29:03 +0100 (Thu, 02 Nov 2000) | 5 lines - * src/net.c: Squashed gcc warning. +- Synchronized changelog with the package's changelog. +- Changed maintainer email address. +- New file doc-base.tinc. +- Better Build-Depends and Depends lines. -2000-05-03 19:59 Guus Sliepen +------------------------------------------------------------------------ +r361 | zarq | 2000-11-02 21:25:35 +0100 (Thu, 02 Nov 2000) | 2 lines - * src/: net.c, protocol.c: Fixes typo and UDP network byte order. +This file is no longer needed. -2000-05-03 17:37 Guus Sliepen +------------------------------------------------------------------------ +r359 | guus | 2000-10-31 17:22:49 +0100 (Tue, 31 Oct 2000) | 3 lines - * src/net.c: Outgoing packets now use network byte order in header. +Removed config file parsing and interface setup. This will be handled by +the tinc-up and tinc-down scripts from now on. -2000-05-03 17:01 Ivo Timmermans +------------------------------------------------------------------------ +r358 | guus | 2000-10-31 17:10:17 +0100 (Tue, 31 Oct 2000) | 2 lines - * redhat/: tinc, tinc.spec: Fix a typo, better handling of the info - document. (from Mads Kiilerich) +- Update. -2000-05-02 12:16 Guus Sliepen +------------------------------------------------------------------------ +r357 | guus | 2000-10-30 11:19:06 +0100 (Mon, 30 Oct 2000) | 2 lines - * src/: net.h, protocol.c: Replaced sprintf() by safer snprintf(), - removed possible buffer overflow by one byte. +- Fixed some spelling mistakes and terminology here and there. -2000-05-02 11:55 Guus Sliepen +------------------------------------------------------------------------ +r356 | guus | 2000-10-30 01:22:54 +0100 (Mon, 30 Oct 2000) | 4 lines - * src/: net.c, net.h, protocol.c: Previous fix fixed. Meta protocol - should be really flawless from now on! +- Small cleanups +- Updated dutch translation +- Updated man pages -2000-05-02 11:10 Guus Sliepen +------------------------------------------------------------------------ +r355 | guus | 2000-10-29 23:55:15 +0100 (Sun, 29 Oct 2000) | 2 lines - * src/net.c: Fixed small mistake that would prevent forwarding - requests. +- Finishing touch: encrypt the meta connections -2000-05-02 00:00 Ivo Timmermans +------------------------------------------------------------------------ +r354 | guus | 2000-10-29 23:10:44 +0100 (Sun, 29 Oct 2000) | 2 lines - * NEWS: Mentioned new metaprotocol. +- Use CFB mode for encrypting packets: it works and we don't need padding. -2000-05-01 23:47 Ivo Timmermans +------------------------------------------------------------------------ +r353 | guus | 2000-10-29 11:39:08 +0100 (Sun, 29 Oct 2000) | 5 lines - * doc/tinc.conf.5, doc/tinc.conf.sample, doc/Makefile.am, - doc/tincd.conf.5, doc/tincd.conf.sample, redhat/tinc.spec: More - tincd->tinc updates. +- Small fixes +- Do proper key exchange +- Encrypt packets - it works, but there is something wrong with the MAC + header after decryption... -2000-05-01 23:31 Ivo Timmermans +------------------------------------------------------------------------ +r352 | guus | 2000-10-29 10:19:27 +0100 (Sun, 29 Oct 2000) | 2 lines - * src/: encr.c, net.h, protocol.c: Fixed meta protocol. +- Removed old encr stuff -2000-05-01 23:31 Ivo Timmermans +------------------------------------------------------------------------ +r351 | guus | 2000-10-29 03:07:41 +0100 (Sun, 29 Oct 2000) | 3 lines - * redhat/tinc.spec: Committed by Mads Kiilerich. +- Updated dutch translation. +- Shutdown properly. -2000-05-01 21:17 Ivo Timmermans +------------------------------------------------------------------------ +r350 | guus | 2000-10-29 02:27:23 +0100 (Sun, 29 Oct 2000) | 2 lines - * redhat/tinc.spec: Updates by Mads Kiilerich. +- Moved connlist stuff to the proper header file. -2000-05-01 20:07 Guus Sliepen +------------------------------------------------------------------------ +r349 | guus | 2000-10-29 02:08:09 +0100 (Sun, 29 Oct 2000) | 2 lines - * src/: encr.c, net.c, net.h, netutl.c, protocol.c, protocol.h: - Meta protocol overhaul. Tinc is now incompatible with previous - versions, furthermore this version does NOT work yet because of a - problem with sending keys (these should be converted to base36 or - something like that). It is possible to telnet to the tinc daemon - now and type some commands by hand though :). +- Enforce correct order of authentication requests -2000-05-01 18:28 Ivo Timmermans +------------------------------------------------------------------------ +r348 | guus | 2000-10-29 02:46:43 +0200 (Sun, 29 Oct 2000) | 3 lines - * redhat/tinc: Committed by Lubomír Bulej. +- Hit people who can't figure out subnet address/mask pairs with a + (clue)bat. -2000-04-30 22:48 Ivo Timmermans +------------------------------------------------------------------------ +r347 | guus | 2000-10-29 02:24:31 +0200 (Sun, 29 Oct 2000) | 3 lines - * src/protocol.c: Key forwarding, write one byte extra. +- Fixed ans_key_h +- Removed tapsubnet configuration option. -2000-04-30 21:49 Ivo Timmermans +------------------------------------------------------------------------ +r346 | guus | 2000-10-29 02:02:20 +0200 (Sun, 29 Oct 2000) | 2 lines - * src/protocol.c: Protocol fix (ANS_KEY). This breaks 0.3.3 - protocol compatibility. +- Very big cleanup. -2000-04-30 21:03 Ivo Timmermans +------------------------------------------------------------------------ +r345 | guus | 2000-10-28 23:52:22 +0200 (Sat, 28 Oct 2000) | 3 lines - * src/protocol.c: Send one less byte from an ANS_KEY request. +- Override destination ethernet address on incoming packets with + FE:FD:00:00:00:00 -2000-04-30 20:57 Ivo Timmermans +------------------------------------------------------------------------ +r344 | guus | 2000-10-28 23:25:21 +0200 (Sat, 28 Oct 2000) | 2 lines - * src/protocol.c: Read one less byte from an ANS_KEY request. +- Fixed offsets when reading/writing from/to tap device -2000-04-30 18:34 Ivo Timmermans +------------------------------------------------------------------------ +r343 | guus | 2000-10-28 23:05:20 +0200 (Sat, 28 Oct 2000) | 5 lines - * src/protocol.c: Removed debug messages. +- Lots of small fixes +- Exchange subnets on acknowledgement of connection +- Do proper lookup when incoming packets from tap +- off-by-a small number-error when reading/sending tap packets -2000-04-30 18:31 Ivo Timmermans +------------------------------------------------------------------------ +r342 | zarq | 2000-10-28 21:34:53 +0200 (Sat, 28 Oct 2000) | 2 lines - * src/protocol.c: Read public keys the right way (tm). +Skip the check for Linux kernel sources -2000-04-30 18:11 Ivo Timmermans +------------------------------------------------------------------------ +r341 | guus | 2000-10-28 18:41:40 +0200 (Sat, 28 Oct 2000) | 4 lines - * src/: net.c, net.h, netutl.c, protocol.c, protocol.h: New way of - handling the meta protocol. +- Updated subnet list handling. Subnets are added to two lists now, the + owner's list and a global list. It is all fucked up but it probably + works anyway, good enough for pre3 :). -2000-04-30 15:23 Ivo Timmermans +------------------------------------------------------------------------ +r340 | guus | 2000-10-24 17:46:18 +0200 (Tue, 24 Oct 2000) | 4 lines - * src/net.c: Replaced check for status.active by status.dataopen in - check_network_activity. +- Lots of little stuff modified +- Succesfully reads in subnets from host config file now and adds them to + the list. -2000-04-30 03:16 Ivo Timmermans +------------------------------------------------------------------------ +r339 | zarq | 2000-10-23 23:56:56 +0200 (Mon, 23 Oct 2000) | 2 lines - * src/netutl.c: Initially, the vpn_mask of a connection is - 255.255.255.255 to avoid confusion with lookup_conn. +Oops, echelon change committed to cabal... :) -2000-04-30 03:15 Ivo Timmermans +------------------------------------------------------------------------ +r338 | guus | 2000-10-23 15:52:54 +0200 (Mon, 23 Oct 2000) | 2 lines - * src/: net.c, protocol.c: Got rid of the nasty hacks... and - replaced it by another one. +- route.c will contain the routing logic. -2000-04-29 22:39 Ivo Timmermans +------------------------------------------------------------------------ +r336 | zarq | 2000-10-22 15:47:41 +0200 (Sun, 22 Oct 2000) | 2 lines - * src/: protocol.c, protocol.h: Filled up the protocol structs with - unused bytes. +read_server_config: Check for result of read_config_file. -2000-04-29 22:38 Ivo Timmermans +------------------------------------------------------------------------ +r335 | zarq | 2000-10-22 15:37:15 +0200 (Sun, 22 Oct 2000) | 2 lines - * Makefile.am: Added `deb' target. +Include linux/sockios.h and net/if.h anyway, regardless of the value of HAVE_TUNTAP. -2000-04-29 15:56 Ivo Timmermans +------------------------------------------------------------------------ +r334 | guus | 2000-10-21 13:52:08 +0200 (Sat, 21 Oct 2000) | 4 lines - * redhat/tinc, doc/tinc.texi, redhat/tinc.spec: More updates wrt. - the change from tincd->tinc. +- Fixed all debug levels. +- Seed PRNG before generating a challenge +- Strange thing in challenge decryption: it fails if first bit is set!? -2000-04-28 13:33 Guus Sliepen +------------------------------------------------------------------------ +r333 | guus | 2000-10-20 21:46:58 +0200 (Fri, 20 Oct 2000) | 5 lines - * src/net.c: Oops! Reference to write_n() removed and changed into - neat write() call. +- Removed last reference to genauth from Makefile.am +- Tinc spawns tinc-up and tinc-down scripts which can be used to configure + the network device. The environment variable IFNAME is set to the name + of the interface. -2000-04-27 22:57 Guus Sliepen +------------------------------------------------------------------------ +r332 | guus | 2000-10-20 18:49:20 +0200 (Fri, 20 Oct 2000) | 4 lines - * src/net.c: Removed write_n() function. +- Made Makefile.am stub for doc/es/ +- Merged genauth into tincd +- Updated dutch translation -2000-04-27 15:47 Ivo Timmermans +------------------------------------------------------------------------ +r327 | guus | 2000-10-20 17:34:38 +0200 (Fri, 20 Oct 2000) | 2 lines - * src/tincd.c: Default config file name is tinc.conf, and pidfile - is tinc.pid. +- tinc now really does public/private key encryption! It even works, whee! -2000-04-27 02:07 Ivo Timmermans +------------------------------------------------------------------------ +r324 | zarq | 2000-10-19 19:29:22 +0200 (Thu, 19 Oct 2000) | 2 lines - * README: Updated version number to 1.0. +Changed changelog -2000-04-27 01:56 Ivo Timmermans +------------------------------------------------------------------------ +r323 | guus | 2000-10-19 16:42:00 +0200 (Thu, 19 Oct 2000) | 2 lines - * Makefile.am, configure.in: Version to 1.0pre1; Create Makefile - and build in debian/. +- Seed the PRNG using /dev/random before generating the keys. -2000-04-27 00:42 Ivo Timmermans +------------------------------------------------------------------------ +r321 | zarq | 2000-10-18 21:44:11 +0200 (Wed, 18 Oct 2000) | 2 lines - * doc/tinc.texi: Add an entry to dir. +Get the head revision up to date with cabal -2000-04-26 19:42 Guus Sliepen +------------------------------------------------------------------------ +r320 | zarq | 2000-10-17 12:15:20 +0200 (Tue, 17 Oct 2000) | 2 lines - * src/: conf.c, encr.c, net.c, netutl.c, protocol.c: Cleanups: - - Changed recv/send calls into read/write calls for streams - - Made all sizeof() functions use a variable name instead of type +Don't declare cp_file and cp_line in xmalloc() -2000-04-26 16:54 Ivo Timmermans +------------------------------------------------------------------------ +r319 | zarq | 2000-10-17 12:14:25 +0200 (Tue, 17 Oct 2000) | 2 lines - * redhat/tinc.spec: From Mads Kiilerich. +Process subdir es/ -2000-04-26 00:15 Guus Sliepen +------------------------------------------------------------------------ +r318 | guus | 2000-10-16 21:04:47 +0200 (Mon, 16 Oct 2000) | 2 lines - * src/encr.c: Converted every &variable[0] to variable. +- More fixing. Tinc daemons can now even create activated connections. -2000-04-26 00:00 Ivo Timmermans +------------------------------------------------------------------------ +r317 | guus | 2000-10-16 18:33:30 +0200 (Mon, 16 Oct 2000) | 4 lines - * src/net.c: Debug level tweaking. +- Fixing little things +- Two tinc daemons can connect to eachother now (but they disconnect right + after the ACKs). -2000-04-25 22:50 Guus Sliepen +------------------------------------------------------------------------ +r316 | zarq | 2000-10-16 13:35:10 +0200 (Mon, 16 Oct 2000) | 2 lines - * src/net.c: When trying to talk to a host that is in the netmask - of a tinc server but not the tinc server itself, and no keys have - been exchanged yet, the key request would be directed to the host - instead of the server. Fixed. +Output doc/es/Makefile -2000-04-25 22:17 Guus Sliepen +------------------------------------------------------------------------ +r315 | guus | 2000-10-15 22:30:39 +0200 (Sun, 15 Oct 2000) | 2 lines - * src/net.c: Fixed typo and removed some unnecessary variables. +Corrected #ifdefs for tun/tap support. -2000-04-25 22:10 Guus Sliepen +------------------------------------------------------------------------ +r314 | zarq | 2000-10-15 22:21:27 +0200 (Sun, 15 Oct 2000) | 2 lines - * src/: net.c, net.h: Packet queues fixed. They caused the trouble - when resending keys. +Really #include the if_tun.h files now -2000-04-25 21:23 Ivo Timmermans +------------------------------------------------------------------------ +r313 | zarq | 2000-10-15 22:13:55 +0200 (Sun, 15 Oct 2000) | 2 lines - * autogen.sh: Create a ChangeLog file, automake requires it. +Linearized checks for if_tun.h -2000-04-25 21:21 Ivo Timmermans +------------------------------------------------------------------------ +r312 | zarq | 2000-10-15 21:53:15 +0200 (Sun, 15 Oct 2000) | 2 lines - * doc/Makefile.summ: [no log message] +Wrap the tun/tap code in #ifdef HAVE_TUNTAP -2000-04-25 20:57 Guus Sliepen +------------------------------------------------------------------------ +r311 | zarq | 2000-10-15 19:26:31 +0200 (Sun, 15 Oct 2000) | 2 lines - * src/: encr.c, net.c, netutl.c, protocol.c: Added checkpoints to - beginning and ending of every function. +Add checks for the presence of the universal tun/tap device driver. -2000-04-25 19:38 Ivo Timmermans +------------------------------------------------------------------------ +r309 | guus | 2000-10-15 02:59:37 +0200 (Sun, 15 Oct 2000) | 5 lines - * Makefile.am: Remove ChangeLog with a `make cvs-clean'. +- The daemon actually runs now (somewhat) +- Added support for tun/tap driver (autodetect!) +- More sophisticated checkpoint functionality +- Updated dutch translation -2000-04-25 19:35 Ivo Timmermans +------------------------------------------------------------------------ +r308 | zarq | 2000-10-15 00:22:06 +0200 (Sun, 15 Oct 2000) | 2 lines - * Makefile.am: Don't include TODO in the dist. +Add CVS id lines -2000-04-25 17:08 Ivo Timmermans +------------------------------------------------------------------------ +r307 | zarq | 2000-10-15 00:17:29 +0200 (Sun, 15 Oct 2000) | 2 lines - * src/Makefile.am: Propagate CFLAGS from configure to gcc. +Fix `Requirements'-section for GMP and OpenSSL libraries. -2000-04-25 17:07 Ivo Timmermans +------------------------------------------------------------------------ +r306 | zarq | 2000-10-15 00:00:09 +0200 (Sun, 15 Oct 2000) | 2 lines - * Makefile.am: Delete all the files that are created by autogen.sh - on a `make cvs-clean'. +Update Depends lines to reflect the dependencies on OpenSSL -2000-04-25 12:40 Ivo Timmermans +------------------------------------------------------------------------ +r305 | guus | 2000-10-14 19:04:16 +0200 (Sat, 14 Oct 2000) | 3 lines - * doc/tinc.texi: Spelling fixes. +- Second fixing-things pass: it even links now. +- Lots of FIXME comments added to the source code. -2000-04-25 12:27 Ivo Timmermans +------------------------------------------------------------------------ +r304 | zarq | 2000-10-14 01:34:56 +0200 (Sat, 14 Oct 2000) | 2 lines - * redhat/tinc.spec: Contributed by Mads Kiilerich. +Don't look for GMP header files -2000-04-25 12:21 Ivo Timmermans +------------------------------------------------------------------------ +r303 | zarq | 2000-10-14 01:30:11 +0200 (Sat, 14 Oct 2000) | 2 lines - * autogen.sh, m4/Makefile.am: Generate this Makefile.am from - Makefile.am.in. +Updated new requirements, pointers to the manual -2000-04-25 11:43 Ivo Timmermans +------------------------------------------------------------------------ +r302 | zarq | 2000-10-14 01:29:35 +0200 (Sat, 14 Oct 2000) | 2 lines - * AUTHORS: [no log message] +Link with OpenSSL, forget libGMP -2000-04-25 11:42 Ivo Timmermans +------------------------------------------------------------------------ +r301 | guus | 2000-10-12 00:01:02 +0200 (Thu, 12 Oct 2000) | 4 lines - * THANKS: Added Mads Kiilerich, removed Guus Sliepen. +- Fixing-things pass: every source file compiles into an object file now, + but linking tincd does not work yet (must link with openssl libs and + define some missing functions). -2000-04-25 03:45 Ivo Timmermans +------------------------------------------------------------------------ +r300 | guus | 2000-10-11 15:42:52 +0200 (Wed, 11 Oct 2000) | 2 lines - * doc/tinc.texi: Changes largely from Mads Kiilerich. Removed - section about encryption. +- Generalized config file parsing to support multiple configuration trees. -2000-04-25 03:26 Ivo Timmermans +------------------------------------------------------------------------ +r299 | guus | 2000-10-11 14:07:27 +0200 (Wed, 11 Oct 2000) | 2 lines - * m4/aclocal-include.m4: Remove test for GNOME. +- Changed genauth to produce rsa keypairs instead of random passphrases. -2000-04-25 03:25 Ivo Timmermans +------------------------------------------------------------------------ +r298 | guus | 2000-10-11 12:35:17 +0200 (Wed, 11 Oct 2000) | 6 lines - * ChangeLog: Use `make ChangeLog' to create this file from the CVS - logs. +Big and bad commit of my current tree... +- Added seperate file for connection list handling +- Updating everything to use connlist, meta and subnet files +- Removed dependency on libgmp +- Lots of other stuff... -2000-04-25 03:23 Ivo Timmermans +------------------------------------------------------------------------ +r295 | guus | 2000-10-04 17:09:57 +0200 (Wed, 04 Oct 2000) | 2 lines - * acconfig.h: Don't define HAVE_NAMESPACES and HAVE_STL. +Removing cipher directory (all will be covered by OpenSSL). -2000-04-25 03:22 Ivo Timmermans +------------------------------------------------------------------------ +r294 | guus | 2000-10-01 05:21:49 +0200 (Sun, 01 Oct 2000) | 3 lines - * configure.in: Remove check for bigendianness. +- Added subnet handling code +- Other small changes to header files -2000-04-25 03:15 Ivo Timmermans +------------------------------------------------------------------------ +r291 | zarq | 2000-09-27 22:32:29 +0200 (Wed, 27 Sep 2000) | 2 lines - * TODO: This file is obsolete, most of the ideas are already in - echelon. +Many updates, parts rewritten, added, shuffled around. -2000-04-25 03:10 Ivo Timmermans +------------------------------------------------------------------------ +r290 | guus | 2000-09-26 16:06:11 +0200 (Tue, 26 Sep 2000) | 5 lines - * autogen.sh: s/Gnome/tinc/g +- Added meta.c which contains functions to send, receive and broadcast + metadata. It will also handle encryption and decryption, and possibly + compression and checksumming. +- Moved request dispatcher to protocol.c. -2000-04-25 02:50 Ivo Timmermans +------------------------------------------------------------------------ +r287 | guus | 2000-09-25 22:08:50 +0200 (Mon, 25 Sep 2000) | 2 lines - * config.guess, config.h.in, config.sub, install-sh, ltconfig, - aclocal.m4, autogen.sh, configure.in, ltmain.sh, missing, - mkinstalldirs, stamp-h.in, m4/aclocal-include.m4: The shell script - autogen.sh can create all these removed files, but be sure to have - autoconf, automake, libtool and more installed. +- Very detailed example of the authentication phase. -2000-04-25 02:11 Ivo Timmermans +------------------------------------------------------------------------ +r286 | guus | 2000-09-22 18:20:07 +0200 (Fri, 22 Sep 2000) | 3 lines - * configure.in: Don't try to create cipher/idea/Makefile. +- Removed options "string" stuff. It was a bad idea... +- free() everything that is allocated. -2000-04-24 11:39 Guus Sliepen +------------------------------------------------------------------------ +r285 | guus | 2000-09-22 17:06:28 +0200 (Fri, 22 Sep 2000) | 4 lines - * src/protocol.c: Bug found! Wrong pointer was used for handling - multiple ADD_HOST requests at once. (See line 606.) +- Severe code reduction and simplification of challenge requests +- "Finished" [add|del]_subnet_h +- Added lots of sanity checks to [add|del]_host_h -2000-04-24 10:32 Guus Sliepen +------------------------------------------------------------------------ +r284 | guus | 2000-09-17 23:42:05 +0200 (Sun, 17 Sep 2000) | 4 lines - * src/protocol.c: Added extra checks for desynchronized connection - lists. Hopefully this will fix those strange segmentation faults. +- Updated authentication scheme. +- Removed all trailing spaces from all lines. +- Added things to add_ and del_subnet_h. -2000-04-21 00:50 Ivo Timmermans +------------------------------------------------------------------------ +r283 | guus | 2000-09-17 22:11:59 +0200 (Sun, 17 Sep 2000) | 3 lines - * Makefile.am: Added cvs-clean. +- Included authentication scheme from protocol.c +- Added a few comments about the symmetric cipher. -2000-04-20 21:14 Ivo Timmermans +------------------------------------------------------------------------ +r282 | guus | 2000-09-17 21:57:39 +0200 (Sun, 17 Sep 2000) | 3 lines - * NEWS: Keep make dist(dir) happy. +Added document about the used cryptographic algorithms and the reasons +behind them. Feel very free to comment on this! -2000-04-18 22:44 Ivo Timmermans +------------------------------------------------------------------------ +r280 | zarq | 2000-09-17 12:28:57 +0200 (Sun, 17 Sep 2000) | 2 lines - * redhat/README: A short notice from Mads Kiilerich. +Added Spanish translation of the docs by Matias Carrasco -2000-04-18 22:43 Ivo Timmermans +------------------------------------------------------------------------ +r277 | zarq | 2000-09-15 14:58:40 +0200 (Fri, 15 Sep 2000) | 2 lines - * redhat/tinc.spec: Submitted changes by Mads Kiilerich. +Second round of fixes -2000-04-18 22:30 Ivo Timmermans +------------------------------------------------------------------------ +r276 | zarq | 2000-09-14 23:51:21 +0200 (Thu, 14 Sep 2000) | 2 lines - * doc/Makefile.am: Include genauth.8 in the distribution. +First round of needed fixes after the overhaul -2000-04-18 22:26 Ivo Timmermans +------------------------------------------------------------------------ +r275 | zarq | 2000-09-14 16:34:38 +0200 (Thu, 14 Sep 2000) | 2 lines - * Makefile.am, configure.in, redhat/Makefile.am: Include the - directory redhat in the build process. +New directive: Name. -2000-04-18 18:04 Ivo Timmermans +------------------------------------------------------------------------ +r274 | zarq | 2000-09-14 16:32:34 +0200 (Thu, 14 Sep 2000) | 2 lines - * src/tincd.c: Address for bugreports changed to tinc@nl.linux.org. +Added some structures and types that are needed for the overhaul. -2000-04-18 17:59 Ivo Timmermans +------------------------------------------------------------------------ +r273 | guus | 2000-09-14 13:54:51 +0200 (Thu, 14 Sep 2000) | 2 lines - * doc/: tincd.conf.5, tincd.x: Updated manpages. +- Lots of small changes. -2000-04-18 17:59 Ivo Timmermans +------------------------------------------------------------------------ +r272 | zarq | 2000-09-11 13:40:46 +0200 (Mon, 11 Sep 2000) | 2 lines - * doc/genauth.8: New manpage for genauth. +Better checks for SunOS libraries -2000-04-18 17:09 Ivo Timmermans +------------------------------------------------------------------------ +r271 | guus | 2000-09-11 12:05:35 +0200 (Mon, 11 Sep 2000) | 3 lines - * redhat/: tinc, tinc.spec: Submitted by Mads Kiilerich. +- Fixed modulo in keylength check +- Updated header file to reflect new protocol code -2000-04-17 19:04 Ivo Timmermans +------------------------------------------------------------------------ +r270 | guus | 2000-09-11 01:11:37 +0200 (Mon, 11 Sep 2000) | 2 lines - * src/genauth.c: Default passphrase length of 1024, added -h/--help - options. +- Some key exchange stuff. (Last commit before going to bed.) -2000-04-17 18:59 Ivo Timmermans +------------------------------------------------------------------------ +r269 | guus | 2000-09-11 00:49:46 +0200 (Mon, 11 Sep 2000) | 2 lines - * src/genauth.c: Check if stdout is a terminal, if so, print a - verbose message. +- Lots of functions added for the new protocol. -2000-04-17 18:52 Ivo Timmermans +------------------------------------------------------------------------ +r268 | zarq | 2000-09-10 23:57:11 +0200 (Sun, 10 Sep 2000) | 2 lines - * src/encr.c: Check for an illegal length of passphrase in - read_passphrase(). +Add Guus' name and shift out old protocol requests -2000-04-17 18:23 Ivo Timmermans +------------------------------------------------------------------------ +r267 | zarq | 2000-09-10 20:37:46 +0200 (Sun, 10 Sep 2000) | 2 lines - * lib/xmalloc.c, src/tincd.c: Pass the requested size from - xmalloc() and xrealloc() on to xalloc_fail_func() +Correct filenames for passphrases given in the example -2000-04-17 17:38 Ivo Timmermans +------------------------------------------------------------------------ +r266 | guus | 2000-09-10 18:15:35 +0200 (Sun, 10 Sep 2000) | 2 lines - * src/genauth.c: Only one round of reading bits out of urandom; - Reading `bytes' bytes out of it; Print a newline after completion. +- Added more function skeletons for the new protocol. -2000-04-12 18:22 Ivo Timmermans +------------------------------------------------------------------------ +r265 | guus | 2000-09-10 17:18:03 +0200 (Sun, 10 Sep 2000) | 2 lines - * configure.in: Moved to version number 1.0. +- New protocol. Will break everything else for now. -2000-04-06 20:28 Ivo Timmermans +------------------------------------------------------------------------ +r264 | zarq | 2000-09-10 17:16:07 +0200 (Sun, 10 Sep 2000) | 2 lines - * src/tincd.c: New option -D, don't detach. +Support for -lsocket and -lnsl on SunOS -2000-03-28 21:16 Ivo Timmermans +------------------------------------------------------------------------ +r263 | zarq | 2000-09-10 17:15:38 +0200 (Sun, 10 Sep 2000) | 2 lines - * src/tincd.c: Ignore SIGCHLD. +Include openssl/blowfish.h -2000-03-28 21:09 Ivo Timmermans +------------------------------------------------------------------------ +r262 | zarq | 2000-09-10 17:07:41 +0200 (Sun, 10 Sep 2000) | 2 lines - * src/tincd.c: Kill the parent after any error conditions in - detach(). +Updated text, removed protocol flowchart -2000-03-28 00:59 Ivo Timmermans +------------------------------------------------------------------------ +r261 | zarq | 2000-09-10 17:05:45 +0200 (Sun, 10 Sep 2000) | 2 lines - * src/encr.c: Upon regeneration, free the old encryption key - `securely\' by overwriting it. +Link with OpenSSL crypto libraries instead of own blowfish library -2000-03-28 00:30 Ivo Timmermans +------------------------------------------------------------------------ +r260 | guus | 2000-09-06 13:49:05 +0200 (Wed, 06 Sep 2000) | 3 lines - * src/net.c: Get rid of the message `zxnrbl\'. +- Use strerror() instead of sys_errlist[] for increased portability + (Needed for SunOS) -2000-03-26 01:33 Ivo Timmermans +------------------------------------------------------------------------ +r259 | zarq | 2000-08-27 13:05:47 +0200 (Sun, 27 Aug 2000) | 2 lines - * AUTHORS, README, stamp-h.in, COPYING, ChangeLog, INSTALL, - Makefile.am, NEWS, THANKS, TODO, acconfig.h, aclocal.m4, - config.guess, config.h.in, config.sub, configure.in, install-sh, - ltconfig, ltmain.sh, missing, mkinstalldirs, m4/Makefile.am, - m4/Makefile.am.in, m4/README, lib/Makefile.am, lib/README, - m4/malloc.m4, m4/perl.m4, m4/realloc.m4, lib/alloca.c, - lib/malloc.c, lib/memcmp.c, lib/pidfile.c, lib/realloc.c, - lib/xmalloc.c, lib/pidfile.h, lib/utils.c, lib/utils.h, - lib/xalloc.h, src/Makefile.am, src/conf.c, src/encr.c, src/net.c, - src/netutl.c, src/protocol.c, src/conf.h, src/genauth.c, - src/tincd.c, src/encr.h, src/net.h, src/netutl.h, doc/Makefile.am, - src/protocol.h, doc/texinfo.tex, doc/tinc.texi, doc/tincd.conf.5, - doc/GNUmakefile, doc/Makefile.maint, doc/Makefile.summ, - doc/help2man, doc/tincd.conf.sample, doc/tincd.x: Initial revision +Changed CVSROOT path in `make ChangeLog' -2000-03-26 01:33 Ivo Timmermans +------------------------------------------------------------------------ +r258 | guus | 2000-08-22 16:55:04 +0200 (Tue, 22 Aug 2000) | 2 lines - * AUTHORS, README, stamp-h.in, COPYING, ChangeLog, INSTALL, - Makefile.am, NEWS, THANKS, TODO, acconfig.h, aclocal.m4, - config.guess, config.h.in, config.sub, configure.in, install-sh, - ltconfig, ltmain.sh, missing, mkinstalldirs, m4/Makefile.am, - m4/Makefile.am.in, m4/README, lib/Makefile.am, lib/README, - m4/malloc.m4, m4/perl.m4, m4/realloc.m4, lib/alloca.c, - lib/malloc.c, lib/memcmp.c, lib/pidfile.c, lib/realloc.c, - lib/xmalloc.c, lib/pidfile.h, lib/utils.c, lib/utils.h, - lib/xalloc.h, src/Makefile.am, src/conf.c, src/encr.c, src/net.c, - src/netutl.c, src/protocol.c, src/conf.h, src/genauth.c, - src/tincd.c, src/encr.h, src/net.h, src/netutl.h, doc/Makefile.am, - src/protocol.h, doc/texinfo.tex, doc/tinc.texi, doc/tincd.conf.5, - doc/GNUmakefile, doc/Makefile.maint, doc/Makefile.summ, - doc/help2man, doc/tincd.conf.sample, doc/tincd.x: Initial CVS - version for tinc 0.3. +Fix rules (thanks to Laurence) +------------------------------------------------------------------------ +r257 | zarq | 2000-08-21 22:35:47 +0200 (Mon, 21 Aug 2000) | 2 lines + +Added a rule to create an rpm + +------------------------------------------------------------------------ +r256 | guus | 2000-08-21 14:50:15 +0200 (Mon, 21 Aug 2000) | 2 lines + +Updated tinc.conf manual. + +------------------------------------------------------------------------ +r255 | zarq | 2000-08-21 01:08:17 +0200 (Mon, 21 Aug 2000) | 2 lines + +Also chomp $VPNMASK + +------------------------------------------------------------------------ +r254 | zarq | 2000-08-21 01:07:18 +0200 (Mon, 21 Aug 2000) | 6 lines + +(Quoting Laurence Lane:) + +The prefix is correctly set for /usr, but is +overridden with the current make install. DESTDIR is the clean way to +relocate the installation into the debian/tmp build dir. + +------------------------------------------------------------------------ +r253 | guus | 2000-08-18 16:45:38 +0200 (Fri, 18 Aug 2000) | 5 lines + +Updated the manual: +- incorporated comments from Stefan Hartsuiker +- updated configuration variables section +- added some text about key types + +------------------------------------------------------------------------ +r252 | guus | 2000-08-18 13:17:09 +0200 (Fri, 18 Aug 2000) | 2 lines + +Commented on some size calculations. + +------------------------------------------------------------------------ +r251 | guus | 2000-08-17 19:22:01 +0200 (Thu, 17 Aug 2000) | 2 lines + +Ran update-po and updated dutch translation. + +------------------------------------------------------------------------ +r250 | guus | 2000-08-17 18:51:08 +0200 (Thu, 17 Aug 2000) | 2 lines + +Fixed all sprintf() spl01ts. + +------------------------------------------------------------------------ +r249 | guus | 2000-08-09 16:02:16 +0200 (Wed, 09 Aug 2000) | 3 lines + +- Added two extra configuration options, Interface and InterfaceIP, to + bind the listen socket to a network device or a specific IP. + +------------------------------------------------------------------------ +r248 | guus | 2000-08-09 11:34:21 +0200 (Wed, 09 Aug 2000) | 3 lines + +- Reinstated O_NONBLOCK for meta socket +- Set SO_KEEPALIVE on meta socket + +------------------------------------------------------------------------ +r247 | guus | 2000-08-08 19:07:48 +0200 (Tue, 08 Aug 2000) | 2 lines + +- Moved TCP packet reception to meta handler: less kludgy and less buggy! + +------------------------------------------------------------------------ +r246 | guus | 2000-08-08 16:54:57 +0200 (Tue, 08 Aug 2000) | 2 lines + +- Added date/time of build and protocol number to --version output. + +------------------------------------------------------------------------ +r245 | guus | 2000-08-08 15:47:57 +0200 (Tue, 08 Aug 2000) | 2 lines + +Removed calling add_queue for tcponly packets. + +------------------------------------------------------------------------ +r244 | guus | 2000-08-08 10:48:50 +0200 (Tue, 08 Aug 2000) | 2 lines + +Fixed PACKET read loop. + +------------------------------------------------------------------------ +r243 | guus | 2000-08-07 18:27:29 +0200 (Mon, 07 Aug 2000) | 3 lines + +- Lots o' buglets fixed (-Wall helps) +- Made TCPonly work :) + +------------------------------------------------------------------------ +r242 | guus | 2000-08-07 16:52:16 +0200 (Mon, 07 Aug 2000) | 3 lines + +- Added experimental hackish tunneling-over-TCP support. + Just use TCPonly = true in the configuration file. + +------------------------------------------------------------------------ +r241 | guus | 2000-07-02 15:40:57 +0200 (Sun, 02 Jul 2000) | 2 lines + +- Fixed typo. + +------------------------------------------------------------------------ +r240 | guus | 2000-07-02 15:36:18 +0200 (Sun, 02 Jul 2000) | 3 lines + +- Delayed address resolving for ConnectTo lines in configuration file to + allow DynDNS to work without restarting tincd. + +------------------------------------------------------------------------ +r239 | guus | 2000-07-02 14:48:04 +0200 (Sun, 02 Jul 2000) | 2 lines + +- Updated THANKS file + +------------------------------------------------------------------------ +r238 | zarq | 2000-07-02 14:41:03 +0200 (Sun, 02 Jul 2000) | 2 lines + +Include the Spanish translation in the distribution/build process. + +------------------------------------------------------------------------ +r237 | guus | 2000-07-02 14:35:28 +0200 (Sun, 02 Jul 2000) | 2 lines + +- Added Spanish translation from Enrique Zanardi. + +------------------------------------------------------------------------ +r235 | guus | 2000-07-01 16:40:56 +0200 (Sat, 01 Jul 2000) | 2 lines + +- Forgot to mention ourselves in the tincd manual page! :) + +------------------------------------------------------------------------ +r234 | guus | 2000-07-01 16:32:24 +0200 (Sat, 01 Jul 2000) | 4 lines + +- Updated PROTOCOL (a bit) +- Included a real tincd.8 describing the options, signals, debug levels + and files used by tincd. + +------------------------------------------------------------------------ +r231 | guus | 2000-07-01 09:49:21 +0200 (Sat, 01 Jul 2000) | 2 lines + +- Removed a single unused bit from status_bits_t. + +------------------------------------------------------------------------ +r230 | wsl | 2000-07-01 09:29:32 +0200 (Sat, 01 Jul 2000) | 3 lines + +Added architecture section, made a start with the kernel section. +ToDo: install tinc myself to see if everything is as I say =) + +------------------------------------------------------------------------ +r229 | guus | 2000-07-01 00:38:58 +0200 (Sat, 01 Jul 2000) | 3 lines + +- Added documentation for the protocols (most important the meta protocol) + used by tinc. + +------------------------------------------------------------------------ +r227 | wsl | 2000-06-30 23:16:52 +0200 (Fri, 30 Jun 2000) | 2 lines + +Grrr, recommit + +------------------------------------------------------------------------ +r224 | guus | 2000-06-30 23:03:51 +0200 (Fri, 30 Jun 2000) | 2 lines + +- Made tinc even more silent if no -d flag is given at all. + +------------------------------------------------------------------------ +r222 | wsl | 2000-06-30 22:50:47 +0200 (Fri, 30 Jun 2000) | 2 lines + +File added to CABAL (hopefully) + +------------------------------------------------------------------------ +r219 | guus | 2000-06-30 14:41:06 +0200 (Fri, 30 Jun 2000) | 5 lines + +- Instead of logging an error when remote end closes the connection, + we print a nice message if appropiate debug level is set. +- If we get ADD_HOSTs or DEL_HOSTs for ourself, then connection lists + are really messed up. We restart, and hope our problems go away. + +------------------------------------------------------------------------ +r218 | guus | 2000-06-30 13:45:16 +0200 (Fri, 30 Jun 2000) | 6 lines + +- Removed segfault bug in conf.c (must have been there for ages!) +- Made main_loop() signal proof +- #defined MAXTIMEOUT (15 minutes) +- If something really really bad happens, close all connections, wait + for MAXTIMEOUT seconds, and then restart tinc + +------------------------------------------------------------------------ +r217 | guus | 2000-06-29 21:47:04 +0200 (Thu, 29 Jun 2000) | 4 lines + +- Fixed memory leak. +- Implemented SIGHUP configuration file reloading. +- Other small changes. + +------------------------------------------------------------------------ +r216 | guus | 2000-06-29 19:09:08 +0200 (Thu, 29 Jun 2000) | 4 lines + +- New semantics for BASIC_INFO, ADD_HOST and DEL_HOST requests. This will + improve connection list consistency, ensures the tree property, and + allows for recovery from situations where track of connections is lost. + +------------------------------------------------------------------------ +r215 | guus | 2000-06-29 15:04:15 +0200 (Thu, 29 Jun 2000) | 5 lines + +- Removed all IP_ADDR_S macros, because gettext doesn't like them. Each + connection now has two hostnames: real_hostname (replacing the old), + and vpn_hostname. In those places where hostnames really aren't usefull + IP_ADDR_S has been replaced by %d.%d.%d.%d. + +------------------------------------------------------------------------ +r214 | guus | 2000-06-29 09:11:23 +0200 (Thu, 29 Jun 2000) | 2 lines + +- Updated Dutch translation. + +------------------------------------------------------------------------ +r213 | zarq | 2000-06-28 23:06:40 +0200 (Wed, 28 Jun 2000) | 2 lines + +Oops, and mention Guus too. + +------------------------------------------------------------------------ +r212 | zarq | 2000-06-28 23:01:45 +0200 (Wed, 28 Jun 2000) | 2 lines + +Removed Free Software Foundation copyright, because Guus Sliepen contributed significantly. + +------------------------------------------------------------------------ +r211 | guus | 2000-06-28 16:34:40 +0200 (Wed, 28 Jun 2000) | 2 lines + +- Added log message when SIGCHLD is received ("thanks" to Ivo van Dong) + +------------------------------------------------------------------------ +r210 | guus | 2000-06-28 15:41:02 +0200 (Wed, 28 Jun 2000) | 4 lines + +- Fixed a message in nl.po +- Woops, we forgot to send our connection list to our uplink when we + connect to it... Fixed. + +------------------------------------------------------------------------ +r209 | guus | 2000-06-28 13:39:40 +0200 (Wed, 28 Jun 2000) | 2 lines + +- Fixed missing " in nl.po + +------------------------------------------------------------------------ +r208 | guus | 2000-06-28 13:38:01 +0200 (Wed, 28 Jun 2000) | 4 lines + +- Fixed some spelling errors. +- Paar zpelvautjes gerepareerd, en de Nederlandse vertaling weer bij de + tijd gebracht. + +------------------------------------------------------------------------ +r207 | guus | 2000-06-28 12:11:10 +0200 (Wed, 28 Jun 2000) | 2 lines + +- Extra check op EINTR bij inlezen requests + +------------------------------------------------------------------------ +r206 | guus | 2000-06-27 23:05:07 +0200 (Tue, 27 Jun 2000) | 2 lines + +- Fixes a silly little insignificant buglet. + +------------------------------------------------------------------------ +r205 | guus | 2000-06-27 22:55:12 +0200 (Tue, 27 Jun 2000) | 2 lines + +- Purge old connections that are ADD_HOSTed. + +------------------------------------------------------------------------ +r204 | guus | 2000-06-27 22:10:48 +0200 (Tue, 27 Jun 2000) | 2 lines + +- Improved handling of errors on connection attempts. + +------------------------------------------------------------------------ +r203 | guus | 2000-06-27 17:08:58 +0200 (Tue, 27 Jun 2000) | 3 lines + +- Fixed indirectdata=no problem +- Added support for multiple ConnectTo lines in tinc.conf. + +------------------------------------------------------------------------ +r202 | guus | 2000-06-27 14:58:04 +0200 (Tue, 27 Jun 2000) | 4 lines + +- Fixed KEY_CHANGED notification. A lot of notify_others() calls were + wrong (first two arguments swapped). Should probably be doublechecked. +- Don't retry to connect to hosts with different protocol versions. + +------------------------------------------------------------------------ +r201 | guus | 2000-06-26 22:30:21 +0200 (Mon, 26 Jun 2000) | 4 lines + +- Moved all connection messages to debug level 1, without -d's only the + startup message will be logged. +- Fixed DEL_HOST rebound. + +------------------------------------------------------------------------ +r200 | guus | 2000-06-26 21:39:34 +0200 (Mon, 26 Jun 2000) | 3 lines + +- Indirectdata finally REALLY REALLY works now! +- More precise debug messages + +------------------------------------------------------------------------ +r199 | guus | 2000-06-26 19:20:58 +0200 (Mon, 26 Jun 2000) | 2 lines + +Fixes some hostlookups. Fixes indirectdata for real now (hopefully). + +------------------------------------------------------------------------ +r198 | zarq | 2000-06-25 22:52:29 +0200 (Sun, 25 Jun 2000) | 2 lines + +Version 1.0pre3. + +------------------------------------------------------------------------ +r197 | guus | 2000-06-25 18:39:17 +0200 (Sun, 25 Jun 2000) | 3 lines + +- More verbose connection list +- Added "myself" as hostname when logging indirect ADD_HOSTs + +------------------------------------------------------------------------ +r196 | guus | 2000-06-25 18:20:27 +0200 (Sun, 25 Jun 2000) | 2 lines + +Hostlookup() is actually being called now. + +------------------------------------------------------------------------ +r195 | guus | 2000-06-25 18:01:12 +0200 (Sun, 25 Jun 2000) | 2 lines + +Hostnames are back! + +------------------------------------------------------------------------ +r194 | guus | 2000-06-25 17:45:09 +0200 (Sun, 25 Jun 2000) | 4 lines + +- Log possible spoofing attacks. +- Don't broadcast DEL_HOSTs for hosts that haven't been activated yet. +- If a host sends a TERMREQ, deactivate them. + +------------------------------------------------------------------------ +r193 | zarq | 2000-06-25 17:42:40 +0200 (Sun, 25 Jun 2000) | 2 lines + +Changed version number to 1.0pre3. + +------------------------------------------------------------------------ +r192 | guus | 2000-06-25 17:22:16 +0200 (Sun, 25 Jun 2000) | 2 lines + +Added CVS Id tags to header files. + +------------------------------------------------------------------------ +r191 | guus | 2000-06-25 17:16:12 +0200 (Sun, 25 Jun 2000) | 12 lines + +Large cleanup: +- Removed hostname lookup (it blocks, and you can always do it yourself) +- Reorganized debug levels (after hints from Axel M�ller): + 0 Startup message and errors + 1 Connection logging + 2 Meta protocol information + 3 Verbose meta protocol (includes copy of transmitted requests) + 4 Packet information (logs transmission/errors of UDP packets) + 5 Verbose packet information (every single byte, not implemented yet + to protect ourselves from filling up /var/log directories) +- Made log messages more consistent + +------------------------------------------------------------------------ +r190 | guus | 2000-06-24 14:35:42 +0200 (Sat, 24 Jun 2000) | 2 lines + +If we have "indirectdata" flag set, we only send data to our uplink. + +------------------------------------------------------------------------ +r189 | guus | 2000-06-23 21:27:03 +0200 (Fri, 23 Jun 2000) | 5 lines + +First step for implementation of the "indirectdata" directive. This should +allow _leaf_ tincds to be behind firewalls. +The protocol has changed and is INCOMPATIBLE with previous versions. The +PROT_CURRENT value has been incremented. + +------------------------------------------------------------------------ +r188 | zarq | 2000-06-17 22:55:54 +0200 (Sat, 17 Jun 2000) | 2 lines + +Configuration directive `IndirectData'. + +------------------------------------------------------------------------ +r187 | zarq | 2000-06-17 22:30:44 +0200 (Sat, 17 Jun 2000) | 2 lines + +Merge changes from 1.6-1.8. + +------------------------------------------------------------------------ +r184 | zarq | 2000-06-06 12:24:33 +0200 (Tue, 06 Jun 2000) | 2 lines + +Include ../intl in the include path, and add @INTLLIBS@ to the list of libraries. + +------------------------------------------------------------------------ +r183 | zarq | 2000-06-04 14:14:31 +0200 (Sun, 04 Jun 2000) | 2 lines + +These files are created by gettextize (run by autogen.sh) (should have known that). + +------------------------------------------------------------------------ +r180 | zarq | 2000-06-04 01:32:03 +0200 (Sun, 04 Jun 2000) | 2 lines + +Don't touch VPNMASK if it's defined, otherwise use $MSK. + +------------------------------------------------------------------------ +r178 | zarq | 2000-06-02 19:30:33 +0200 (Fri, 02 Jun 2000) | 2 lines + +Alphabetized the list, added Lubom�r Bulej, removed Sander Smeenk and Tijs van Bakel, put merits after all names. + +------------------------------------------------------------------------ +r177 | guus | 2000-06-01 22:21:27 +0200 (Thu, 01 Jun 2000) | 2 lines + +Debian init.d script automatically sets tap device's MTU to 1448 now. + +------------------------------------------------------------------------ +r176 | zarq | 2000-05-31 20:23:06 +0200 (Wed, 31 May 2000) | 2 lines + +Miscellaneous copyright updates. + +------------------------------------------------------------------------ +r175 | zarq | 2000-05-31 20:21:27 +0200 (Wed, 31 May 2000) | 2 lines + +Handle locale settings. + +------------------------------------------------------------------------ +r174 | zarq | 2000-05-31 20:19:33 +0200 (Wed, 31 May 2000) | 2 lines + +Version 1.0pre2-1. + +------------------------------------------------------------------------ +r173 | zarq | 2000-05-31 20:18:21 +0200 (Wed, 31 May 2000) | 2 lines + +Updated Dutch translation. + +------------------------------------------------------------------------ +r172 | zarq | 2000-05-31 20:17:45 +0200 (Wed, 31 May 2000) | 2 lines + +Tell about /etc/tinc/nets.boot. + +------------------------------------------------------------------------ +r171 | zarq | 2000-05-31 20:17:27 +0200 (Wed, 31 May 2000) | 2 lines + +Include news for 1.0pre2. + +------------------------------------------------------------------------ +r170 | zarq | 2000-05-30 23:36:16 +0200 (Tue, 30 May 2000) | 2 lines + +Only accept an ADD_HOST request for a host that already exists in our conn_list if the nexthop field matches the sender. This is a workaround for older clients. + +------------------------------------------------------------------------ +r169 | zarq | 2000-05-30 14:38:15 +0200 (Tue, 30 May 2000) | 2 lines + +In terminate_connection, only send a notification to hosts that are directly connected to us. (DEL_HOST gets forwarded automatically.) + +------------------------------------------------------------------------ +r168 | zarq | 2000-05-30 14:31:41 +0200 (Tue, 30 May 2000) | 2 lines + +When a connection is terminated, all hosts that are still connected get notified of the lost connections. + +------------------------------------------------------------------------ +r167 | zarq | 2000-05-30 13:18:12 +0200 (Tue, 30 May 2000) | 2 lines + +Added new configuration directive `Hostnames', which controls the resolving of IP addresses to hostnames. + +------------------------------------------------------------------------ +r166 | guus | 2000-05-30 01:40:05 +0200 (Tue, 30 May 2000) | 3 lines + +Only activate a connection upon receiving it's public key if it's an +incoming connection. When it's outgoing, we need to receive an ack first. + +------------------------------------------------------------------------ +r165 | zarq | 2000-05-30 00:27:15 +0200 (Tue, 30 May 2000) | 2 lines + +Updated changes list for version 1.0pre2. + +------------------------------------------------------------------------ +r164 | zarq | 2000-05-30 00:20:04 +0200 (Tue, 30 May 2000) | 2 lines + +Bounds check for request id (between 0 and 255). + +------------------------------------------------------------------------ +r163 | zarq | 2000-05-30 00:15:38 +0200 (Tue, 30 May 2000) | 2 lines + +Dutch translation of tinc. + +------------------------------------------------------------------------ +r162 | zarq | 2000-05-29 23:40:51 +0200 (Mon, 29 May 2000) | 2 lines + +Define LOCALEDIR in CFLAGS. + +------------------------------------------------------------------------ +r161 | zarq | 2000-05-29 23:40:20 +0200 (Mon, 29 May 2000) | 2 lines + +Include GNU gettext checks. + +------------------------------------------------------------------------ +r160 | zarq | 2000-05-29 23:38:02 +0200 (Mon, 29 May 2000) | 2 lines + +Update acconfig.h to include values for gettext inclusion. + +------------------------------------------------------------------------ +r159 | zarq | 2000-05-29 23:36:28 +0200 (Mon, 29 May 2000) | 2 lines + +Include system.h and ABOUT-NLS. + +------------------------------------------------------------------------ +r158 | zarq | 2000-05-29 23:04:55 +0200 (Mon, 29 May 2000) | 2 lines + +Include intl/ directory in the list of subdirs. + +------------------------------------------------------------------------ +r157 | zarq | 2000-05-29 23:01:26 +0200 (Mon, 29 May 2000) | 2 lines + +Internationalization of tinc. + +------------------------------------------------------------------------ +r156 | guus | 2000-05-27 22:23:01 +0200 (Sat, 27 May 2000) | 4 lines + +Terminate a connection on any error. Furthermore, disallow del_host, +add_host and other important requests until remote host has properly +authenticated itself. + +------------------------------------------------------------------------ +r155 | guus | 2000-05-27 21:44:04 +0200 (Sat, 27 May 2000) | 4 lines + +Made tinc persistent. If no outgoing connection can be established right +after the start of the daemon, it won't quit anymore but will retry in 5 +minutes. Also, 5 minutes is now the maximum time to wait for a retry. + +------------------------------------------------------------------------ +r154 | guus | 2000-05-27 21:23:20 +0200 (Sat, 27 May 2000) | 3 lines + +Fixed typos. When terminating a connection, it's status is not only set to +remove=1 but also active=0. + +------------------------------------------------------------------------ +r153 | guus | 2000-05-27 21:04:12 +0200 (Sat, 27 May 2000) | 11 lines + +Fix for a DoS attack: + A remote user could telnet to the tinc daemon and type only this line: + 61 6 00000000/00000000:28f + This would deny any packets to be sent to other tinc networks (except + for to the hosts that run tincd's themselves). Solution is to skip + hosts in lookup_conn() that have not been activated yet. +Fixed potential conn_list table corruption: + If a new connection is accepted but a connection with the same subnet + would already exist in the connection list, the OLD connection is + terminated. + +------------------------------------------------------------------------ +r152 | guus | 2000-05-27 15:21:20 +0200 (Sat, 27 May 2000) | 4 lines + +Documentation updates. Removed all references to configuration variable +"AllowConnect", since it is NOT used in tinc. Added information about +"VpnMask". Elaborated a bit about "private" and "virtual" networks. + +------------------------------------------------------------------------ +r151 | zarq | 2000-05-26 13:25:59 +0200 (Fri, 26 May 2000) | 2 lines + +Updated by Lubomir Bulej and Mads Kiilerich: it uses /etc/tinc/nets.boot and the VpnMask directive in the config files. + +------------------------------------------------------------------------ +r150 | zarq | 2000-05-22 01:01:28 +0200 (Mon, 22 May 2000) | 2 lines + +Create an empty /etc/tinc/nets.boot. + +------------------------------------------------------------------------ +r149 | zarq | 2000-05-22 00:40:41 +0200 (Mon, 22 May 2000) | 2 lines + +Use /etc/tinc/example as a base directory for an example. /etc/tinc/example/README points to /usr/share/doc/tinc/README.Debian. + +------------------------------------------------------------------------ +r148 | zarq | 2000-05-22 00:38:01 +0200 (Mon, 22 May 2000) | 2 lines + +Add an example of using VpnMask. + +------------------------------------------------------------------------ +r147 | zarq | 2000-05-22 00:27:31 +0200 (Mon, 22 May 2000) | 2 lines + +When VpnMask is not present in the config file, silently use $MSK as vpnmask. + +------------------------------------------------------------------------ +r146 | guus | 2000-05-22 00:21:38 +0200 (Mon, 22 May 2000) | 4 lines + +Fixed last typo. Init.d now uses ifconfig command to set both the tap's IP +address as well as the correct route. Furthermore, if no VpnMask is given, +a default of 255.255.0.0 is chosen and a warning issued. + +------------------------------------------------------------------------ +r145 | guus | 2000-05-22 00:08:21 +0200 (Mon, 22 May 2000) | 2 lines + +Typo. + +------------------------------------------------------------------------ +r144 | guus | 2000-05-22 00:04:56 +0200 (Mon, 22 May 2000) | 2 lines + +VpnMask truely works now. + +------------------------------------------------------------------------ +r143 | zarq | 2000-05-19 03:17:32 +0200 (Fri, 19 May 2000) | 2 lines + +Mask the vpn net with the vpn netmask, route would give an error if the netmask didn't match the net. + +------------------------------------------------------------------------ +r142 | zarq | 2000-05-19 02:58:01 +0200 (Fri, 19 May 2000) | 2 lines + +Fixed typo. + +------------------------------------------------------------------------ +r141 | zarq | 2000-05-19 02:33:44 +0200 (Fri, 19 May 2000) | 2 lines + +Updated copyright notice. + +------------------------------------------------------------------------ +r140 | zarq | 2000-05-19 02:15:37 +0200 (Fri, 19 May 2000) | 2 lines + +Errors will not terminate the script or result in a nonzero exit code. + +------------------------------------------------------------------------ +r139 | zarq | 2000-05-19 02:14:34 +0200 (Fri, 19 May 2000) | 2 lines + +Include postinst in the distribution. + +------------------------------------------------------------------------ +r138 | zarq | 2000-05-19 02:09:20 +0200 (Fri, 19 May 2000) | 2 lines + +Find networks in instead of . + +------------------------------------------------------------------------ +r137 | zarq | 2000-05-19 01:33:44 +0200 (Fri, 19 May 2000) | 2 lines + +Don't distribute the file files. + +------------------------------------------------------------------------ +r136 | zarq | 2000-05-19 01:28:51 +0200 (Fri, 19 May 2000) | 2 lines + +Version 1.0pre2-0.3 + +------------------------------------------------------------------------ +r135 | zarq | 2000-05-19 01:18:54 +0200 (Fri, 19 May 2000) | 2 lines + +Create a default /etc/tinc/nets.boot after installation, containing all directories under /etc/tinc by default. + +------------------------------------------------------------------------ +r134 | zarq | 2000-05-19 01:09:31 +0200 (Fri, 19 May 2000) | 2 lines + +Read /etc/tinc/nets.boot to find the networks that have to be started. + +------------------------------------------------------------------------ +r133 | zarq | 2000-05-18 01:13:51 +0200 (Thu, 18 May 2000) | 2 lines + +This file is generated with dpkg-buildpackage. + +------------------------------------------------------------------------ +r132 | guus | 2000-05-16 18:07:15 +0200 (Tue, 16 May 2000) | 5 lines + +TODO file reinstated: +- Append your name to items if you're working on them. +- Remove them if you fixed the problem/implemented that feature. +- Add any (suspected) bugs. + +------------------------------------------------------------------------ +r131 | zarq | 2000-05-16 16:34:44 +0200 (Tue, 16 May 2000) | 2 lines + +Use the new VpnMask directive to add a route to the rest of the VPN. + +------------------------------------------------------------------------ +r130 | guus | 2000-05-16 15:09:15 +0200 (Tue, 16 May 2000) | 2 lines + +Stub for VpnMask config directive. + +------------------------------------------------------------------------ +r129 | zarq | 2000-05-16 15:03:32 +0200 (Tue, 16 May 2000) | 2 lines + +Look if the tap devices exist before bluntly remaking them. + +------------------------------------------------------------------------ +r128 | zarq | 2000-05-16 09:56:05 +0200 (Tue, 16 May 2000) | 2 lines + +*** empty log message *** + +------------------------------------------------------------------------ +r127 | zarq | 2000-05-15 21:48:46 +0200 (Mon, 15 May 2000) | 2 lines + +Depend on perl5. + +------------------------------------------------------------------------ +r126 | zarq | 2000-05-15 20:28:45 +0200 (Mon, 15 May 2000) | 2 lines + +Unlimited length in the config file, thanks to Cris van Pelt. + +------------------------------------------------------------------------ +r125 | zarq | 2000-05-15 19:15:52 +0200 (Mon, 15 May 2000) | 2 lines + +Exit with zero status if is empty. + +------------------------------------------------------------------------ +r124 | zarq | 2000-05-15 17:54:37 +0200 (Mon, 15 May 2000) | 2 lines + +Updated to newer version. + +------------------------------------------------------------------------ +r123 | guus | 2000-05-15 11:41:34 +0200 (Mon, 15 May 2000) | 3 lines + +Test for existence of configured tinc networks. This will also make +first install of tinc possible without errors. + +------------------------------------------------------------------------ +r122 | zarq | 2000-05-15 01:03:37 +0200 (Mon, 15 May 2000) | 2 lines + +.deb version number 1.0pre2-0.4. + +------------------------------------------------------------------------ +r121 | zarq | 2000-05-15 01:00:44 +0200 (Mon, 15 May 2000) | 3 lines + +tincd->tinc +Delete libblowfish.y not be in the .deb. + +------------------------------------------------------------------------ +r120 | zarq | 2000-05-15 00:59:47 +0200 (Mon, 15 May 2000) | 2 lines + +Mention both upstream authors. + +------------------------------------------------------------------------ +r119 | zarq | 2000-05-15 00:59:19 +0200 (Mon, 15 May 2000) | 2 lines + +Add description, better dependancies. + +------------------------------------------------------------------------ +r118 | zarq | 2000-05-15 00:58:47 +0200 (Mon, 15 May 2000) | 2 lines + +Add initscript, tincd->tinc. + +------------------------------------------------------------------------ +r117 | zarq | 2000-05-14 23:18:10 +0200 (Sun, 14 May 2000) | 2 lines + +Inserted useful content. + +------------------------------------------------------------------------ +r116 | zarq | 2000-05-14 23:14:23 +0200 (Sun, 14 May 2000) | 2 lines + +Add shlibs control file for the blowfish library. + +------------------------------------------------------------------------ +r115 | zarq | 2000-05-14 23:07:16 +0200 (Sun, 14 May 2000) | 2 lines + +Give IP address instead of hex number when connecting tcp socket failed. + +------------------------------------------------------------------------ +r114 | zarq | 2000-05-14 23:04:53 +0200 (Sun, 14 May 2000) | 2 lines + +Changed version to 1.0pre2. + +------------------------------------------------------------------------ +r113 | zarq | 2000-05-14 22:58:34 +0200 (Sun, 14 May 2000) | 2 lines + +Version 1.0pre1-0.1. + +------------------------------------------------------------------------ +r112 | zarq | 2000-05-14 22:56:41 +0200 (Sun, 14 May 2000) | 2 lines + +Add check for mpz_powm in libgmp3. + +------------------------------------------------------------------------ +r111 | zarq | 2000-05-14 15:50:10 +0200 (Sun, 14 May 2000) | 2 lines + +Only print an error with send_termreq if debug_lvl is 2 or more. + +------------------------------------------------------------------------ +r110 | guus | 2000-05-14 15:06:52 +0200 (Sun, 14 May 2000) | 2 lines + +Fixed typos. + +------------------------------------------------------------------------ +r109 | guus | 2000-05-14 15:02:20 +0200 (Sun, 14 May 2000) | 6 lines + +Changed ping behaviour (backwards compatible). If we don't have any data +to send, we don't need to check if the connection is still alive. +Furthermore, if we receive any kind of data from the other end, we know +it's alive, so we don't need to check it either. So, PING requests are +only sent if we send packets but there is no response. + +------------------------------------------------------------------------ +r108 | guus | 2000-05-14 14:22:42 +0200 (Sun, 14 May 2000) | 2 lines + +Cleanups. + +------------------------------------------------------------------------ +r107 | guus | 2000-05-14 13:39:18 +0200 (Sun, 14 May 2000) | 2 lines + +Proxymode removed. + +------------------------------------------------------------------------ +r106 | zarq | 2000-05-13 02:54:27 +0200 (Sat, 13 May 2000) | 2 lines + +Perl version of the system startup script. + +------------------------------------------------------------------------ +r105 | zarq | 2000-05-12 15:31:00 +0200 (Fri, 12 May 2000) | 2 lines + +Deleted the protocol description. + +------------------------------------------------------------------------ +r104 | guus | 2000-05-08 20:44:15 +0200 (Mon, 08 May 2000) | 4 lines + +Added new config variable "ProxyMode". If enabled, all outgoing packets +are sent to the uplink (ConnectTo), which will have to forward them for +us (kernel should do that). This is for people behind firewalls. + +------------------------------------------------------------------------ +r103 | zarq | 2000-05-05 12:48:54 +0200 (Fri, 05 May 2000) | 2 lines + +Added semicolons required by bash2 (Mads Kiilerich). + +------------------------------------------------------------------------ +r102 | zarq | 2000-05-05 01:26:24 +0200 (Fri, 05 May 2000) | 2 lines + +Copied most of the code from the redhat script. + +------------------------------------------------------------------------ +r101 | zarq | 2000-05-05 01:17:02 +0200 (Fri, 05 May 2000) | 2 lines + +Include sys/types.h. + +------------------------------------------------------------------------ +r100 | zarq | 2000-05-05 01:16:43 +0200 (Fri, 05 May 2000) | 2 lines + +Don't link in libdl. + +------------------------------------------------------------------------ +r99 | zarq | 2000-05-04 02:01:05 +0200 (Thu, 04 May 2000) | 2 lines + +Check for the existance of libdl. + +------------------------------------------------------------------------ +r98 | zarq | 2000-05-04 02:00:50 +0200 (Thu, 04 May 2000) | 2 lines + +More for getopt support. + +------------------------------------------------------------------------ +r97 | zarq | 2000-05-04 02:00:06 +0200 (Thu, 04 May 2000) | 2 lines + +Include stdio.h for fprintf. + +------------------------------------------------------------------------ +r96 | zarq | 2000-05-04 01:47:06 +0200 (Thu, 04 May 2000) | 2 lines + +getopt_long() support for platforms that don't have it. + +------------------------------------------------------------------------ +r95 | zarq | 2000-05-04 01:00:38 +0200 (Thu, 04 May 2000) | 2 lines + +Don't use error.h or error(), put #error in front of cpp errors. + +------------------------------------------------------------------------ +r94 | guus | 2000-05-03 20:02:15 +0200 (Wed, 03 May 2000) | 2 lines + +Squashed gcc warning. + +------------------------------------------------------------------------ +r93 | guus | 2000-05-03 19:59:07 +0200 (Wed, 03 May 2000) | 2 lines + +Fixes typo and UDP network byte order. + +------------------------------------------------------------------------ +r92 | guus | 2000-05-03 17:37:32 +0200 (Wed, 03 May 2000) | 2 lines + +Outgoing packets now use network byte order in header. + +------------------------------------------------------------------------ +r91 | zarq | 2000-05-03 17:01:54 +0200 (Wed, 03 May 2000) | 2 lines + +Fix a typo, better handling of the info document. (from Mads Kiilerich) + +------------------------------------------------------------------------ +r90 | guus | 2000-05-02 12:16:50 +0200 (Tue, 02 May 2000) | 3 lines + +Replaced sprintf() by safer snprintf(), removed possible buffer overflow +by one byte. + +------------------------------------------------------------------------ +r89 | guus | 2000-05-02 11:55:34 +0200 (Tue, 02 May 2000) | 2 lines + +Previous fix fixed. Meta protocol should be really flawless from now on! + +------------------------------------------------------------------------ +r88 | guus | 2000-05-02 11:10:33 +0200 (Tue, 02 May 2000) | 2 lines + +Fixed small mistake that would prevent forwarding requests. + +------------------------------------------------------------------------ +r87 | zarq | 2000-05-02 00:00:02 +0200 (Tue, 02 May 2000) | 2 lines + +Mentioned new metaprotocol. + +------------------------------------------------------------------------ +r86 | zarq | 2000-05-01 23:47:12 +0200 (Mon, 01 May 2000) | 2 lines + +More tincd->tinc updates. + +------------------------------------------------------------------------ +r85 | zarq | 2000-05-01 23:31:59 +0200 (Mon, 01 May 2000) | 2 lines + +Fixed meta protocol. + +------------------------------------------------------------------------ +r84 | zarq | 2000-05-01 23:31:17 +0200 (Mon, 01 May 2000) | 2 lines + +Committed by Mads Kiilerich. + +------------------------------------------------------------------------ +r83 | zarq | 2000-05-01 21:17:09 +0200 (Mon, 01 May 2000) | 2 lines + +Updates by Mads Kiilerich. + +------------------------------------------------------------------------ +r82 | guus | 2000-05-01 20:07:12 +0200 (Mon, 01 May 2000) | 6 lines + +Meta protocol overhaul. Tinc is now incompatible with previous versions, +furthermore this version does NOT work yet because of a problem with +sending keys (these should be converted to base36 or something like that). +It is possible to telnet to the tinc daemon now and type some commands +by hand though :). + +------------------------------------------------------------------------ +r81 | zarq | 2000-05-01 18:28:28 +0200 (Mon, 01 May 2000) | 2 lines + +Committed by Lubom�r Bulej. + +------------------------------------------------------------------------ +r80 | zarq | 2000-04-30 22:48:48 +0200 (Sun, 30 Apr 2000) | 2 lines + +Key forwarding, write one byte extra. + +------------------------------------------------------------------------ +r79 | zarq | 2000-04-30 21:49:49 +0200 (Sun, 30 Apr 2000) | 2 lines + +Protocol fix (ANS_KEY). This breaks 0.3.3 protocol compatibility. + +------------------------------------------------------------------------ +r78 | zarq | 2000-04-30 21:03:00 +0200 (Sun, 30 Apr 2000) | 2 lines + +Send one less byte from an ANS_KEY request. + +------------------------------------------------------------------------ +r77 | zarq | 2000-04-30 20:57:16 +0200 (Sun, 30 Apr 2000) | 2 lines + +Read one less byte from an ANS_KEY request. + +------------------------------------------------------------------------ +r76 | zarq | 2000-04-30 18:34:31 +0200 (Sun, 30 Apr 2000) | 2 lines + +Removed debug messages. + +------------------------------------------------------------------------ +r75 | zarq | 2000-04-30 18:31:23 +0200 (Sun, 30 Apr 2000) | 2 lines + +Read public keys the right way (tm). + +------------------------------------------------------------------------ +r74 | zarq | 2000-04-30 18:11:05 +0200 (Sun, 30 Apr 2000) | 2 lines + +New way of handling the meta protocol. + +------------------------------------------------------------------------ +r73 | zarq | 2000-04-30 15:23:53 +0200 (Sun, 30 Apr 2000) | 2 lines + +Replaced check for status.active by status.dataopen in check_network_activity. + +------------------------------------------------------------------------ +r72 | zarq | 2000-04-30 03:16:51 +0200 (Sun, 30 Apr 2000) | 2 lines + +Initially, the vpn_mask of a connection is 255.255.255.255 to avoid confusion with lookup_conn. + +------------------------------------------------------------------------ +r71 | zarq | 2000-04-30 03:15:47 +0200 (Sun, 30 Apr 2000) | 2 lines + +Got rid of the nasty hacks... and replaced it by another one. + +------------------------------------------------------------------------ +r70 | zarq | 2000-04-29 22:39:36 +0200 (Sat, 29 Apr 2000) | 2 lines + +Filled up the protocol structs with unused bytes. + +------------------------------------------------------------------------ +r69 | zarq | 2000-04-29 22:38:23 +0200 (Sat, 29 Apr 2000) | 2 lines + +Added `deb' target. + +------------------------------------------------------------------------ +r68 | zarq | 2000-04-29 15:56:06 +0200 (Sat, 29 Apr 2000) | 2 lines + +More updates wrt. the change from tincd->tinc. + +------------------------------------------------------------------------ +r67 | guus | 2000-04-28 13:33:25 +0200 (Fri, 28 Apr 2000) | 2 lines + +Oops! Reference to write_n() removed and changed into neat write() call. + +------------------------------------------------------------------------ +r66 | guus | 2000-04-27 22:57:18 +0200 (Thu, 27 Apr 2000) | 2 lines + +Removed write_n() function. + +------------------------------------------------------------------------ +r65 | zarq | 2000-04-27 15:47:51 +0200 (Thu, 27 Apr 2000) | 2 lines + +Default config file name is tinc.conf, and pidfile is tinc.pid. + +------------------------------------------------------------------------ +r64 | zarq | 2000-04-27 02:07:17 +0200 (Thu, 27 Apr 2000) | 2 lines + +Updated version number to 1.0. + +------------------------------------------------------------------------ +r63 | zarq | 2000-04-27 02:01:00 +0200 (Thu, 27 Apr 2000) | 2 lines + +Filled in the details, license from libblowfish copied. + +------------------------------------------------------------------------ +r62 | zarq | 2000-04-27 01:56:22 +0200 (Thu, 27 Apr 2000) | 3 lines + +Version to 1.0pre1; +Create Makefile and build in debian/. + +------------------------------------------------------------------------ +r61 | zarq | 2000-04-27 01:23:01 +0200 (Thu, 27 Apr 2000) | 2 lines + +Omit TODO. + +------------------------------------------------------------------------ +r60 | zarq | 2000-04-27 00:42:15 +0200 (Thu, 27 Apr 2000) | 2 lines + +Add an entry to dir. + +------------------------------------------------------------------------ +r59 | zarq | 2000-04-27 00:01:01 +0200 (Thu, 27 Apr 2000) | 2 lines + +The make command is in /usr/bin. + +------------------------------------------------------------------------ +r58 | guus | 2000-04-26 19:42:55 +0200 (Wed, 26 Apr 2000) | 4 lines + +Cleanups: +- Changed recv/send calls into read/write calls for streams +- Made all sizeof() functions use a variable name instead of type + +------------------------------------------------------------------------ +r57 | zarq | 2000-04-26 16:54:43 +0200 (Wed, 26 Apr 2000) | 2 lines + +From Mads Kiilerich. + +------------------------------------------------------------------------ +r56 | guus | 2000-04-26 00:15:28 +0200 (Wed, 26 Apr 2000) | 2 lines + +Converted every &variable[0] to variable. + +------------------------------------------------------------------------ +r55 | zarq | 2000-04-26 00:00:49 +0200 (Wed, 26 Apr 2000) | 2 lines + +Debug level tweaking. + +------------------------------------------------------------------------ +r54 | guus | 2000-04-25 22:50:59 +0200 (Tue, 25 Apr 2000) | 4 lines + +When trying to talk to a host that is in the netmask of a tinc server but +not the tinc server itself, and no keys have been exchanged yet, the key +request would be directed to the host instead of the server. Fixed. + +------------------------------------------------------------------------ +r53 | zarq | 2000-04-25 22:42:54 +0200 (Tue, 25 Apr 2000) | 2 lines + +*** empty log message *** + +------------------------------------------------------------------------ +r52 | guus | 2000-04-25 22:17:44 +0200 (Tue, 25 Apr 2000) | 2 lines + +Fixed typo and removed some unnecessary variables. + +------------------------------------------------------------------------ +r51 | guus | 2000-04-25 22:10:37 +0200 (Tue, 25 Apr 2000) | 2 lines + +Packet queues fixed. They caused the trouble when resending keys. + +------------------------------------------------------------------------ +r50 | zarq | 2000-04-25 21:23:23 +0200 (Tue, 25 Apr 2000) | 2 lines + +Create a ChangeLog file, automake requires it. + +------------------------------------------------------------------------ +r49 | zarq | 2000-04-25 21:21:19 +0200 (Tue, 25 Apr 2000) | 2 lines + +*** empty log message *** + +------------------------------------------------------------------------ +r48 | zarq | 2000-04-25 21:11:02 +0200 (Tue, 25 Apr 2000) | 2 lines + +Initial CVS. + +------------------------------------------------------------------------ +r47 | guus | 2000-04-25 20:57:23 +0200 (Tue, 25 Apr 2000) | 2 lines + +Added checkpoints to beginning and ending of every function. + +------------------------------------------------------------------------ +r46 | zarq | 2000-04-25 19:38:54 +0200 (Tue, 25 Apr 2000) | 2 lines + +Remove ChangeLog with a `make cvs-clean'. + +------------------------------------------------------------------------ +r45 | zarq | 2000-04-25 19:35:45 +0200 (Tue, 25 Apr 2000) | 2 lines + +Don't include TODO in the dist. + +------------------------------------------------------------------------ +r44 | zarq | 2000-04-25 17:08:10 +0200 (Tue, 25 Apr 2000) | 2 lines + +Propagate CFLAGS from configure to gcc. + +------------------------------------------------------------------------ +r43 | zarq | 2000-04-25 17:07:21 +0200 (Tue, 25 Apr 2000) | 2 lines + +Delete all the files that are created by autogen.sh on a `make cvs-clean'. + +------------------------------------------------------------------------ +r42 | zarq | 2000-04-25 12:40:08 +0200 (Tue, 25 Apr 2000) | 2 lines + +Spelling fixes. + +------------------------------------------------------------------------ +r41 | zarq | 2000-04-25 12:27:44 +0200 (Tue, 25 Apr 2000) | 2 lines + +Contributed by Mads Kiilerich. + +------------------------------------------------------------------------ +r40 | zarq | 2000-04-25 12:22:26 +0200 (Tue, 25 Apr 2000) | 2 lines + +Generate this Makefile.am from Makefile.am.in. + +------------------------------------------------------------------------ +r39 | zarq | 2000-04-25 11:43:50 +0200 (Tue, 25 Apr 2000) | 2 lines + +*** empty log message *** + +------------------------------------------------------------------------ +r38 | zarq | 2000-04-25 11:42:52 +0200 (Tue, 25 Apr 2000) | 2 lines + +Added Mads Kiilerich, removed Guus Sliepen. + +------------------------------------------------------------------------ +r37 | zarq | 2000-04-25 03:45:34 +0200 (Tue, 25 Apr 2000) | 3 lines + +Changes largely from Mads Kiilerich. +Removed section about encryption. + +------------------------------------------------------------------------ +r36 | zarq | 2000-04-25 03:26:35 +0200 (Tue, 25 Apr 2000) | 2 lines + +Remove test for GNOME. + +------------------------------------------------------------------------ +r35 | zarq | 2000-04-25 03:25:18 +0200 (Tue, 25 Apr 2000) | 2 lines + +Use `make ChangeLog' to create this file from the CVS logs. + +------------------------------------------------------------------------ +r34 | zarq | 2000-04-25 03:23:31 +0200 (Tue, 25 Apr 2000) | 2 lines + +Don't define HAVE_NAMESPACES and HAVE_STL. + +------------------------------------------------------------------------ +r33 | zarq | 2000-04-25 03:22:01 +0200 (Tue, 25 Apr 2000) | 2 lines + +Remove check for bigendianness. + +------------------------------------------------------------------------ +r32 | zarq | 2000-04-25 03:15:28 +0200 (Tue, 25 Apr 2000) | 2 lines + +This file is obsolete, most of the ideas are already in echelon. + +------------------------------------------------------------------------ +r31 | zarq | 2000-04-25 03:10:38 +0200 (Tue, 25 Apr 2000) | 2 lines + +s/Gnome/tinc/g + +------------------------------------------------------------------------ +r30 | zarq | 2000-04-25 02:50:48 +0200 (Tue, 25 Apr 2000) | 3 lines + +The shell script autogen.sh can create all these removed files, but be +sure to have autoconf, automake, libtool and more installed. + +------------------------------------------------------------------------ +r29 | zarq | 2000-04-25 02:11:33 +0200 (Tue, 25 Apr 2000) | 2 lines + +Don't try to create cipher/idea/Makefile. + +------------------------------------------------------------------------ +r28 | zarq | 2000-04-24 23:12:32 +0200 (Mon, 24 Apr 2000) | 2 lines + +Don't include idea/idea.h. + +------------------------------------------------------------------------ +r27 | zarq | 2000-04-24 23:10:33 +0200 (Mon, 24 Apr 2000) | 2 lines + +Don't compile in `idea'. + +------------------------------------------------------------------------ +r26 | zarq | 2000-04-24 22:57:22 +0200 (Mon, 24 Apr 2000) | 2 lines + +These files are not needed in release 1.0. + +------------------------------------------------------------------------ +r25 | guus | 2000-04-24 11:39:50 +0200 (Mon, 24 Apr 2000) | 3 lines + +Bug found! Wrong pointer was used for handling multiple ADD_HOST requests +at once. (See line 606.) + +------------------------------------------------------------------------ +r24 | guus | 2000-04-24 10:32:57 +0200 (Mon, 24 Apr 2000) | 3 lines + +Added extra checks for desynchronized connection lists. Hopefully this will +fix those strange segmentation faults. + +------------------------------------------------------------------------ +r23 | zarq | 2000-04-21 00:50:48 +0200 (Fri, 21 Apr 2000) | 2 lines + +Added cvs-clean. + +------------------------------------------------------------------------ +r22 | zarq | 2000-04-20 21:14:09 +0200 (Thu, 20 Apr 2000) | 2 lines + +Keep make dist(dir) happy. + +------------------------------------------------------------------------ +r21 | zarq | 2000-04-18 22:44:29 +0200 (Tue, 18 Apr 2000) | 2 lines + +A short notice from Mads Kiilerich. + +------------------------------------------------------------------------ +r20 | zarq | 2000-04-18 22:43:24 +0200 (Tue, 18 Apr 2000) | 2 lines + +Submitted changes by Mads Kiilerich. + +------------------------------------------------------------------------ +r19 | zarq | 2000-04-18 22:30:20 +0200 (Tue, 18 Apr 2000) | 2 lines + +Include genauth.8 in the distribution. + +------------------------------------------------------------------------ +r18 | zarq | 2000-04-18 22:26:49 +0200 (Tue, 18 Apr 2000) | 2 lines + +Include the directory redhat in the build process. + +------------------------------------------------------------------------ +r17 | zarq | 2000-04-18 18:04:10 +0200 (Tue, 18 Apr 2000) | 2 lines + +Address for bugreports changed to tinc@nl.linux.org. + +------------------------------------------------------------------------ +r16 | zarq | 2000-04-18 17:59:42 +0200 (Tue, 18 Apr 2000) | 2 lines + +Updated manpages. + +------------------------------------------------------------------------ +r15 | zarq | 2000-04-18 17:59:22 +0200 (Tue, 18 Apr 2000) | 2 lines + +New manpage for genauth. + +------------------------------------------------------------------------ +r14 | zarq | 2000-04-18 17:09:11 +0200 (Tue, 18 Apr 2000) | 2 lines + +Submitted by Mads Kiilerich. + +------------------------------------------------------------------------ +r13 | zarq | 2000-04-17 19:04:33 +0200 (Mon, 17 Apr 2000) | 2 lines + +Default passphrase length of 1024, added -h/--help options. + +------------------------------------------------------------------------ +r12 | zarq | 2000-04-17 18:59:42 +0200 (Mon, 17 Apr 2000) | 2 lines + +Check if stdout is a terminal, if so, print a verbose message. + +------------------------------------------------------------------------ +r11 | zarq | 2000-04-17 18:52:58 +0200 (Mon, 17 Apr 2000) | 2 lines + +Check for an illegal length of passphrase in read_passphrase(). + +------------------------------------------------------------------------ +r10 | zarq | 2000-04-17 18:23:29 +0200 (Mon, 17 Apr 2000) | 2 lines + +Pass the requested size from xmalloc() and xrealloc() on to xalloc_fail_func() + +------------------------------------------------------------------------ +r9 | zarq | 2000-04-17 17:38:47 +0200 (Mon, 17 Apr 2000) | 4 lines + +Only one round of reading bits out of urandom; +Reading `bytes' bytes out of it; +Print a newline after completion. + +------------------------------------------------------------------------ +r8 | zarq | 2000-04-12 18:22:39 +0200 (Wed, 12 Apr 2000) | 2 lines + +Moved to version number 1.0. + +------------------------------------------------------------------------ +r7 | zarq | 2000-04-06 20:28:29 +0200 (Thu, 06 Apr 2000) | 2 lines + +New option -D, don't detach. + +------------------------------------------------------------------------ +r6 | zarq | 2000-03-28 21:16:27 +0200 (Tue, 28 Mar 2000) | 2 lines + +Ignore SIGCHLD. + +------------------------------------------------------------------------ +r5 | zarq | 2000-03-28 21:09:52 +0200 (Tue, 28 Mar 2000) | 2 lines + +Kill the parent after any error conditions in detach(). + +------------------------------------------------------------------------ +r4 | zarq | 2000-03-28 00:59:16 +0200 (Tue, 28 Mar 2000) | 2 lines + +Upon regeneration, free the old encryption key `securely\' by overwriting it. + +------------------------------------------------------------------------ +r3 | zarq | 2000-03-28 00:30:27 +0200 (Tue, 28 Mar 2000) | 2 lines + +Get rid of the message `zxnrbl\'. + +------------------------------------------------------------------------ +r1 | zarq | 2000-03-26 01:33:07 +0100 (Sun, 26 Mar 2000) | 2 lines + +Initial revision + +------------------------------------------------------------------------ diff --git a/INSTALL b/INSTALL index b42a17a..54caf7c 100644 --- a/INSTALL +++ b/INSTALL @@ -1,3 +1,9 @@ +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software +Foundation, Inc. + + This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + Basic Installation ================== @@ -8,20 +14,27 @@ 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'). +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. (Caching is +disabled by default to prevent problems with accidental use of stale +cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can -be considered for the next release. If at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. - The file `configure.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 file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You only need +`configure.ac' if you want to change it or regenerate `configure' using +a newer version of `autoconf'. The simplest way to compile this package is: @@ -55,14 +68,16 @@ 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 +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. -Or on systems that have the `env' program, you can do it like this: - env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== @@ -75,11 +90,11 @@ 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. + If you have to use a `make' that does not support the `VPATH' +variable, you have to compile the package for one architecture at a +time in the source code directory. After you have installed the +package for one architecture, use `make distclean' before reconfiguring +for another architecture. Installation Names ================== @@ -122,22 +137,32 @@ you can use the `configure' options `--x-includes=DIR' and 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: + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + CPU-COMPANY-SYSTEM -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. +where SYSTEM can have one of these forms: - If you are building compiler tools for cross-compiling, you can also + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should use the `--target=TYPE' option to select the type of system they will -produce code for and the `--build=TYPE' option to select the type of -system on which you are compiling the package. +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. Sharing Defaults ================ @@ -150,20 +175,44 @@ default values for variables like `CC', `cache_file', and `prefix'. `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. -Operation Controls +Defining Variables ================== + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +will cause the specified gcc to be used as the C compiler (unless it is +overridden in the site shell script). + +`configure' Invocation +====================== + `configure' recognizes the following options to control how it operates. -`--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' +`-h' Print a summary of the options to `configure', and exit. +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + `--quiet' `--silent' `-q' @@ -175,8 +224,6 @@ operates. 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. Run +`configure --help' for more details. -`configure' also accepts some other, not widely useful, options. diff --git a/Makefile.am b/Makefile.am index 805c312..306a0ed 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,24 +2,17 @@ AUTOMAKE_OPTIONS = gnu -SUBDIRS = m4 intl lib src doc po +SUBDIRS = m4 lib src doc po -ACLOCAL_AMFLAGS = +ACLOCAL_AMFLAGS = -I m4 -EXTRA_DIST = system.h COPYING.README depcomp - -CVS_CREATED = ABOUT-NLS configure aclocal.m4 config.h.in config.guess \ - config.sub install-sh ltconfig ltmain.sh missing mkinstalldirs \ - stamp-h.in m4/Makefile.am ChangeLog po/Makefile.in.in \ - po/tinc.pot src/.libs intl depcomp +EXTRA_DIST = config.rpath mkinstalldirs have.h system.h COPYING.README depcomp ChangeLog: - cvs2cl -U cvsusers --fsf + svn log > ChangeLog -cvs-clean: maintainer-clean - for f in $(CVS_CREATED) `find . -name Makefile.in` tinc-$(VERSION).tar.gz; do\ - rm -Rf "$$f"; \ - done +svn-clean: maintainer-clean + svn status --no-ignore | sed -n 's/^[?I] \+//p' | tr '\012' '\0' | xargs -r0 rm -rf deb: dpkg-buildpackage -rfakeroot diff --git a/Makefile.in b/Makefile.in index 46f73d7..bb2fbc9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,7 +1,8 @@ -# Makefile.in generated automatically by automake 1.5 from Makefile.am. +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -12,166 +13,229 @@ # PARTICULAR PURPOSE. @SET_MAKE@ - -SHELL = @SHELL@ - srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) -transform = @program_transform_name@ +transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -host_alias = @host_alias@ host_triplet = @host@ +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(top_srcdir)/configure ABOUT-NLS AUTHORS COPYING ChangeLog \ + INSTALL NEWS THANKS TODO config.guess config.rpath config.sub \ + depcomp install-sh missing mkinstalldirs +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \ + $(top_srcdir)/m4/attribute.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/lzo.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/openssl.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/tuntap.m4 \ + $(top_srcdir)/m4/zlib.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno configure.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ -BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ CPP = @CPP@ -DATADIRNAME = @DATADIRNAME@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ EXEEXT = @EXEEXT@ -GENCAT = @GENCAT@ -GLIBC21 = @GLIBC21@ -GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ HAVE_TUNTAP = @HAVE_TUNTAP@ INCLUDES = @INCLUDES@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLBISON = @INTLBISON@ INTLLIBS = @INTLLIBS@ -INTLOBJS = @INTLOBJS@ -INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ +LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ LINUX_IF_TUN_H = @LINUX_IF_TUN_H@ LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ -PERL = @PERL@ -POFILES = @POFILES@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ POSUB = @POSUB@ RANLIB = @RANLIB@ -USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ +am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ install_sh = @install_sh@ - +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ AUTOMAKE_OPTIONS = gnu - -SUBDIRS = m4 intl lib src doc po - -ACLOCAL_AMFLAGS = - -EXTRA_DIST = system.h COPYING.README depcomp - -CVS_CREATED = ABOUT-NLS configure aclocal.m4 config.h.in config.guess \ - config.sub install-sh ltconfig ltmain.sh missing mkinstalldirs \ - stamp-h.in m4/Makefile.am ChangeLog po/Makefile.in.in \ - po/tinc.pot src/.libs intl depcomp - -subdir = . -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = intl/Makefile -DIST_SOURCES = - -RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ - uninstall-info-recursive all-recursive install-data-recursive \ - install-exec-recursive installdirs-recursive install-recursive \ - uninstall-recursive check-recursive installcheck-recursive -DIST_COMMON = README ./stamp-h.in ABOUT-NLS AUTHORS COPYING ChangeLog \ - INSTALL Makefile.am Makefile.in NEWS THANKS TODO acconfig.h \ - aclocal.m4 config.guess config.h.in config.sub configure \ - configure.in install-sh missing mkinstalldirs -DIST_SUBDIRS = $(SUBDIRS) +SUBDIRS = m4 lib src doc po +ACLOCAL_AMFLAGS = -I m4 +EXTRA_DIST = config.rpath mkinstalldirs have.h system.h COPYING.README depcomp all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +am--refresh: + @: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ + cd $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && \ - CONFIG_HEADERS= CONFIG_LINKS= \ - CONFIG_FILES=$@ $(SHELL) ./config.status +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; -$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck -$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) - cd $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): configure.in +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -config.h: stamp-h + +config.h: stamp-h1 @if test ! -f $@; then \ - rm -f stamp-h; \ - $(MAKE) stamp-h; \ + rm -f stamp-h1; \ + $(MAKE) stamp-h1; \ else :; fi -stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status - @rm -f stamp-h stamp-hT - @echo timestamp > stamp-hT 2> /dev/null - cd $(top_builddir) \ - && CONFIG_FILES= CONFIG_HEADERS=config.h \ - $(SHELL) ./config.status - @mv stamp-hT stamp-h -$(srcdir)/config.h.in: $(srcdir)/./stamp-h.in - @if test ! -f $@; then \ - rm -f $(srcdir)/./stamp-h.in; \ - $(MAKE) $(srcdir)/./stamp-h.in; \ - else :; fi -$(srcdir)/./stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/acconfig.h - @rm -f $(srcdir)/./stamp-h.in $(srcdir)/./stamp-h.inT - @echo timestamp > $(srcdir)/./stamp-h.inT 2> /dev/null + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) - @mv $(srcdir)/./stamp-h.inT $(srcdir)/./stamp-h.in + rm -f stamp-h1 + touch $@ distclean-hdr: - -rm -f config.h -intl/Makefile: $(top_builddir)/config.status $(top_srcdir)/intl/Makefile.in - cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= CONFIG_LINKS= $(SHELL) ./config.status + -rm -f config.h stamp-h1 uninstall-info-am: # This directory's subdirectories are mostly independent; you can cd @@ -181,7 +245,7 @@ uninstall-info-am: # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): - @set fnord $(MAKEFLAGS); amf=$$2; \ + @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ @@ -201,7 +265,7 @@ $(RECURSIVE_TARGETS): mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: - @set fnord $(MAKEFLAGS); amf=$$2; \ + @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ @@ -228,80 +292,111 @@ tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done - -tags: TAGS +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - mkid -fID $$unique $(LISP) + mkid -fID $$unique +tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ - list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \ - || etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique GTAGS: - here=`CDPATH=: && cd $(top_builddir) && pwd` \ + here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = . -# Avoid unsightly `./'. -distdir = $(PACKAGE)-$(VERSION) - -GZIP_ENV = --best + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir) + $(am__remove_distdir) mkdir $(distdir) - $(mkinstalldirs) $(distdir)/intl $(distdir)/po - @for file in $(DISTFILES); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ + $(mkdir_p) $(distdir)/m4 $(distdir)/po + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - $(mkinstalldirs) "$(distdir)/$$dir"; \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ fi; \ if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir) \ - || exit 1; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done - for subdir in $(SUBDIRS); do \ + list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ + test -d "$(distdir)/$$subdir" \ + || mkdir "$(distdir)/$$subdir" \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" \ - distdir=../$(distdir)/$$subdir \ + top_distdir="../$(top_distdir)" \ + distdir="../$(distdir)/$$subdir" \ distdir) \ || exit 1; \ fi; \ @@ -311,48 +406,103 @@ distdir: $(DISTFILES) ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) -dist: distdir +dist-gzip: distdir $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir) + $(am__remove_distdir) + +dist-bzip2: distdir + $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-tarZ: distdir + $(AMTAR) chof - $(distdir) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist - -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(AMTAR) xf - ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(AMTAR) xf - ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac chmod -R a-w $(distdir); chmod a+w $(distdir) - mkdir $(distdir)/=build - mkdir $(distdir)/=inst + mkdir $(distdir)/_build + mkdir $(distdir)/_inst chmod a-w $(distdir) - dc_install_base=`CDPATH=: && cd $(distdir)/=inst && pwd` \ - && cd $(distdir)/=build \ - && ../configure --srcdir=.. --prefix=$$dc_install_base \ - --with-included-gettext \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && (test `find $$dc_install_base -type f -print | wc -l` -le 1 \ - || (echo "Error: files left after uninstall" 1>&2; \ - exit 1) ) \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ - && $(MAKE) $(AM_MAKEFLAGS) distclean \ - && rm -f $(distdir).tar.gz \ - && (test `find . -type f -print | wc -l` -eq 0 \ - || (echo "Error: files left after distclean" 1>&2; \ - exit 1) ) - -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) - @echo "$(distdir).tar.gz is ready for distribution" | \ - sed 'h;s/./=/g;p;x;p;x' + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile config.h installdirs: installdirs-recursive installdirs-am: - install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive @@ -364,6 +514,7 @@ install-am: all-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: @@ -371,7 +522,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* + -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -380,17 +531,17 @@ clean: clean-recursive clean-am: clean-generic mostlyclean-am -dist-all: distdir - $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir) distclean: distclean-recursive - -rm -f config.status config.cache config.log + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: +html: html-recursive + info: info-recursive info-am: @@ -406,40 +557,48 @@ install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive - + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + uninstall-am: uninstall-info-am uninstall-info: uninstall-info-recursive -.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ - clean-generic clean-recursive dist dist-all distcheck distclean \ - distclean-generic distclean-hdr distclean-recursive \ - distclean-tags distdir dvi dvi-am dvi-recursive info info-am \ - info-recursive install install-am install-data install-data-am \ - install-data-recursive install-exec install-exec-am \ - install-exec-recursive install-info install-info-am \ - install-info-recursive install-man install-recursive \ - install-strip installcheck installcheck-am installdirs \ - installdirs-am installdirs-recursive maintainer-clean \ - maintainer-clean-generic maintainer-clean-recursive mostlyclean \ - mostlyclean-generic mostlyclean-recursive tags tags-recursive \ - uninstall uninstall-am uninstall-info-am \ - uninstall-info-recursive uninstall-recursive +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ + check-am clean clean-generic clean-recursive ctags \ + ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \ + dist-tarZ dist-zip distcheck distclean distclean-generic \ + distclean-hdr distclean-recursive distclean-tags \ + distcleancheck distdir distuninstallcheck dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-recursive pdf \ + pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ + uninstall-info-am ChangeLog: - cvs2cl -U cvsusers --fsf + svn log > ChangeLog -cvs-clean: maintainer-clean - for f in $(CVS_CREATED) `find . -name Makefile.in` tinc-$(VERSION).tar.gz; do\ - rm -Rf "$$f"; \ - done +svn-clean: maintainer-clean + svn status --no-ignore | sed -n 's/^[?I] \+//p' | tr '\012' '\0' | xargs -r0 rm -rf deb: dpkg-buildpackage -rfakeroot diff --git a/NEWS b/NEWS index 0317dd5..19a097f 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,74 @@ +version 1.0.3 Nov 11 2004 + +* Show error message when failing to write a PID file. + +* Ignore spaces at end of lines in config files. + +* Fix handling of late packets. + +* Unify BSD tun/tap device handling. This allows IPv6 on tun devices and + anything on tap devices as long as the underlying OS supports it. + +* Handle IPv6 on Solaris tun devices. + +* Allow tinc to work properly under Windows XP SP2. + +* Allow VLAN tagged Ethernet frames in switch and hub mode. + +* Experimental PMTUDiscovery, TunnelServer and BlockingTCP options. + +version 1.0.2 Nov 8 2003 + +* Fix address and hostname resolving under Windows. + +* Remove warnings about non-existing scripts and unsupported address families. + +* Use the event logger under Windows. + +* Fix quoting of filenames and command line arguments under Windows. + +* Strict checks for length incoming network packets and return values of + cryptographic functions, + +* Fix a bug in metadata handling that made the tinc daemon abort. + +version 1.0.1 Aug 14 2003 + +* Allow empty lines in config files. + +* Fix handling of spaces and backslashes in filenames under native Windows. + +* Allow scripts to be executed under native Windows. + +* Update documentation, make it less Linux specific. + +version 1.0 Aug 4 2003 + +* Lots of small bugfixes and code cleanups. + +* Throughput doubled and latency reduced. + +* Added support for LZO compression. + +* No need to set MAC address or disable ARP anymore. + +* Added support for Windows 2000 and XP, both natively and in a Cygwin + environment. + +version 1.0pre8 Sep 16 2002 + +* More fixes for subnets with prefixlength undivisible by 8. + +* Added support for NetBSD and MacOS/X. + +* Switched from undirected graphs to directed graphs to avoid certain race + conditions and improve scalability. + +* Generalized broadcasting and forwarding of protocol messages. + +* Cleanup of source code. + + version 1.0pre7 Apr 7 2002 * Don't do blocking read()s when getting a signal. diff --git a/README b/README index d75d7f6..a3d447c 100644 --- a/README +++ b/README @@ -1,10 +1,10 @@ -This is the README file for tinc version 1.0pre7. Installation +This is the README file for tinc version 1.0.3. Installation instructions may be found in the INSTALL file. -tinc is Copyright (C) 1998-2002 by: +tinc is Copyright (C) 1998-2004 by: -Ivo Timmermans , -Guus Sliepen , +Ivo Timmermans , +Guus Sliepen , and others. For a complete list of authors see the AUTHORS file. @@ -31,6 +31,14 @@ launch a denial of service attack by replaying intercepted packets. The current version adds sequence numbers and message authentication codes to prevent such attacks. +On September the 15th of 2003, Peter Gutmann contacted us and showed us a +writeup describing various security issues in several VPN daemons. He showed +that tinc lacks perfect forward security, the connection authentication could +be done more properly, that the sequence number we use as an IV is not the best +practice and that the default length of the HMAC for packets is too short in +his opinion. We do not know of a way to exploit these weaknesses, but we will +address these issues in tinc 2.0. + Cryptography is a hard thing to get right. We cannot make any guarantees. Time, review and feedback are the only things that can prove the security of any cryptographic product. If you wish to review @@ -44,13 +52,19 @@ Some configuration variables have different names now. Most notably "TapDevice" should be changed into "Device", and "Device" should be changed into "BindToDevice". +Compatibility +------------- + +Version 1.0.3 is compatible with 1.0pre8, 1.0 and later, but not with older +versions of tinc. + Requirements ------------ Since 1.0pre3, we use OpenSSL for all cryptographic functions. So you need to install this library first; grab it from -http://www.openssl.org/. We recommend version 0.9.5 or better. If +http://www.openssl.org/. You will need version 0.9.7 or later. If this library is not installed on you system, configure will fail. The manual in doc/tinc.texi contains more detailed information on how to install this library. @@ -60,8 +74,11 @@ library whether or not you plan to enable the compression. You can find it at http://www.gzip.org/zlib/. Because of a possible exploit in earlier versions we recommand that you download version 1.1.4 or later. -In order to compile tinc, you will also need autoconf, automake, GNU make, m4 -and gettext. +Since 1.0, the lzo library is also used for optional compression. You need this +library whether or not you plan to enable compression. You can find it at +http://www.oberhumer.com/opensource/lzo/. + +In order to compile tinc, you will need a GNU C compiler environment. Features @@ -70,17 +87,7 @@ Features This version of tinc supports multiple virtual networks at once. To use this feature, you may supply a netname via the -n or --net options. The standard locations for the config files will then be -/etc/tinc//. Because of this feature, tinc will send packets -directly to their destinations, instead of to the uplink. If this -behaviour is undesirable (for instance because of firewalls or other -restrictions), please use an older version of tinc (I would recommend -tinc-0.2.19). - -In order to force the kernel to accept received packets, the -destination MAC address will be set to FE:FD:00:00:00:00 upon -reception. The MAC address of the ethertap or tun/tap interface must -also be set to this address. See the manual for more detailed -information. +/etc/tinc//. tincd regenerates its encryption key pairs. It does this on the first activity after the keys have expired. This period is adjustable in the @@ -96,7 +103,7 @@ Since pre5, tinc can operate in several routing modes. The default mode, determine the destination of packets. The other two modes, "switch" and "hub", allow the tinc daemons to work together like a single network switch or hub. This is useful for bridging networks. The latter modes only work properly on -Linux and FreeBSD. +Linux, FreeBSD and Windows. The algorithms used for encryption and generating message authentication codes can now be changed in the configuration files. All cipher and digest algorithms @@ -107,11 +114,17 @@ etcetera. Support for routing IPv6 packets has been added. Just add Subnet lines with IPv6 addresses (without using :: abbreviations) and use ifconfig or ip (from the iproute package) to give the virtual network interface corresponding IPv6 -addresses. Autoconfiguration will not work in router mode. Tunneling IPv6 -packets only works on Linux, FreeBSD and possibly OpenBSD. +addresses. tinc does not provide autoconfiguration for IPv6 hosts, if you need +it use radvd or zebra. Tunneling IPv6 packets only works on Linux, FreeBSD, +Windows and possibly OpenBSD. + +It is also possible to make tunnels to other tinc daemons over IPv6 networks, +if the operating system supports IPv6. tinc will automatically use both IPv6 +and IPv4 when available, but this can be changed by adding the option +"AddressFamily = ipv4" or "AddressFamily = ipv6" to the tinc.conf file. + +Normally, when started tinc will detach and run in the background. In a native +Windows environment this means tinc will intall itself as a service, which will +restart after reboots. To prevent tinc from detaching or running as a service, +use the -D option. -It is also possible to make tunnels to other tinc daemons over IPv6 networks. -In order to enable this feature the option "AddressFamily = any" or -"AddressFamily = ipv6" must be added to the tinc.conf file. The host -configuration files should contain IPv6 addresses for the "Address" variables, -or hostnames which have an AAAA or A6 record. diff --git a/THANKS b/THANKS index e4cfd6d..8210465 100644 --- a/THANKS +++ b/THANKS @@ -1,25 +1,32 @@ -We would like to thank +We would like to thank the following people for their contributions to tinc: - * Hans Bayle (for making some useful coding suggestions and fixing a - bug or two) - * Lubomír Bulej (for the Redhat system init script) - * Wessel Dankers (for the name `tinc' and various suggestions) - * Mads Kiilerich (for finding some bugs and some errors in the - documentation, and for making several suggestions to make it all - more userfriendly, and the Redhat package) - * James MacLean (for fixing several mission critical bugs, and for - giving me a few good ideas, and, most of all, for the wonderful - testing and debugging) - * Robert van der Meulen (early configuration code) - * Cris van Pelt (small fixes) - * Enrique Zanardi (for the Spanish translation) - * Matias Carrasco (for the Spanish translation of the manual) - * Jamie Briggs (for finding a lot of socket leaks) - * Armijn Hemel (for being our very own PR manager) - * Jerome Etienne (for a thorough security analysis of tinc) - * Mark Glines (for his compression patch) +* Alexander Reil and Gemeinde Berg +* Allesandro Gatti +* Armijn Hemel +* Cris van Pelt +* Enrique Zanardi +* Flynn Marquardt +* Hans Bayle +* Ivo van Dong +* James MacLean +* Jamie Briggs +* Jason Harper +* Jeroen Ubbink +* Jerome Etienne +* Lubomír Bulej +* Mads Kiilerich +* Marc A. Lehmann +* Mark Glines +* Martin Kihlgren +* Matias Carrasco +* Nick Patavalis +* Paul Littlefield +* Robert van der Meulen +* Teemu Kiviniemi +* Wessel Dankers +* Wouter van Heyst -for their help, support and ideas. Thank you guys! +And everyone we forgot. Thank you guys! Ivo Timmermans Guus Sliepen diff --git a/TODO b/TODO index c0f2ee3..d6a6df4 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,3 @@ TODO LIST -1.0: - -* A nice, secure and stable release +* Think of new things to do. diff --git a/acconfig.h b/acconfig.h deleted file mode 100644 index 41fdb99..0000000 --- a/acconfig.h +++ /dev/null @@ -1,77 +0,0 @@ -/* Define to the name name of this package */ -#undef PACKAGE - -/* Define to the version of the package */ -#undef VERSION - -/* Define to rpl_malloc if the replacement function should be used. */ -#undef malloc - -/* Define to rpl_realloc if the replacement function should be used. */ -#undef realloc - -/* This is always defined. It enables GNU extensions on systems that - have them. */ -#if !defined(_GNU_SOURCE) -# undef _GNU_SOURCE -#endif - -#if !defined(__USE_BSD) -# undef __USE_BSD -#endif - - -/* Define to 1 if NLS is requested. */ -#undef ENABLE_NLS - -/* Define as 1 if you have catgets and don't want to use GNU gettext. */ -#undef HAVE_CATGETS - -/* Define as 1 if you have gettext and don't want to use GNU gettext. */ -#undef HAVE_GETTEXT - -/* Define if your locale.h file contains LC_MESSAGES. */ -#undef HAVE_LC_MESSAGES - -/* Define to 1 if you have the stpcpy function. */ -#undef HAVE_STPCPY - -/* For getopt */ -#if HAVE_STDLIB_H -# define getopt system_getopt -# include -# undef getopt -#endif - -/* Linux */ -#undef HAVE_LINUX - -/* FreeBSD */ -#undef HAVE_FREEBSD - -/* OpenBSD */ -#undef HAVE_OPENBSD - -/* Solaris */ -#undef HAVE_SOLARIS - -/* NetBSD */ -#undef HAVE_NETBSD - -/* Define to the location of the kernel sources */ -#undef CONFIG_TINC_KERNELDIR - -/* Define to 1 if tun/tap support is enabled and found */ -#undef HAVE_TUNTAP - -/* Define to the location of if_tun.h */ -#undef LINUX_IF_TUN_H - -/* Define to 1 if support for jumbograms is enabled */ -#undef ENABLE_JUMBOGRAMS - -/* Define to 1 if checkpoint tracing is enabled */ -#undef ENABLE_TRACING - -/* Define to enable use of old SSLeay_add_all_algorithms() function */ -#undef HAVE_SSLEAY_ADD_ALL_ALGORITHMS diff --git a/aclocal.m4 b/aclocal.m4 index 46a4f8c..21a3464 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,6 +1,6 @@ -# aclocal.m4 generated automatically by aclocal 1.5 +# generated automatically by aclocal 1.8.5 -*- Autoconf -*- -# Copyright 1996, 1997, 1998, 1999, 2000, 2001 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -11,11 +11,164 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# Do all the work for Automake. This macro actually does too much -- -# some checks are only needed if your package does certain things. -# But this isn't really a big deal. +# -*- Autoconf -*- +# Copyright (C) 2002, 2003 Free Software Foundation, Inc. +# Generated from amversion.in; do not edit by hand. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.8"]) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION so it can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], + [AM_AUTOMAKE_VERSION([1.8.5])]) + +# AM_AUX_DIR_EXPAND + +# Copyright (C) 2001, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 6 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE]) +AC_SUBST([$1_FALSE]) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]) +fi])]) + +# serial 7 -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. -# serial 5 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, @@ -24,87 +177,693 @@ # CC etc. in the Makefile, will ask for an AC_PROG_CC use... -# We require 2.13 because we rely on SHELL being computed by configure. -AC_PREREQ([2.13]) -# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) -# ----------------------------------------------------------- -# If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED. -# The purpose of this macro is to provide the user with a means to -# check macros which are provided without letting her know how the -# information is coded. -# If this macro is not defined by Autoconf, define it here. -ifdef([AC_PROVIDE_IFELSE], - [], - [define([AC_PROVIDE_IFELSE], - [ifdef([AC_PROVIDE_$1], - [$2], [$3])])]) +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) -# AM_INIT_AUTOMAKE(PACKAGE,VERSION, [NO-DEFINE]) -# ---------------------------------------------- +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH]) +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +#serial 2 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# This macro actually does too much some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 11 + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_REQUIRE([AC_PROG_INSTALL])dnl +[AC_PREREQ([2.58])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl # test to see if srcdir already configured -if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" && +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run \"make distclean\" there first]) + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + # Define the identity of the package. -PACKAGE=$1 -AC_SUBST(PACKAGE)dnl -VERSION=$2 -AC_SUBST(VERSION)dnl -ifelse([$3],, +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) -AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])]) - -# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow -# the ones we care about. -ifdef([m4_pattern_allow], - [m4_pattern_allow([^AM_[A-Z]+FLAGS])])dnl - -# Autoconf 2.50 always computes EXEEXT. However we need to be -# compatible with 2.13, for now. So we always define EXEEXT, but we -# don't compute it. -AC_SUBST(EXEEXT) -# Similar for OBJEXT -- only we only use OBJEXT if the user actually -# requests that it be used. This is a bit dumb. -: ${OBJEXT=o} -AC_SUBST(OBJEXT) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG(ACLOCAL, aclocal) +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) -AM_MISSING_PROG(AUTOMAKE, automake) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AM_MISSING_PROG(AMTAR, tar) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP +AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl -AC_REQUIRE([AM_DEP_TRACK])dnl -AC_REQUIRE([AM_SET_DEPDIR])dnl -AC_PROVIDE_IFELSE([AC_PROG_][CC], +AC_REQUIRE([AM_SET_LEADING_DOT])dnl + +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], - [define([AC_PROG_][CC], - defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl -AC_PROVIDE_IFELSE([AC_PROG_][CXX], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], - [define([AC_PROG_][CXX], - defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl ]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $1 | $1:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. + +# Copyright (C) 2001, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"$am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# -*- Autoconf -*- +# Copyright (C) 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 1 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Add --enable-maintainer-mode option to configure. +# From Jim Meyering + +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 + +AC_DEFUN([AM_MAINTAINER_MODE], +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + +AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 2 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# -*- Autoconf -*- + + +# Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# AM_PROG_MKDIR_P +# --------------- +# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. + +# Copyright (C) 2003, 2004 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories +# created by `make install' are always world readable, even if the +# installer happens to have an overly restrictive umask (e.g. 077). +# This was a mistake. There are at least two reasons why we must not +# use `-m 0755': +# - it causes special bits like SGID to be ignored, +# - it may be too restrictive (some setups expect 775 directories). +# +# Do not use -m 0755 and let people choose whatever they expect by +# setting umask. +# +# We cannot accept any implementation of `mkdir' that recognizes `-p'. +# Some implementations (such as Solaris 8's) are not thread-safe: if a +# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' +# concurrently, both version can detect that a/ is missing, but only +# one can create it and the other will error out. Consequently we +# restrict ourselves to GNU make (using the --version option ensures +# this.) +AC_DEFUN([AM_PROG_MKDIR_P], +[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # Keeping the `.' argument allows $(mkdir_p) to be used without + # argument. Indeed, we sometimes output rules like + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. + # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more + # expensive solution, as it forces Make to start a sub-shell.) + mkdir_p='mkdir -p -- .' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi +AC_SUBST([mkdir_p])]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 2 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # # Check to make sure that the build environment is sane. # +# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + # serial 3 # AM_SANITY_CHECK @@ -148,86 +907,24 @@ Check your system clock]) fi AC_MSG_RESULT(yes)]) +# AM_PROG_INSTALL_STRIP -# serial 2 +# Copyright (C) 2001, 2003 Free Software Foundation, Inc. -# AM_MISSING_PROG(NAME, PROGRAM) -# ------------------------------ -AC_DEFUN([AM_MISSING_PROG], -[AC_REQUIRE([AM_MISSING_HAS_RUN]) -$1=${$1-"${am_missing_run}$2"} -AC_SUBST($1)]) +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. -# AM_MISSING_HAS_RUN -# ------------------ -# Define MISSING if not defined so far and test if it supports --run. -# If it does, set am_missing_run to use it, otherwise, to nothing. -AC_DEFUN([AM_MISSING_HAS_RUN], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - am_backtick='`' - AC_MSG_WARN([${am_backtick}missing' script is too old or missing]) -fi -]) - -# AM_AUX_DIR_EXPAND - -# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to -# `$srcdir', `$srcdir/..', or `$srcdir/../..'. -# -# Of course, Automake must honor this variable whenever it calls a -# tool from the auxiliary directory. The problem is that $srcdir (and -# therefore $ac_aux_dir as well) can be either absolute or relative, -# depending on how configure is run. This is pretty annoying, since -# it makes $ac_aux_dir quite unusable in subdirectories: in the top -# source directory, any form will work fine, but in subdirectories a -# relative path needs to be adjusted first. -# -# $ac_aux_dir/missing -# fails when called from a subdirectory if $ac_aux_dir is relative -# $top_srcdir/$ac_aux_dir/missing -# fails if $ac_aux_dir is absolute, -# fails when called from a subdirectory in a VPATH build with -# a relative $ac_aux_dir -# -# The reason of the latter failure is that $top_srcdir and $ac_aux_dir -# are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is `.', but things will broke when you -# start a VPATH build or use an absolute $srcdir. -# -# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, -# iff we strip the leading $srcdir from $ac_aux_dir. That would be: -# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` -# and then we would define $MISSING as -# MISSING="\${SHELL} $am_aux_dir/missing" -# This will work as long as MISSING is not called from configure, because -# unfortunately $(top_srcdir) has no meaning in configure. -# However there are other variables, like CC, which are often used in -# configure, and could therefore not use this "fixed" $ac_aux_dir. -# -# Another solution, used here, is to always expand $ac_aux_dir to an -# absolute PATH. The drawback is that using absolute paths prevent a -# configured tree to be moved without reconfiguration. - -AC_DEFUN([AM_AUX_DIR_EXPAND], [ -# expand $ac_aux_dir to an absolute path -am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd` -]) - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -install_sh=${install_sh-"$am_aux_dir/install-sh"} -AC_SUBST(install_sh)]) +# 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. # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially @@ -238,1171 +935,30 @@ AC_SUBST(install_sh)]) # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# serial 4 -*- Autoconf -*- - - - -# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be -# written in clear, in which case automake, when reading aclocal.m4, -# will think it sees a *use*, and therefore will trigger all it's -# C support machinery. Also note that it means that autoscan, seeing -# CC etc. in the Makefile, will ask for an AC_PROG_CC use... - - - -# _AM_DEPENDENCIES(NAME) -# --------------------- -# See how the compiler implements dependency checking. -# NAME is "CC", "CXX" or "OBJC". -# We try a few techniques and use that to set a single cache variable. -# -# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was -# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular -# dependency, and given that the user is not expected to run this macro, -# just rely on AC_PROG_CC. -AC_DEFUN([_AM_DEPENDENCIES], -[AC_REQUIRE([AM_SET_DEPDIR])dnl -AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl -AC_REQUIRE([AM_MAKE_INCLUDE])dnl -AC_REQUIRE([AM_DEP_TRACK])dnl - -ifelse([$1], CC, [depcc="$CC" am_compiler_list=], - [$1], CXX, [depcc="$CXX" am_compiler_list=], - [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'] - [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) - -AC_CACHE_CHECK([dependency style of $depcc], - [am_cv_$1_dependencies_compiler_type], -[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - - am_cv_$1_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` - fi - for depmode in $am_compiler_list; do - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - echo '#include "conftest.h"' > conftest.c - echo 'int i;' > conftest.h - echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=conftest.c object=conftest.o \ - depfile=conftest.Po tmpdepfile=conftest.TPo \ - $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && - grep conftest.h conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - am_cv_$1_dependencies_compiler_type=$depmode - break - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_$1_dependencies_compiler_type=none -fi -]) -$1DEPMODE="depmode=$am_cv_$1_dependencies_compiler_type" -AC_SUBST([$1DEPMODE]) -]) - - -# AM_SET_DEPDIR -# ------------- -# Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES -AC_DEFUN([AM_SET_DEPDIR], -[rm -f .deps 2>/dev/null -mkdir .deps 2>/dev/null -if test -d .deps; then - DEPDIR=.deps -else - # MS-DOS does not allow filenames that begin with a dot. - DEPDIR=_deps -fi -rmdir .deps 2>/dev/null -AC_SUBST(DEPDIR) -]) - - -# AM_DEP_TRACK -# ------------ -AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE(dependency-tracking, -[ --disable-dependency-tracking Speeds up one-time builds - --enable-dependency-tracking Do not reject slow dependency extractors]) -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi -AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -pushdef([subst], defn([AC_SUBST])) -subst(AMDEPBACKSLASH) -popdef([subst]) -]) - -# Generate code to set up dependency tracking. -# This macro should only be invoked once -- use via AC_REQUIRE. -# Usage: -# AM_OUTPUT_DEPENDENCY_COMMANDS - -# -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each `.P' file that we will -# need in order to bootstrap the dependency handling code. -AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],[ -AC_OUTPUT_COMMANDS([ -test x"$AMDEP_TRUE" != x"" || -for mf in $CONFIG_FILES; do - case "$mf" in - Makefile) dirpart=.;; - */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;; - *) continue;; - esac - grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue - # Extract the definition of DEP_FILES from the Makefile without - # running `make'. - DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` - test -z "$DEPDIR" && continue - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n -e '/^U = / s///p' < "$mf"` - test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" - # We invoke sed twice because it is the simplest approach to - # changing $(DEPDIR) to its actual value in the expansion. - for file in `sed -n -e ' - /^DEP_FILES = .*\\\\$/ { - s/^DEP_FILES = // - :loop - s/\\\\$// - p - n - /\\\\$/ b loop - p - } - /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`echo "$file" | sed -e 's|/[^/]*$||'` - $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1 - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done -], [AMDEP_TRUE="$AMDEP_TRUE" -ac_aux_dir="$ac_aux_dir"])]) - -# AM_MAKE_INCLUDE() -# ----------------- -# Check to see how make treats includes. -AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' -doit: - @echo done -END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) -am__include='#' -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# We grep out `Entering directory' and `Leaving directory' -# messages which can occur if `w' ends up in MAKEFLAGS. -# In particular we don't look at `^make:' because GNU make might -# be invoked under some other name (usually "gmake"), in which -# case it prints its new name instead of `make'. -if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU -fi -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then - am__include=.include - am__quote='"' - _am_result=BSD - fi -fi -AC_SUBST(am__include) -AC_SUBST(am__quote) -AC_MSG_RESULT($_am_result) -rm -f confinc confmf -]) - -# serial 3 - -# AM_CONDITIONAL(NAME, SHELL-CONDITION) -# ------------------------------------- -# Define a conditional. -# -# FIXME: Once using 2.50, use this: -# m4_match([$1], [^TRUE\|FALSE$], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_DEFUN([AM_CONDITIONAL], -[ifelse([$1], [TRUE], - [errprint(__file__:__line__: [$0: invalid condition: $1 -])dnl -m4exit(1)])dnl -ifelse([$1], [FALSE], - [errprint(__file__:__line__: [$0: invalid condition: $1 -])dnl -m4exit(1)])dnl -AC_SUBST([$1_TRUE]) -AC_SUBST([$1_FALSE]) -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi]) - -# Like AC_CONFIG_HEADER, but automatically create stamp file. - -# serial 3 - -# When config.status generates a header, we must update the stamp-h file. -# This file resides in the same directory as the config header -# that is generated. We must strip everything past the first ":", -# and everything past the last "/". - -AC_PREREQ([2.12]) - -AC_DEFUN([AM_CONFIG_HEADER], -[ifdef([AC_FOREACH],dnl - [dnl init our file count if it isn't already - m4_ifndef([_AM_Config_Header_Index], m4_define([_AM_Config_Header_Index], [0])) - dnl prepare to store our destination file list for use in config.status - AC_FOREACH([_AM_File], [$1], - [m4_pushdef([_AM_Dest], m4_patsubst(_AM_File, [:.*])) - m4_define([_AM_Config_Header_Index], m4_incr(_AM_Config_Header_Index)) - dnl and add it to the list of files AC keeps track of, along - dnl with our hook - AC_CONFIG_HEADERS(_AM_File, -dnl COMMANDS, [, INIT-CMDS] -[# update the timestamp -echo timestamp >"AS_ESCAPE(_AM_DIRNAME(]_AM_Dest[))/stamp-h]_AM_Config_Header_Index[" -][$2]m4_ifval([$3], [, [$3]]))dnl AC_CONFIG_HEADERS - m4_popdef([_AM_Dest])])],dnl -[AC_CONFIG_HEADER([$1]) - AC_OUTPUT_COMMANDS( - ifelse(patsubst([$1], [[^ ]], []), - [], - [test -z "$CONFIG_HEADERS" || echo timestamp >dnl - patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]),dnl -[am_indx=1 -for am_file in $1; do - case " \$CONFIG_HEADERS " in - *" \$am_file "*) - am_dir=\`echo \$am_file |sed 's%:.*%%;s%[^/]*\$%%'\` - if test -n "\$am_dir"; then - am_tmpdir=\`echo \$am_dir |sed 's%^\(/*\).*\$%\1%'\` - for am_subdir in \`echo \$am_dir |sed 's%/% %'\`; do - am_tmpdir=\$am_tmpdir\$am_subdir/ - if test ! -d \$am_tmpdir; then - mkdir \$am_tmpdir - fi - done - fi - echo timestamp > "\$am_dir"stamp-h\$am_indx - ;; - esac - am_indx=\`expr \$am_indx + 1\` -done]) -])]) # AM_CONFIG_HEADER - -# _AM_DIRNAME(PATH) -# ----------------- -# Like AS_DIRNAME, only do it during macro expansion -AC_DEFUN([_AM_DIRNAME], - [m4_if(m4_regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1, - m4_if(m4_regexp([$1], [^//\([^/]\|$\)]), -1, - m4_if(m4_regexp([$1], [^/.*]), -1, - [.], - m4_patsubst([$1], [^\(/\).*], [\1])), - m4_patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])), - m4_patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl -]) # _AM_DIRNAME - -# aclocal-include.m4 -# -# This macro adds the name macrodir to the set of directories -# that `aclocal' searches for macros. - -# serial 1 - -dnl AM_ACLOCAL_INCLUDE(macrodir) -AC_DEFUN([AM_ACLOCAL_INCLUDE], -[ - test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" - - for k in $1 ; do ACLOCAL="$ACLOCAL -I $k" ; done -]) - -#serial 1 - -dnl From Jim Meyering. -dnl Find a new-enough version of Perl. -dnl - -AC_DEFUN(jm_PERL, -[ - dnl FIXME: don't hard-code 5.003 - dnl FIXME: should we cache the result? - AC_MSG_CHECKING([for perl5.003 or newer]) - if test "${PERL+set}" = set; then - # `PERL' is set in the user's environment. - candidate_perl_names="$PERL" - perl_specified=yes - else - candidate_perl_names='perl perl5' - perl_specified=no - fi - - found=no - AC_SUBST(PERL) - PERL="$missing_dir/missing perl" - for perl in $candidate_perl_names; do - # Run test in a subshell; some versions of sh will print an error if - # an executable is not found, even if stderr is redirected. - if ( $perl -e 'require 5.003' ) > /dev/null 2>&1; then - PERL=$perl - found=yes - break - fi - done - - AC_MSG_RESULT($found) - test $found = no && AC_MSG_WARN([ -*** You don't seem to have perl5.003 or newer installed. -*** Because of that, you may be unable to regenerate certain files -*** if you modify the sources from which they are derived.] ) -]) - -#serial 1 -# This test replaces the one in autoconf. -# Currently this macro should have the same name as the autoconf macro -# because gettext's gettext.m4 (distributed in the automake package) -# still uses it. Otherwise, the use in gettext.m4 makes autoheader -# give these diagnostics: -# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX -# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX - -undefine([AC_ISC_POSIX]) - -AC_DEFUN([AC_ISC_POSIX], - [ - dnl This test replaces the obsolescent AC_ISC_POSIX kludge. - AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) - ] -) - -#serial 1 - -dnl From Jim Meyering. -dnl Determine whether malloc accepts 0 as its argument. -dnl If it doesn't, arrange to use the replacement function. -dnl -dnl If you use this macro in a package, you should -dnl add the following two lines to acconfig.h: -dnl /* Define to rpl_malloc if the replacement function should be used. */ -dnl #undef malloc -dnl - -AC_DEFUN(jm_FUNC_MALLOC, -[ - if test x = y; then - dnl This code is deliberately never run via ./configure. - dnl FIXME: this is a gross hack to make autoheader put an entry - dnl for this symbol in config.h.in. - AC_CHECK_FUNCS(DONE_WORKING_MALLOC_CHECK) - fi - dnl xmalloc.c requires that this symbol be defined so it doesn't - dnl mistakenly use a broken malloc -- as it might if this test were omitted. - ac_kludge=HAVE_DONE_WORKING_MALLOC_CHECK - AC_DEFINE_UNQUOTED($ac_kludge) - - AC_CACHE_CHECK([for working malloc], jm_cv_func_working_malloc, - [AC_TRY_RUN([ - char *malloc (); - int - main () - { - exit (malloc (0) ? 0 : 1); - } - ], - jm_cv_func_working_malloc=yes, - jm_cv_func_working_malloc=no, - dnl When crosscompiling, assume malloc is broken. - jm_cv_func_working_malloc=no) - ]) - if test $jm_cv_func_working_malloc = no; then - LIBOBJS="$LIBOBJS malloc.o" - AC_DEFINE_UNQUOTED(malloc, rpl_malloc) - fi -]) - -#serial 1 - -dnl From Jim Meyering. -dnl Determine whether realloc works when both arguments are 0. -dnl If it doesn't, arrange to use the replacement function. -dnl -dnl If you use this macro in a package, you should -dnl add the following two lines to acconfig.h: -dnl /* Define to rpl_realloc if the replacement function should be used. */ -dnl #undef realloc -dnl - -AC_DEFUN(jm_FUNC_REALLOC, -[ - if test x = y; then - dnl This code is deliberately never run via ./configure. - dnl FIXME: this is a gross hack to make autoheader put an entry - dnl for this symbol in config.h.in. - AC_CHECK_FUNCS(DONE_WORKING_REALLOC_CHECK) - fi - dnl xmalloc.c requires that this symbol be defined so it doesn't - dnl mistakenly use a broken realloc -- as it might if this test were omitted. - ac_kludge=HAVE_DONE_WORKING_REALLOC_CHECK - AC_DEFINE_UNQUOTED($ac_kludge) - - AC_CACHE_CHECK([for working realloc], jm_cv_func_working_realloc, - [AC_TRY_RUN([ - char *realloc (); - int - main () - { - exit (realloc (0, 0) ? 0 : 1); - } - ], - jm_cv_func_working_realloc=yes, - jm_cv_func_working_realloc=no, - dnl When crosscompiling, assume realloc is broken. - jm_cv_func_working_realloc=no) - ]) - if test $jm_cv_func_working_realloc = no; then - LIBOBJS="$LIBOBJS realloc.o" - AC_DEFINE_UNQUOTED(realloc, rpl_realloc) - fi -]) - -# Macro to add for using GNU gettext. -# Ulrich Drepper , 1995. -# -# This file can be copied and used freely without restrictions. It can -# be used in projects which are not available under the GNU General Public -# License or the GNU Library General Public License but which still want -# to provide support for the GNU gettext functionality. -# Please note that the actual code of the GNU gettext library is covered -# by the GNU Library General Public License, and the rest of the GNU -# gettext package package is covered by the GNU General Public License. -# They are *not* in the public domain. - -# serial 10 - -dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]). -dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library -dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, -dnl depending on --{enable,disable}-{shared,static} and on the presence of -dnl AM-DISABLE-SHARED). Otherwise, a static library -dnl $(top_builddir)/intl/libintl.a will be created. -dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext -dnl implementations (in libc or libintl) without the ngettext() function -dnl will be ignored. -dnl LIBDIR is used to find the intl libraries. If empty, -dnl the value `$(top_builddir)/intl/' is used. -dnl -dnl The result of the configuration is one of three cases: -dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled -dnl and used. -dnl Catalog format: GNU --> install in $(datadir) -dnl Catalog extension: .mo after installation, .gmo in source tree -dnl 2) GNU gettext has been found in the system's C library. -dnl Catalog format: GNU --> install in $(datadir) -dnl Catalog extension: .mo after installation, .gmo in source tree -dnl 3) No internationalization, always use English msgid. -dnl Catalog format: none -dnl Catalog extension: none -dnl The use of .gmo is historical (it was needed to avoid overwriting the -dnl GNU format catalogs when building on a platform with an X/Open gettext), -dnl but we keep it in order not to force irrelevant filename changes on the -dnl maintainers. -dnl -AC_DEFUN([AM_WITH_NLS], - [AC_MSG_CHECKING([whether NLS is requested]) - dnl Default is enabled NLS - AC_ARG_ENABLE(nls, - [ --disable-nls do not use Native Language Support], - USE_NLS=$enableval, USE_NLS=yes) - AC_MSG_RESULT($USE_NLS) - AC_SUBST(USE_NLS) - - BUILD_INCLUDED_LIBINTL=no - USE_INCLUDED_LIBINTL=no - INTLLIBS= - - dnl If we use NLS figure out what method - if test "$USE_NLS" = "yes"; then - AC_DEFINE(ENABLE_NLS, 1, - [Define to 1 if translation of program messages to the user's native language - is requested.]) - AC_MSG_CHECKING([whether included gettext is requested]) - AC_ARG_WITH(included-gettext, - [ --with-included-gettext use the GNU gettext library included here], - nls_cv_force_use_gnu_gettext=$withval, - nls_cv_force_use_gnu_gettext=no) - AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) - - nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" - if test "$nls_cv_force_use_gnu_gettext" != "yes"; then - dnl User does not insist on using GNU NLS library. Figure out what - dnl to use. If GNU gettext is available we use this. Else we have - dnl to fall back to GNU NLS library. - CATOBJEXT=NONE - - dnl Add a version number to the cache macros. - define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc]) - define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl]) - - AC_CHECK_HEADER(libintl.h, - [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, - [AC_TRY_LINK([#include -extern int _nl_msg_cat_cntr;], - [bindtextdomain ("", ""); -return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr], - gt_cv_func_gnugettext_libc=yes, - gt_cv_func_gnugettext_libc=no)]) - - if test "$gt_cv_func_gnugettext_libc" != "yes"; then - AC_CACHE_CHECK([for GNU gettext in libintl], - gt_cv_func_gnugettext_libintl, - [gt_save_LIBS="$LIBS" - LIBS="$LIBS -lintl $LIBICONV" - AC_TRY_LINK([#include -extern int _nl_msg_cat_cntr;], - [bindtextdomain ("", ""); -return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr], - gt_cv_func_gnugettext_libintl=yes, - gt_cv_func_gnugettext_libintl=no) - LIBS="$gt_save_LIBS"]) - fi - - dnl If an already present or preinstalled GNU gettext() is found, - dnl use it. But if this macro is used in GNU gettext, and GNU - dnl gettext is already preinstalled in libintl, we update this - dnl libintl. (Cf. the install rule in intl/Makefile.in.) - if test "$gt_cv_func_gnugettext_libc" = "yes" \ - || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ - && test "$PACKAGE" != gettext; }; then - AC_DEFINE(HAVE_GETTEXT, 1, - [Define if the GNU gettext() function is already present or preinstalled.]) - - if test "$gt_cv_func_gnugettext_libintl" = "yes"; then - dnl If iconv() is in a separate libiconv library, then anyone - dnl linking with libintl{.a,.so} also needs to link with - dnl libiconv. - INTLLIBS="-lintl $LIBICONV" - fi - - gt_save_LIBS="$LIBS" - LIBS="$LIBS $INTLLIBS" - AC_CHECK_FUNCS(dcgettext) - LIBS="$gt_save_LIBS" - - dnl Search for GNU msgfmt in the PATH. - AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, - [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :) - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) - - dnl Search for GNU xgettext in the PATH. - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, - [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :) - - CATOBJEXT=.gmo - fi - ]) - - if test "$CATOBJEXT" = "NONE"; then - dnl GNU gettext is not found in the C library. - dnl Fall back on GNU gettext library. - nls_cv_use_gnu_gettext=yes - fi - fi - - if test "$nls_cv_use_gnu_gettext" = "yes"; then - dnl Mark actions used to generate GNU NLS library. - INTLOBJS="\$(GETTOBJS)" - AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, - [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :) - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, - [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :) - AC_SUBST(MSGFMT) - BUILD_INCLUDED_LIBINTL=yes - USE_INCLUDED_LIBINTL=yes - CATOBJEXT=.gmo - INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV" - LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` - fi - - dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. - dnl Test whether we really found GNU msgfmt. - if test "$GMSGFMT" != ":"; then - dnl If it is no GNU msgfmt we define it as : so that the - dnl Makefiles still can work. - if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then - : ; - else - AC_MSG_RESULT( - [found msgfmt program is not GNU msgfmt; ignore it]) - GMSGFMT=":" - fi - fi - - dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. - 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 >/dev/null 2>&1; then - : ; - else - AC_MSG_RESULT( - [found xgettext program is not GNU xgettext; ignore it]) - XGETTEXT=":" - fi - fi - - dnl We need to process the po/ directory. - POSUB=po - fi - AC_OUTPUT_COMMANDS( - [for ac_file in $CONFIG_FILES; do - # Support "outfile[:infile[:infile...]]" - case "$ac_file" in - *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - esac - # PO directories have a Makefile.in generated from Makefile.in.in. - case "$ac_file" in */Makefile.in) - # Adjust a relative srcdir. - ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` - ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" - ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` - # In autoconf-2.13 it is called $ac_given_srcdir. - # In autoconf-2.50 it is called $srcdir. - test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" - case "$ac_given_srcdir" in - .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; - /*) top_srcdir="$ac_given_srcdir" ;; - *) top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then - rm -f "$ac_dir/POTFILES" - test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" - sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES" - test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" - sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" - fi - ;; - esac - done]) - - - dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL - dnl to 'yes' because some of the testsuite requires it. - if test "$PACKAGE" = gettext; then - BUILD_INCLUDED_LIBINTL=yes - fi - - dnl intl/plural.c is generated from intl/plural.y. It requires bison, - dnl because plural.y uses bison specific features. It requires at least - dnl bison-1.26 because earlier versions generate a plural.c that doesn't - dnl compile. - dnl bison is only needed for the maintainer (who touches plural.y). But in - dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put - dnl the rule in general Makefile. Now, some people carelessly touch the - dnl files or have a broken "make" program, hence the plural.c rule will - dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not - dnl present or too old. - AC_CHECK_PROGS([INTLBISON], [bison]) - if test -z "$INTLBISON"; then - ac_verc_fail=yes - else - dnl Found it, now check the version. - AC_MSG_CHECKING([version of bison]) -changequote(<<,>>)dnl - ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` - case $ac_prog_version in - '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; - 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) -changequote([,])dnl - ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; - *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; - esac - AC_MSG_RESULT([$ac_prog_version]) - fi - if test $ac_verc_fail = yes; then - INTLBISON=: - fi - - dnl These rules are solely for the distribution goal. While doing this - dnl we only have to keep exactly one list of the available catalogs - dnl in configure.in. - for lang in $ALL_LINGUAS; do - GMOFILES="$GMOFILES $lang.gmo" - POFILES="$POFILES $lang.po" - done - - dnl Make all variables we use known to autoconf. - AC_SUBST(BUILD_INCLUDED_LIBINTL) - AC_SUBST(USE_INCLUDED_LIBINTL) - AC_SUBST(CATALOGS) - AC_SUBST(CATOBJEXT) - AC_SUBST(GMOFILES) - AC_SUBST(INTLLIBS) - AC_SUBST(INTLOBJS) - AC_SUBST(POFILES) - AC_SUBST(POSUB) - - dnl For backward compatibility. Some configure.ins may be using this. - nls_cv_header_intl= - nls_cv_header_libgt= - - dnl For backward compatibility. Some Makefiles may be using this. - DATADIRNAME=share - AC_SUBST(DATADIRNAME) - - dnl For backward compatibility. Some Makefiles may be using this. - INSTOBJEXT=.mo - AC_SUBST(INSTOBJEXT) - - dnl For backward compatibility. Some Makefiles may be using this. - GENCAT=gencat - AC_SUBST(GENCAT) - ]) - -dnl Usage: Just like AM_WITH_NLS, which see. -AC_DEFUN([AM_GNU_GETTEXT], - [AC_REQUIRE([AC_PROG_MAKE_SET])dnl - AC_REQUIRE([AC_PROG_CC])dnl - AC_REQUIRE([AC_CANONICAL_HOST])dnl - AC_REQUIRE([AC_PROG_RANLIB])dnl - AC_REQUIRE([AC_ISC_POSIX])dnl - AC_REQUIRE([AC_HEADER_STDC])dnl - AC_REQUIRE([AC_C_CONST])dnl - AC_REQUIRE([AC_C_INLINE])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([jm_GLIBC21])dnl - - AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ -stdlib.h string.h unistd.h sys/param.h]) - AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \ -getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \ -strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) - - AM_ICONV - AM_LANGINFO_CODESET - AM_LC_MESSAGES - AM_WITH_NLS([$1],[$2],[$3]) - - 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 presentlang in $ALL_LINGUAS; do - useit=no - for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do - # Use the presentlang catalog if desiredlang is - # a. equal to presentlang, or - # b. a variant of presentlang (because in this case, - # presentlang can be used as a fallback for messages - # which are not translated in the desiredlang catalog). - case "$desiredlang" in - "$presentlang"*) useit=yes;; - esac - done - if test $useit = yes; then - NEW_LINGUAS="$NEW_LINGUAS $presentlang" - fi - 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 - - dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly - dnl find the mkinstalldirs script in another subdir but $(top_srcdir). - dnl Try to locate is. - MKINSTALLDIRS= - if test -n "$ac_aux_dir"; then - MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" - fi - if test -z "$MKINSTALLDIRS"; then - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" - fi - AC_SUBST(MKINSTALLDIRS) - - dnl Enable libtool support if the surrounding package wishes it. - INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], []) - AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) - ]) - -# Search path for a program which passes the given test. -# Ulrich Drepper , 1996. -# -# This file can be copied and used freely without restrictions. It can -# be used in projects which are not available under the GNU General Public -# License or the GNU Library General Public License but which still want -# to provide support for the GNU gettext functionality. -# Please note that the actual code of the GNU gettext library is covered -# by the GNU Library General Public License, and the rest of the GNU -# gettext package package is covered by the GNU General Public License. -# They are *not* in the public domain. - -# serial 2 - -dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, -dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) -AC_DEFUN([AM_PATH_PROG_WITH_TEST], -[# 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 ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then - AC_MSG_RESULT([$]$1) -else - AC_MSG_RESULT(no) -fi -AC_SUBST($1)dnl -]) - -#serial 2 - -# Test for the GNU C Library, version 2.1 or newer. -# From Bruno Haible. - -AC_DEFUN([jm_GLIBC21], - [ - AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, - ac_cv_gnu_library_2_1, - [AC_EGREP_CPP([Lucky GNU user], - [ -#include -#ifdef __GNU_LIBRARY__ - #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) - Lucky GNU user - #endif -#endif - ], - ac_cv_gnu_library_2_1=yes, - ac_cv_gnu_library_2_1=no) - ] - ) - AC_SUBST(GLIBC21) - GLIBC21="$ac_cv_gnu_library_2_1" - ] -) - -#serial AM2 - -dnl From Bruno Haible. - -AC_DEFUN([AM_ICONV], -[ - dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and - dnl those with the standalone portable GNU libiconv installed). - - AC_ARG_WITH([libiconv-prefix], -[ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [ - for dir in `echo "$withval" | tr : ' '`; do - if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi - if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi - done - ]) - - AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ - am_cv_func_iconv="no, consider installing GNU libiconv" - am_cv_lib_iconv=no - AC_TRY_LINK([#include -#include ], - [iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd);], - am_cv_func_iconv=yes) - if test "$am_cv_func_iconv" != yes; then - am_save_LIBS="$LIBS" - LIBS="$LIBS -liconv" - AC_TRY_LINK([#include -#include ], - [iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd);], - am_cv_lib_iconv=yes - am_cv_func_iconv=yes) - LIBS="$am_save_LIBS" - fi - ]) - if test "$am_cv_func_iconv" = yes; then - AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) - AC_MSG_CHECKING([for iconv declaration]) - AC_CACHE_VAL(am_cv_proto_iconv, [ - AC_TRY_COMPILE([ -#include -#include -extern -#ifdef __cplusplus -"C" -#endif -#if defined(__STDC__) || defined(__cplusplus) -size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); -#else -size_t iconv(); -#endif -], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") - am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) - am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` - AC_MSG_RESULT([$]{ac_t:- - }[$]am_cv_proto_iconv) - AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, - [Define as const if the declaration of iconv() needs const.]) - fi - LIBICONV= - if test "$am_cv_lib_iconv" = yes; then - LIBICONV="-liconv" - fi - AC_SUBST(LIBICONV) -]) - -#serial AM1 - -dnl From Bruno Haible. - -AC_DEFUN([AM_LANGINFO_CODESET], -[ - AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, - [AC_TRY_LINK([#include ], - [char* cs = nl_langinfo(CODESET);], - am_cv_langinfo_codeset=yes, - am_cv_langinfo_codeset=no) - ]) - if test $am_cv_langinfo_codeset = yes; then - AC_DEFINE(HAVE_LANGINFO_CODESET, 1, - [Define if you have and nl_langinfo(CODESET).]) - fi -]) - -# Check whether LC_MESSAGES is available in . -# Ulrich Drepper , 1995. -# -# This file can be copied and used freely without restrictions. It can -# be used in projects which are not available under the GNU General Public -# License or the GNU Library General Public License but which still want -# to provide support for the GNU gettext functionality. -# Please note that the actual code of the GNU gettext library is covered -# by the GNU Library General Public License, and the rest of the GNU -# gettext package package is covered by the GNU General Public License. -# They are *not* in the public domain. - -# serial 2 - -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 ], [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 file defines LC_MESSAGES.]) - fi - fi]) - -dnl Check to find out whether the running kernel has support for TUN/TAP - -AC_DEFUN(tinc_TUNTAP, -[ -AC_ARG_WITH(kernel, - [ --with-kernel=dir give the directory with kernel sources] - [ (default: /usr/src/linux)], - kerneldir="$withval", - kerneldir="/usr/src/linux" -) - -AC_CACHE_CHECK([for linux/if_tun.h], tinc_cv_linux_if_tun_h, -[ - AC_TRY_COMPILE([#include "$kerneldir/include/linux/if_tun.h"], - [int a = IFF_TAP;], - if_tun_h="\"$kerneldir/include/linux/if_tun.h\"", - [AC_TRY_COMPILE([#include ], - [int a = IFF_TAP;], - if_tun_h="default", - if_tun_h="no" - )] - ) - - if test $if_tun_h = no; then - tinc_cv_linux_if_tun_h=none - else - tinc_cv_linux_if_tun_h="$if_tun_h" - fi -]) - -if test $tinc_cv_linux_if_tun_h != none; then - AC_DEFINE(HAVE_TUNTAP) - if test $tinc_cv_linux_if_tun_h != default; then - AC_DEFINE_UNQUOTED(LINUX_IF_TUN_H, $tinc_cv_linux_if_tun_h) - fi -fi -AC_SUBST(LINUX_IF_TUN_H) -AC_SUBST(HAVE_TUNTAP) -]) - -dnl Check to find the OpenSSL headers/libraries - -AC_DEFUN(tinc_OPENSSL, -[ - tinc_ac_save_CPPFLAGS="$CPPFLAGS" - - AC_ARG_WITH(openssl-include, - [ --with-openssl-include=DIR OpenSSL headers directory (without trailing /openssl)], - [openssl_include="$withval" - CFLAGS="$CFLAGS -I$withval" - CPPFLAGS="$CPPFLAGS -I$withval"] - ) - - AC_ARG_WITH(openssl-lib, - [ --with-openssl-lib=DIR OpenSSL library directory], - [openssl_lib="$withval" - LIBS="$LIBS -L$withval"] - ) - - AC_CHECK_HEADERS(openssl/evp.h openssl/rsa.h openssl/rand.h openssl/err.h openssl/sha.h openssl/pem.h, - [], - [AC_MSG_ERROR("OpenSSL header files not found."); break] - ) - - CPPFLAGS="$tinc_ac_save_CPPFLAGS" - - AC_CHECK_LIB(crypto, SHA1_version, - [LIBS="$LIBS -lcrypto"], - [AC_MSG_ERROR("OpenSSL libraries not found.")] - ) - - AC_CHECK_FUNCS(RAND_pseudo_bytes) - - AC_CHECK_FUNC(OpenSSL_add_all_algorithms, - [], - AC_CHECK_FUNC(SSLeay_add_all_algorithms, - [AC_DEFINE(HAVE_SSLEAY_ADD_ALL_ALGORITHMS)], - [AC_MSG_ERROR("Missing required OpenSSL functionality!")] - ) - ) - - AC_CHECK_FUNC(dlopen, - [], - AC_CHECK_LIB(dl, dlopen, - [LIBS="$LIBS -ldl"], - [AC_MSG_ERROR("OpenSSL depends on libdl.")] - ) - ) -]) - -dnl Check to find the zlib headers/libraries - -AC_DEFUN(tinc_ZLIB, -[ - tinc_ac_save_CPPFLAGS="$CPPFLAGS" - - AC_ARG_WITH(zlib-include, - [ --with-zlib-include=DIR zlib headers directory], - [zlib_include="$withval" - CFLAGS="$CFLAGS -I$withval" - CPPFLAGS="$CPPFLAGS -I$withval"] - ) - - AC_ARG_WITH(zlib-lib, - [ --with-zlib-lib=DIR zlib library directory], - [zlib_lib="$withval" - LIBS="$LIBS -L$withval"] - ) - - AC_CHECK_HEADERS(zlib.h, - [], - [AC_MSG_ERROR("zlib header files not found."); break] - ) - - CPPFLAGS="$tinc_ac_save_CPPFLAGS" - - AC_CHECK_LIB(z, compress2, - [LIBS="$LIBS -lz"], - [AC_MSG_ERROR("zlib libraries not found.")] - ) -]) - +m4_include([m4/aclocal-include.m4]) +m4_include([m4/attribute.m4]) +m4_include([m4/gettext.m4]) +m4_include([m4/iconv.m4]) +m4_include([m4/lib-ld.m4]) +m4_include([m4/lib-link.m4]) +m4_include([m4/lib-prefix.m4]) +m4_include([m4/lzo.m4]) +m4_include([m4/malloc.m4]) +m4_include([m4/nls.m4]) +m4_include([m4/openssl.m4]) +m4_include([m4/po.m4]) +m4_include([m4/progtest.m4]) +m4_include([m4/realloc.m4]) +m4_include([m4/tuntap.m4]) +m4_include([m4/zlib.m4]) diff --git a/config.guess b/config.guess index ed2e03b..77c7cba 100755 --- a/config.guess +++ b/config.guess @@ -1,9 +1,9 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -timestamp='2002-03-20' +timestamp='2004-08-13' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -53,7 +53,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -88,30 +88,42 @@ if test $# != 0; then exit 1 fi +trap 'exit 1' 1 2 15 -dummy=dummy-$$ -trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. -# CC_FOR_BUILD -- compiler used by this script. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. -set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int dummy(){}" > $dummy.c ; +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do - ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; - if test $? = 0 ; then + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; - rm -f $dummy.c $dummy.o $dummy.rel ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac' +esac ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) @@ -142,6 +154,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; @@ -167,21 +180,38 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ;; esac # The OS release - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; + amd64:OpenBSD:*:*) + echo x86_64-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} + cats:OpenBSD:*:*) + echo arm-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + luna88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -197,83 +227,76 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} + echo mips64-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit 0 ;; + macppc:MirBSD:*:*) + echo powerppc-unknown-mirbsd${UNAME_RELEASE} + exit 0 ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit 0 ;; alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then + case $UNAME_RELEASE in + *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - cat <$dummy.s - .data -\$Lformat: - .byte 37,100,45,37,120,10,0 # "%d-%x\n" - - .text - .globl main - .align 4 - .ent main -main: - .frame \$30,16,\$26,0 - ldgp \$29,0(\$27) - .prologue 1 - .long 0x47e03d80 # implver \$0 - lda \$2,-1 - .long 0x47e20c21 # amask \$2,\$1 - lda \$16,\$Lformat - mov \$0,\$17 - not \$1,\$18 - jsr \$26,printf - ldgp \$29,0(\$26) - mov 0,\$16 - jsr \$26,exit - .end main -EOF - eval $set_cc_for_build - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - case `./$dummy` in - 0-0) - UNAME_MACHINE="alpha" - ;; - 1-0) - UNAME_MACHINE="alphaev5" - ;; - 1-1) - UNAME_MACHINE="alphaev56" - ;; - 1-101) - UNAME_MACHINE="alphapca56" - ;; - 2-303) - UNAME_MACHINE="alphaev6" - ;; - 2-307) - UNAME_MACHINE="alphaev67" - ;; - 2-1307) - UNAME_MACHINE="alphaev68" - ;; - esac - fi - rm -f $dummy.s $dummy - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? @@ -296,6 +319,9 @@ EOF *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; @@ -313,6 +339,13 @@ EOF NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit 0 ;; + DRS?6000:UNIX_SV:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7 && exit 0 ;; + esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; @@ -381,6 +414,9 @@ EOF *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; @@ -419,15 +455,20 @@ EOF exit (-1); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy \ - && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + $CC_FOR_BUILD -o $dummy $dummy.c \ + && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && exit 0 echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; @@ -500,8 +541,7 @@ EOF exit(0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 @@ -599,11 +639,21 @@ EOF exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy` - if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi - rm -f $dummy.c $dummy + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + # avoid double evaluation of $set_cc_for_build + test -n "$CC_FOR_BUILD" || eval $set_cc_for_build + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) @@ -637,8 +687,7 @@ EOF exit (0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) @@ -696,21 +745,26 @@ EOF CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; - CRAY*T3D:*:*:*) - echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; @@ -732,14 +786,17 @@ EOF i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; - x86:Interix*:3*) - echo i386-pc-interix3 + x86:Interix*:[34]*) + echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' + exit 0 ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? - echo i386-pc-interix + echo i586-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin @@ -751,17 +808,28 @@ EOF echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) + # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; @@ -782,8 +850,26 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - rm -f $dummy.c - test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0 + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu @@ -819,6 +905,9 @@ EOF s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; @@ -845,7 +934,7 @@ EOF ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; + exit 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; @@ -876,9 +965,11 @@ EOF LIBC=gnuaout #endif #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - rm -f $dummy.c test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; @@ -896,6 +987,26 @@ EOF # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then @@ -917,22 +1028,19 @@ EOF UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` - (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 - (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 - (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about @@ -956,9 +1064,15 @@ EOF # "miniframe" echo m68010-convergent-sysv exit 0 ;; - M68*:*:R3V[567]*:*) + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit 0 ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit 0 ;; + M68*:*:R3V[5678]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` @@ -975,9 +1089,6 @@ EOF mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; @@ -1049,6 +1160,9 @@ EOF SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; @@ -1056,7 +1170,12 @@ EOF echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) - echo `uname -p`-apple-darwin${UNAME_RELEASE} + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + *86) UNAME_PROCESSOR=i686 ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit 0 ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` @@ -1069,7 +1188,7 @@ EOF *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; - NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*) + NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) @@ -1092,11 +1211,6 @@ EOF fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; @@ -1115,12 +1229,19 @@ EOF *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} exit 0 ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms && exit 0 ;; + I*) echo ia64-dec-vms && exit 0 ;; + V*) echo vax-dec-vms && exit 0 ;; + esac esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -1241,8 +1362,7 @@ main () } EOF -$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 -rm -f $dummy.c $dummy +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 # Apollos put the system type in the environment. diff --git a/config.h.in b/config.h.in index b004d30..0d7c585 100644 --- a/config.h.in +++ b/config.h.in @@ -1,310 +1,405 @@ -/* config.h.in. Generated automatically from configure.in by autoheader 2.13. */ +/* config.h.in. Generated from configure.in by autoheader. */ -/* Define if using alloca.c. */ -#undef C_ALLOCA - -/* Define to empty if the keyword does not work. */ -#undef const - -/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. - This function is required for alloca.c support on those systems. */ +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ #undef CRAY_STACKSEG_END -/* Define if you have alloca, as a function or macro. */ +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA + +/* Support for jumbograms (packets up to 9000 bytes) */ +#undef ENABLE_JUMBOGRAMS + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +#undef ENABLE_NLS + +/* Checkpoint tracing */ +#undef ENABLE_TRACING + +/* Define to 1 if you have `alloca', as a function or macro. */ #undef HAVE_ALLOCA -/* Define if you have and it should be used (not on Ultrix). */ +/* Define to 1 if you have and it should be used (not on Ultrix). + */ #undef HAVE_ALLOCA_H -/* Define if you have a working `mmap' system call. */ -#undef HAVE_MMAP +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_INET_H -/* Define as __inline if that's what the C compiler calls it. */ -#undef inline +/* Define to 1 if you have the `asprintf' function. */ +#undef HAVE_ASPRINTF -/* Define to `long' if doesn't define. */ -#undef off_t +/* Unknown BSD variant */ +#undef HAVE_BSD -/* Define to `int' if doesn't define. */ -#undef pid_t +/* Cygwin */ +#undef HAVE_CYGWIN -/* Define as the return type of signal handlers (int or void). */ -#undef RETSIGTYPE +/* Define to 1 if you have the `daemon' function. */ +#undef HAVE_DAEMON -/* Define to `unsigned' if doesn't define. */ -#undef size_t +/* Darwin (MacOS/X) */ +#undef HAVE_DARWIN -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown - */ -#undef STACK_DIRECTION +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +#undef HAVE_DCGETTEXT -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS +/* Needed for xmalloc.c */ +#undef HAVE_DONE_WORKING_MALLOC_CHECK -/* Define if you can safely include both and . */ -#undef TIME_WITH_SYS_TIME +/* Needed for xmalloc.c */ +#undef HAVE_DONE_WORKING_REALLOC_CHECK -/* Define if your declares struct tm. */ -#undef TM_IN_SYS_TIME +/* Define to 1 if you have the `EVP_EncryptInit_ex' function. */ +#undef HAVE_EVP_ENCRYPTINIT_EX -/* Define to rpl_malloc if the replacement function should be used. */ -#undef malloc +/* Define to 1 if you have the `fchmod' function. */ +#undef HAVE_FCHMOD -/* Define to rpl_realloc if the replacement function should be used. */ -#undef realloc +/* Define to 1 if you have the `flock' function. */ +#undef HAVE_FLOCK -/* This is always defined. It enables GNU extensions on systems that - have them. */ -#if !defined(_GNU_SOURCE) -# undef _GNU_SOURCE -#endif +/* Define to 1 if you have the `fork' function. */ +#undef HAVE_FORK -/* Linux */ -#undef HAVE_LINUX +/* Define to 1 if you have the `freeaddrinfo' function. */ +#undef HAVE_FREEADDRINFO /* FreeBSD */ #undef HAVE_FREEBSD -/* OpenBSD */ -#undef HAVE_OPENBSD - -/* Solaris */ -#undef HAVE_SOLARIS - -/* NetBSD */ -#undef HAVE_NETBSD - -/* Define to 1 if tun/tap support is enabled and found */ -#undef HAVE_TUNTAP - -/* Define to the location of if_tun.h */ -#undef LINUX_IF_TUN_H - -/* Define to 1 if support for jumbograms is enabled */ -#undef ENABLE_JUMBOGRAMS - -/* Define to 1 if checkpoint tracing is enabled */ -#undef ENABLE_TRACING - -/* Define to enable use of old SSLeay_add_all_algorithms() function */ -#undef HAVE_SSLEAY_ADD_ALL_ALGORITHMS - -/* Define if you have the DONE_WORKING_MALLOC_CHECK function. */ -#undef HAVE_DONE_WORKING_MALLOC_CHECK - -/* Define if you have the DONE_WORKING_REALLOC_CHECK function. */ -#undef HAVE_DONE_WORKING_REALLOC_CHECK - -/* Define if you have the RAND_pseudo_bytes function. */ -#undef HAVE_RAND_PSEUDO_BYTES - -/* Define if you have the __argz_count function. */ -#undef HAVE___ARGZ_COUNT - -/* Define if you have the __argz_next function. */ -#undef HAVE___ARGZ_NEXT - -/* Define if you have the __argz_stringify function. */ -#undef HAVE___ARGZ_STRINGIFY - -/* Define if you have the asprintf function. */ -#undef HAVE_ASPRINTF - -/* Define if you have the daemon function. */ -#undef HAVE_DAEMON - -/* Define if you have the dcgettext function. */ -#undef HAVE_DCGETTEXT - -/* Define if you have the fcloseall function. */ -#undef HAVE_FCLOSEALL - -/* Define if you have the feof_unlocked function. */ -#undef HAVE_FEOF_UNLOCKED - -/* Define if you have the fgets_unlocked function. */ -#undef HAVE_FGETS_UNLOCKED - -/* Define if you have the flock function. */ -#undef HAVE_FLOCK - -/* Define if you have the ftime function. */ +/* Define to 1 if you have the `ftime' function. */ #undef HAVE_FTIME -/* Define if you have the get_current_dir_name function. */ -#undef HAVE_GET_CURRENT_DIR_NAME +/* Define to 1 if you have the `gai_strerror' function. */ +#undef HAVE_GAI_STRERROR -/* Define if you have the getcwd function. */ -#undef HAVE_GETCWD +/* Define to 1 if you have the `getaddrinfo' function. */ +#undef HAVE_GETADDRINFO -/* Define if you have the getegid function. */ -#undef HAVE_GETEGID - -/* Define if you have the geteuid function. */ -#undef HAVE_GETEUID - -/* Define if you have the getgid function. */ -#undef HAVE_GETGID - -/* Define if you have the getpagesize function. */ -#undef HAVE_GETPAGESIZE - -/* Define if you have the getuid function. */ -#undef HAVE_GETUID - -/* Define if you have the mempcpy function. */ -#undef HAVE_MEMPCPY - -/* Define if you have the munmap function. */ -#undef HAVE_MUNMAP - -/* Define if you have the putenv function. */ -#undef HAVE_PUTENV - -/* Define if you have the select function. */ -#undef HAVE_SELECT - -/* Define if you have the setenv function. */ -#undef HAVE_SETENV - -/* Define if you have the setlocale function. */ -#undef HAVE_SETLOCALE - -/* Define if you have the socket function. */ -#undef HAVE_SOCKET - -/* Define if you have the stpcpy function. */ -#undef HAVE_STPCPY - -/* Define if you have the strcasecmp function. */ -#undef HAVE_STRCASECMP - -/* Define if you have the strchr function. */ -#undef HAVE_STRCHR - -/* Define if you have the strdup function. */ -#undef HAVE_STRDUP - -/* Define if you have the strerror function. */ -#undef HAVE_STRERROR - -/* Define if you have the strsignal function. */ -#undef HAVE_STRSIGNAL - -/* Define if you have the strtol function. */ -#undef HAVE_STRTOL - -/* Define if you have the strtoul function. */ -#undef HAVE_STRTOUL - -/* Define if you have the tsearch function. */ -#undef HAVE_TSEARCH - -/* Define if you have the unsetenv function. */ -#undef HAVE_UNSETENV - -/* Define if you have the header file. */ -#undef HAVE_ARGZ_H - -/* Define if you have the header file. */ -#undef HAVE_FCNTL_H - -/* Define if you have the header file. */ -#undef HAVE_LIMITS_H - -/* Define if you have the header file. */ -#undef HAVE_LOCALE_H - -/* Define if you have the header file. */ -#undef HAVE_MALLOC_H - -/* Define if you have the header file. */ -#undef HAVE_NL_TYPES_H - -/* Define if you have the header file. */ -#undef HAVE_OPENSSL_ERR_H - -/* Define if you have the header file. */ -#undef HAVE_OPENSSL_EVP_H - -/* Define if you have the header file. */ -#undef HAVE_OPENSSL_PEM_H - -/* Define if you have the header file. */ -#undef HAVE_OPENSSL_RAND_H - -/* Define if you have the header file. */ -#undef HAVE_OPENSSL_RSA_H - -/* Define if you have the header file. */ -#undef HAVE_OPENSSL_SHA_H - -/* Define if you have the header file. */ -#undef HAVE_STDDEF_H - -/* Define if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define if you have the header file. */ -#undef HAVE_STRING_H - -/* Define if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_FILE_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_IOCTL_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_TIME_H - -/* Define if you have the header file. */ -#undef HAVE_SYSLOG_H - -/* Define if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define if you have the header file. */ -#undef HAVE_ZLIB_H - -/* Define if you have the nsl library (-lnsl). */ -#undef HAVE_LIBNSL - -/* Define if you have the socket library (-lsocket). */ -#undef HAVE_LIBSOCKET - -/* Name of package */ -#undef PACKAGE - -/* Version number of package */ -#undef VERSION - -/* Define if you have the iconv() function. */ -#undef HAVE_ICONV - -/* Define as const if the declaration of iconv() needs const. */ -#undef ICONV_CONST - -/* Define if you have and nl_langinfo(CODESET). */ -#undef HAVE_LANGINFO_CODESET - -/* Define if your file defines LC_MESSAGES. */ -#undef HAVE_LC_MESSAGES - -/* Define to 1 if translation of program messages to the user's native language - is requested. */ -#undef ENABLE_NLS +/* Define to 1 if you have the `getnameinfo' function. */ +#undef HAVE_GETNAMEINFO /* Define if the GNU gettext() function is already present or preinstalled. */ #undef HAVE_GETTEXT +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the `get_current_dir_name' function. */ +#undef HAVE_GET_CURRENT_DIR_NAME + +/* Define if you have the iconv() function. */ +#undef HAVE_ICONV + +/* Define to 1 if you have the `inet_aton' function. */ +#undef HAVE_INET_ATON + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `nsl' library (-lnsl). */ +#undef HAVE_LIBNSL + +/* Define to 1 if you have the `socket' library (-lsocket). */ +#undef HAVE_LIBSOCKET + +/* Linux */ +#undef HAVE_LINUX + +/* Define to 1 if you have the header file. */ +#undef HAVE_LZO1X_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* MinGW */ +#undef HAVE_MINGW + +/* Define to 1 if you have the `mlockall' function. */ +#undef HAVE_MLOCKALL + +/* NetBSD */ +#undef HAVE_NETBSD + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETDB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_ICMP6_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IF_ETHER_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN6_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_SYSTM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IP6_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IP_ICMP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_TCP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NET_ETHERNET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NET_IF_ARP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NET_IF_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NET_IF_TAP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NET_IF_TUN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NET_IF_TYPES_H + +/* OpenBSD */ +#undef HAVE_OPENBSD + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_ERR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_EVP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_PEM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_RAND_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_RSA_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_SHA_H + +/* Define to 1 if you have the `putenv' function. */ +#undef HAVE_PUTENV + +/* Define to 1 if you have the `random' function. */ +#undef HAVE_RANDOM + +/* Define to 1 if you have the `RAND_pseudo_bytes' function. */ +#undef HAVE_RAND_PSEUDO_BYTES + +/* Define to 1 if you have the `select' function. */ +#undef HAVE_SELECT + +/* Define to 1 if the system has the type `socklen_t'. */ +#undef HAVE_SOCKLEN_T + +/* Solaris/SunOS */ +#undef HAVE_SOLARIS + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define to 1 if you have the `strerror' function. */ +#undef HAVE_STRERROR + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strsignal' function. */ +#undef HAVE_STRSIGNAL + +/* Define to 1 if you have the `strtol' function. */ +#undef HAVE_STRTOL + +/* Define to 1 if the system has the type `struct addrinfo'. */ +#undef HAVE_STRUCT_ADDRINFO + +/* Define to 1 if the system has the type `struct arphdr'. */ +#undef HAVE_STRUCT_ARPHDR + +/* Define to 1 if the system has the type `struct ether_arp'. */ +#undef HAVE_STRUCT_ETHER_ARP + +/* Define to 1 if the system has the type `struct ether_header'. */ +#undef HAVE_STRUCT_ETHER_HEADER + +/* Define to 1 if the system has the type `struct icmp'. */ +#undef HAVE_STRUCT_ICMP + +/* Define to 1 if the system has the type `struct icmp6_hdr'. */ +#undef HAVE_STRUCT_ICMP6_HDR + +/* Define to 1 if the system has the type `struct in6_addr'. */ +#undef HAVE_STRUCT_IN6_ADDR + +/* Define to 1 if the system has the type `struct in_addr'. */ +#undef HAVE_STRUCT_IN_ADDR + +/* Define to 1 if the system has the type `struct ip'. */ +#undef HAVE_STRUCT_IP + +/* Define to 1 if the system has the type `struct ip6_hdr'. */ +#undef HAVE_STRUCT_IP6_HDR + +/* Define to 1 if the system has the type `struct nd_neighbor_solicit'. */ +#undef HAVE_STRUCT_ND_NEIGHBOR_SOLICIT + +/* Define to 1 if the system has the type `struct nd_opt_hdr'. */ +#undef HAVE_STRUCT_ND_OPT_HDR + +/* Define to 1 if the system has the type `struct sockaddr_in6'. */ +#undef HAVE_STRUCT_SOCKADDR_IN6 + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYSLOG_H + +/* Define to 1 if you have the `system' function. */ +#undef HAVE_SYSTEM + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_FILE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_IOCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MMAN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_UIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_WAIT_H + +/* Universal tun/tap driver present */ +#undef HAVE_TUNTAP + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `unsetenv' function. */ +#undef HAVE_UNSETENV + +/* Define to 1 if you have the `vsyslog' function. */ +#undef HAVE_VSYSLOG + +/* Define to 1 if you have the `writev' function. */ +#undef HAVE_WRITEV + +/* Define to 1 if you have the header file. */ +#undef HAVE_ZLIB_H + +/* Location of if_tun.h */ +#undef LINUX_IF_TUN_H + +/* 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 + +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + +/* Define to 1 if your declares `struct tm'. */ +#undef TM_IN_SYS_TIME + +/* Version number of package */ +#undef VERSION + +/* Enable GNU extenstions */ +#undef _GNU_SOURCE + +/* Enable BSD extensions */ +#undef __USE_BSD + +/* Defined if the __malloc__ attribute is not supported. */ +#undef __malloc__ + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Replacement malloc() */ +#undef malloc + +/* Define to `int' if does not define. */ +#undef pid_t + +/* Replacement realloc() */ +#undef realloc + +/* Define to `unsigned' if does not define. */ +#undef size_t + +/* Define to empty if the keyword `volatile' does not work. Warning: valid + code using `volatile' can become incorrect without. Disable with care. */ +#undef volatile diff --git a/config.rpath b/config.rpath new file mode 100755 index 0000000..fa24bfc --- /dev/null +++ b/config.rpath @@ -0,0 +1,548 @@ +#! /bin/sh +# Output a system dependent set of variables, describing how to set the +# run time search path of shared libraries in an executable. +# +# Copyright 1996-2003 Free Software Foundation, Inc. +# Taken from GNU libtool, 2001 +# Originally by Gordon Matzigkeit , 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. +# +# The first argument passed to this file is the canonical host specification, +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld +# should be set by the caller. +# +# The set of defined variables is at the end of this script. + +# Known limitations: +# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer +# than 256 bytes, otherwise the compiler driver will dump core. The only +# known workaround is to choose shorter directory names for the build +# directory and/or the installation directory. + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +shrext=.so + +host="$1" +host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC. + +wl= +if test "$GCC" = yes; then + wl='-Wl,' +else + case "$host_os" in + aix*) + wl='-Wl,' + ;; + mingw* | pw32* | os2*) + ;; + hpux9* | hpux10* | hpux11*) + wl='-Wl,' + ;; + irix5* | irix6* | nonstopux*) + wl='-Wl,' + ;; + newsos6) + ;; + linux*) + case $CC in + icc|ecc) + wl='-Wl,' + ;; + ccc) + wl='-Wl,' + ;; + esac + ;; + osf3* | osf4* | osf5*) + wl='-Wl,' + ;; + sco3.2v5*) + ;; + solaris*) + wl='-Wl,' + ;; + sunos4*) + wl='-Qoption ld ' + ;; + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + wl='-Wl,' + ;; + sysv4*MP*) + ;; + uts4*) + ;; + esac +fi + +# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS. + +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no + +case "$host_os" in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + case "$host_os" in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + fi + ;; + amigaos*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # Samuel A. Falvo II 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 use + # them. + ld_shlibs=no + ;; + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + netbsd*) + ;; + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + sunos4*) + hardcode_direct=yes + ;; + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + esac + if test "$ld_shlibs" = yes; then + # Unlike libtool, we use -rpath here, not --rpath, since the documented + # option of GNU ld is called -rpath, not --rpath. + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + fi +else + case "$host_os" in + aix3*) + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + else + aix_use_runtimelinking=no + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + fi + hardcode_direct=yes + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + fi + # Begin _LT_AC_SYS_LIBPATH_AIX. + echo 'int main () { return 0; }' > conftest.c + ${CC} ${LDFLAGS} conftest.c -o conftest + aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + fi + if test -z "$aix_libpath"; then + aix_libpath="/usr/lib:/lib" + fi + rm -f conftest.c conftest + # End _LT_AC_SYS_LIBPATH_AIX. + if test "$aix_use_runtimelinking" = yes; then + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + else + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + fi + fi + ;; + amigaos*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + bsdi4*) + ;; + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + libext=lib + ;; + darwin* | rhapsody*) + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + hardcode_direct=no + fi + ;; + dgux*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + freebsd1*) + ld_shlibs=no + ;; + freebsd2.2*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + freebsd2*) + hardcode_direct=yes + hardcode_minus_L=yes + ;; + freebsd*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + hpux9*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + hpux10* | hpux11*) + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=no + ;; + ia64*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=no + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + *) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + irix5* | irix6* | nonstopux*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + netbsd*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + newsos6) + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + openbsd*) + hardcode_direct=yes + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + osf3*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + osf4* | osf5*) + if test "$GCC" = yes; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + # Both cc and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + sco3.2v5*) + ;; + solaris*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + sunos4*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + ;; + sysv4) + case $host_vendor in + sni) + hardcode_direct=yes # is this really true??? + ;; + siemens) + hardcode_direct=no + ;; + motorola) + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + ;; + sysv4.3*) + ;; + sysv4*MP*) + if test -d /usr/nec; then + ld_shlibs=yes + fi + ;; + sysv4.2uw2*) + hardcode_direct=yes + hardcode_minus_L=no + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + ;; + sysv5*) + hardcode_libdir_flag_spec= + ;; + uts4*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + *) + ld_shlibs=no + ;; + esac +fi + +# Check dynamic linker characteristics +# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER. +libname_spec='lib$name' +case "$host_os" in + aix3*) + ;; + aix4* | aix5*) + ;; + amigaos*) + ;; + beos*) + ;; + bsdi4*) + ;; + cygwin* | mingw* | pw32*) + shrext=.dll + ;; + darwin* | rhapsody*) + shrext=.dylib + ;; + dgux*) + ;; + freebsd1*) + ;; + freebsd*) + ;; + gnu*) + ;; + hpux9* | hpux10* | hpux11*) + case "$host_cpu" in + ia64*) + shrext=.so + ;; + hppa*64*) + shrext=.sl + ;; + *) + shrext=.sl + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case "$host_os" in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; + *) libsuff= shlibsuff= ;; + esac + ;; + esac + ;; + linux*oldld* | linux*aout* | linux*coff*) + ;; + linux*) + ;; + netbsd*) + ;; + newsos6) + ;; + nto-qnx) + ;; + openbsd*) + ;; + os2*) + libname_spec='$name' + shrext=.dll + ;; + osf3* | osf4* | osf5*) + ;; + sco3.2v5*) + ;; + solaris*) + ;; + sunos4*) + ;; + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + ;; + sysv4*MP*) + ;; + uts4*) + ;; +esac + +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' +escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` +shlibext=`echo "$shrext" | sed -e 's,^\.,,'` +escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` + +sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -118,7 +118,8 @@ esac # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*) + nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ + kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -144,7 +145,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis) + -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; @@ -228,28 +229,42 @@ case $basic_machine in | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | c4x | clipper \ - | d10v | d30v | dsp16xx \ - | fr30 \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ - | m32r | m68000 | m68k | m88k | mcore \ - | mips | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ - | mips64vr4100 | mips64vr4100el | mips64vr4300 \ - | mips64vr4300el | mips64vr5000 | mips64vr5000el \ - | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ - | mipsisa32 | mipsisa64 \ + | ip2k | iq2000 \ + | m32r | m32rle | m68000 | m68k | m88k | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ + | msp430 \ | ns16k | ns32k \ | openrisc | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ - | sh | sh[34] | sh[34]eb | shbe | shle | sh64 \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \ | strongarm \ - | tahoe | thumb | tic80 | tron \ + | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xstormy16 | xtensa \ @@ -281,34 +296,51 @@ case $basic_machine in | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armv*-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c54x-* \ - | clipper-* | cydra-* \ - | d10v-* | d30v-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | fx80-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ - | m32r-* \ + | ip2k-* | iq2000-* \ + | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ - | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ - | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \ - | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | msp430-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ - | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* | sh64-* \ + | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ @@ -332,6 +364,9 @@ case $basic_machine in basic_machine=a29k-amd os=-udi ;; + abacus) + basic_machine=abacus-unknown + ;; adobe68k) basic_machine=m68010-adobe os=-scout @@ -346,6 +381,12 @@ case $basic_machine in basic_machine=a29k-none os=-bsd ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; amdahl) basic_machine=580-amdahl os=-sysv @@ -405,12 +446,24 @@ case $basic_machine in basic_machine=j90-cray os=-unicos ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16c) + basic_machine=cr16c-unknown + os=-elf + ;; crds | unos) basic_machine=m68k-crds ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; da30 | da30-*) basic_machine=m68k-da30 ;; @@ -611,10 +664,6 @@ case $basic_machine in mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; monitor) basic_machine=m68k-rom68k os=-coff @@ -706,6 +755,10 @@ case $basic_machine in basic_machine=or32-unknown os=-coff ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose @@ -728,49 +781,55 @@ case $basic_machine in pbb) basic_machine=m68k-tti ;; - pc532 | pc532-*) + pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; - pentiumpro | p6 | 6x86 | athlon) + pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; - pentiumii | pentium2) + pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; + pentium4) + basic_machine=i786-pc + ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - pentiumii-* | pentium2-*) + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown - ;; + ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown - ;; + ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown - ;; + ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown - ;; + ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; @@ -801,6 +860,16 @@ case $basic_machine in basic_machine=a29k-amd os=-udi ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; sequent) basic_machine=i386-sequent ;; @@ -808,6 +877,9 @@ case $basic_machine in basic_machine=sh-hitachi os=-hms ;; + sh64) + basic_machine=sh64-unknown + ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks @@ -866,7 +938,7 @@ case $basic_machine in sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; - sv1) + sv1) basic_machine=sv1-cray os=-unicos ;; @@ -874,10 +946,6 @@ case $basic_machine in basic_machine=i386-sequent os=-dynix ;; - t3d) - basic_machine=alpha-cray - os=-unicos - ;; t3e) basic_machine=alphaev5-cray os=-unicos @@ -890,6 +958,14 @@ case $basic_machine in basic_machine=tic54x-unknown os=-coff ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; tx39) basic_machine=mipstx39-unknown ;; @@ -903,6 +979,10 @@ case $basic_machine in tower | tower-32) basic_machine=m68k-ncr ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; udi29k) basic_machine=a29k-amd os=-udi @@ -924,8 +1004,8 @@ case $basic_machine in os=-vms ;; vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; + basic_machine=f301-fujitsu + ;; vxworks960) basic_machine=i960-wrs os=-vxworks @@ -946,11 +1026,7 @@ case $basic_machine in basic_machine=hppa1.1-winbond os=-proelf ;; - windows32) - basic_machine=i386-pc - os=-windows32-msvcrt - ;; - xps | xps100) + xps | xps100) basic_machine=xps100-honeywell ;; ymp) @@ -980,6 +1056,9 @@ case $basic_machine in romp) basic_machine=romp-ibm ;; + mmix) + basic_machine=mmix-knuth + ;; rs6000) basic_machine=rs6000-ibm ;; @@ -996,16 +1075,16 @@ case $basic_machine in we32k) basic_machine=we32k-att ;; - sh3 | sh4 | sh3eb | sh4eb) + sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sh64) basic_machine=sh64-unknown ;; - sparc | sparcv9 | sparcv9b) + sparc | sparcv8 | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; - cydra) + cydra) basic_machine=cydra-cydrome ;; orion) @@ -1020,10 +1099,6 @@ case $basic_machine in pmac | pmac-mpw) basic_machine=powerpc-apple ;; - c4x*) - basic_machine=c4x-none - os=-coff - ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; @@ -1079,18 +1154,20 @@ case $os in | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova*) + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1102,8 +1179,10 @@ case $os in ;; esac ;; + -nto-qnx*) + ;; -nto*) - os=-nto-qnx + os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ @@ -1112,6 +1191,9 @@ case $os in -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; @@ -1124,6 +1206,9 @@ case $os in -opened*) os=-openedition ;; + -os400*) + os=-os400 + ;; -wince*) os=-wince ;; @@ -1145,6 +1230,9 @@ case $os in -atheos*) os=-atheos ;; + -syllable*) + os=-syllable + ;; -386bsd) os=-bsd ;; @@ -1155,7 +1243,7 @@ case $os in os=-rtmk-nova ;; -ns2 ) - os=-nextstep2 + os=-nextstep2 ;; -nsk*) os=-nsk @@ -1167,6 +1255,9 @@ case $os in -sinix*) os=-sysv4 ;; + -tpf*) + os=-tpf + ;; -triton*) os=-sysv3 ;; @@ -1194,8 +1285,14 @@ case $os in -xenix) os=-xenix ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos ;; -none) ;; @@ -1228,11 +1325,14 @@ case $basic_machine in arm*-semi) os=-aout ;; + c4x-* | tic4x-*) + os=-coff + ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; - pdp11-*) + pdp11-*) os=-none ;; *-dec | vax-*) @@ -1274,6 +1374,9 @@ case $basic_machine in *-ibm) os=-aix ;; + *-knuth) + os=-mmixware + ;; *-wec) os=-proelf ;; @@ -1325,19 +1428,19 @@ case $basic_machine in *-next) os=-nextstep3 ;; - *-gould) + *-gould) os=-sysv ;; - *-highlevel) + *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; - *-sgi) + *-sgi) os=-irix ;; - *-siemens) + *-siemens) os=-sysv4 ;; *-masscomp) @@ -1406,10 +1509,16 @@ case $basic_machine in -mvs* | -opened*) vendor=ibm ;; + -os400*) + vendor=ibm + ;; -ptx*) vendor=sequent ;; - -vxsim* | -vxworks*) + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) diff --git a/configure b/configure index 2eed879..f00dc83 100755 --- a/configure +++ b/configure @@ -1,50 +1,325 @@ #! /bin/sh - # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# Generated by GNU Autoconf 2.59. # +# Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## -# Defaults: -ac_help= +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# ac_default_prefix=/usr/local -# Any additions from configure.in: -ac_help="$ac_help - --disable-dependency-tracking Speeds up one-time builds - --enable-dependency-tracking Do not reject slow dependency extractors" -ac_help="$ac_help - --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib" -ac_help="$ac_help - --disable-nls do not use Native Language Support" -ac_help="$ac_help - --with-included-gettext use the GNU gettext library included here" -ac_help="$ac_help - --with-kernel=dir give the directory with kernel sources - (default: /usr/src/linux)" -ac_help="$ac_help - --with-openssl-include=DIR OpenSSL headers directory (without trailing /openssl)" -ac_help="$ac_help - --with-openssl-lib=DIR OpenSSL library directory" -ac_help="$ac_help - --with-zlib-include=DIR zlib headers directory" -ac_help="$ac_help - --with-zlib-lib=DIR zlib library directory" -ac_help="$ac_help - --enable-jumbograms enable support for jumbograms (packets up to 9000 bytes)" -ac_help="$ac_help - --enable-tracing enable checkpoint tracing (debugging only)" +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="src/tincd.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os LIBICONV LTLIBICONV INTLLIBS LIBINTL LTLIBINTL POSUB CPP EGREP LN_S RANLIB ac_ct_RANLIB LIBOBJS ALLOCA LINUX_IF_TUN_H HAVE_TUNTAP INCLUDES LTLIBOBJS' +ac_subst_files='' # Initialize some variables set by options. +ac_init_help= +ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. -build=NONE -cache_file=./config.cache +cache_file=/dev/null exec_prefix=NONE -host=NONE no_create= -nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE @@ -53,10 +328,15 @@ program_transform_name=s,x,x, silent= site= srcdir= -target=NONE verbose= x_includes=NONE x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' @@ -70,17 +350,9 @@ oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - ac_prev= for ac_option do - # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" @@ -88,59 +360,59 @@ do continue fi - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. - case "$ac_option" in + case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; + bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) - ac_prev=build ;; + ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; + build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) - datadir="$ac_optarg" ;; + datadir=$ac_optarg ;; -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac - eval "enable_${ac_feature}='$ac_optarg'" ;; + eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -149,95 +421,47 @@ do -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; + exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; -host | --host | --hos | --ho) - ac_prev=host ;; + ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; + host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; + includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; + infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; + libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; + libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ @@ -246,19 +470,19 @@ EOF -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; + localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; + mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) + | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ @@ -272,26 +496,26 @@ EOF -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; + oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; + prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; + program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; + program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ @@ -308,7 +532,7 @@ EOF | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; + program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) @@ -318,7 +542,7 @@ EOF ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; + sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ @@ -329,58 +553,57 @@ EOF | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; + sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; + site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; + srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; + sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; + ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; + target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac - eval "with_${ac_package}='$ac_optarg'" ;; + eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. @@ -391,99 +614,110 @@ EOF ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; + x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; + x_libraries=$ac_optarg ;; - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } fi -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; esac done -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=src/tincd.c # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. @@ -493,13 +727,498 @@ else fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } fi fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + --disable-nls do not use Native Language Support + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --disable-rpath do not hardcode runtime library paths + --enable-jumbograms enable support for jumbograms (packets up to 9000 + bytes) + --enable-tracing enable checkpoint tracing (debugging only) + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-gnu-ld assume the C compiler uses GNU ld default=no + --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib + --without-libiconv-prefix don't search for libiconv in includedir and libdir + --with-libintl-prefix[=DIR] search for libintl in DIR/include and DIR/lib + --without-libintl-prefix don't search for libintl in includedir and libdir + --with-kernel=DIR give the directory with kernel sources (default: + /usr/src/linux) + --with-openssl=DIR OpenSSL base directory, or: + --with-openssl-include=DIR + OpenSSL headers directory (without trailing + /openssl) + --with-openssl-lib=DIR OpenSSL library directory + --with-zlib=DIR zlib base directory, or: + --with-zlib-include=DIR zlib headers directory + --with-zlib-lib=DIR zlib library directory + --with-lzo=DIR lzo base directory, or: + --with-lzo-include=DIR lzo headers directory + --with-lzo-lib=DIR lzo library directory + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd "$ac_popdir" + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF + +Copyright (C) 2003 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then @@ -510,41 +1229,107 @@ if test -z "$CONFIG_SITE"; then fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi else - echo "creating cache $cache_file" - > $cache_file + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } fi ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + +am__api_version="1.8" ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then @@ -555,18 +1340,20 @@ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break fi done if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. - - -# expand $ac_aux_dir to an absolute path -am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd` +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -575,65 +1362,80 @@ am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd` # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:584: checking for a BSD compatible install" >&5 +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 fi fi done - ;; - esac - done - IFS="$ac_save_IFS" + done + ;; +esac +done + fi if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" + INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. - INSTALL="$ac_install_sh" + INSTALL=$ac_install_sh fi fi -echo "$ac_t""$INSTALL" 1>&6 +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:637: checking whether build environment is sane" >&5 +echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 echo timestamp > conftest.file @@ -656,8 +1458,11 @@ if ( # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". - { echo "configure: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } fi test "$2" = conftest.file @@ -666,28 +1471,29 @@ then # Ok. : else - { echo "configure: error: newly created file is older than distributed files! -Check your system clock" 1>&2; exit 1; } -fi -echo "$ac_t""yes" 1>&6 -if test "$program_transform_name" = s,x,x,; then - program_transform_name= -else - # Double any \ or $. echo might interpret backslashes. - cat <<\EOF_SED > conftestsed -s,\\,\\\\,g; s,\$,$$,g -EOF_SED - program_transform_name="`echo $program_transform_name|sed -f conftestsed`" - rm -f conftestsed + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 test "$program_prefix" != NONE && - program_transform_name="s,^,${program_prefix},; $program_transform_name" + program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && - program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed -# sed with no file args requires a program. -test "$program_transform_name" = "" && program_transform_name="s,x,x," +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL @@ -695,77 +1501,664 @@ if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= - am_backtick='`' - echo "configure: warning: ${am_backtick}missing' script is too old or missing" 1>&2 + { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi -for ac_prog in mawk gawk nawk awk +if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # Keeping the `.' argument allows $(mkdir_p) to be used without + # argument. Indeed, we sometimes output rules like + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. + # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more + # expensive solution, as it forces Make to start a sub-shell.) + mkdir_p='mkdir -p -- .' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi + +for ac_prog in gawk mawk nawk awk do -# Extract the first word of "$ac_prog", so it can be a program name with args. + # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:708: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AWK="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -AWK="$ac_cv_prog_AWK" -if test -n "$AWK"; then - echo "$ac_t""$AWK" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$AWK" && break +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done done -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:738: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 else - cat > conftestmake <<\EOF + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF all: - @echo 'ac_maketemp="${MAKE}"' -EOF + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi -rm -f conftestmake +rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 SET_MAKE= else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE=tinc + VERSION=1.0.3 + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +install_sh=${install_sh-"$am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STRIP=$ac_ct_STRIP +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. + + + + ac_config_headers="$ac_config_headers config.h" + +echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi; + echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 +echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 + + +if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + + + + test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" + + for k in m4 ; do ACLOCAL="$ACLOCAL -I $k" ; done + + + + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + case "$ac_aux_dir" in + /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;; + *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;; + esac + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + + + + echo "$as_me:$LINENO: checking whether NLS is requested" >&5 +echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 + # Check whether --enable-nls or --disable-nls was given. +if test "${enable_nls+set}" = set; then + enableval="$enable_nls" + USE_NLS=$enableval +else + USE_NLS=yes +fi; + echo "$as_me:$LINENO: result: $USE_NLS" >&5 +echo "${ECHO_T}$USE_NLS" >&6 + + + + + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_MSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$MSGFMT" in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test "$MSGFMT" != ":"; then + echo "$as_me:$LINENO: result: $MSGFMT" >&5 +echo "${ECHO_T}$MSGFMT" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_GMSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GMSGFMT in + [\\/]* | ?:[\\/]*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT=$ac_cv_path_GMSGFMT + +if test -n "$GMSGFMT"; then + echo "$as_me:$LINENO: result: $GMSGFMT" >&5 +echo "${ECHO_T}$GMSGFMT" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_XGETTEXT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$XGETTEXT" in + [\\/]* | ?:[\\/]*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test "$XGETTEXT" != ":"; then + echo "$as_me:$LINENO: result: $XGETTEXT" >&5 +echo "${ECHO_T}$XGETTEXT" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + rm -f messages.po + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "msgmerge", so it can be a program name with args. +set dummy msgmerge; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_MSGMERGE+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$MSGMERGE" in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + if $ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1; then + ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" + ;; +esac +fi +MSGMERGE="$ac_cv_path_MSGMERGE" +if test "$MSGMERGE" != ":"; then + echo "$as_me:$LINENO: result: $MSGMERGE" >&5 +echo "${ECHO_T}$MSGMERGE" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + + if test "$GMSGFMT" != ":"; then + if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && + (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` + echo "$as_me:$LINENO: result: found $GMSGFMT program is not GNU msgfmt; ignore it" >&5 +echo "${ECHO_T}found $GMSGFMT program is not GNU msgfmt; ignore it" >&6 + GMSGFMT=":" + fi + fi + + if test "$XGETTEXT" != ":"; then + if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && + (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + echo "$as_me:$LINENO: result: found xgettext program is not GNU xgettext; ignore it" >&5 +echo "${ECHO_T}found xgettext program is not GNU xgettext; ignore it" >&6 + XGETTEXT=":" + fi + rm -f messages.po + fi + + ac_config_commands="$ac_config_commands default-1" + + + + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" + +DEPDIR="${am__leading_dot}deps" + + ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +echo "$as_me:$LINENO: result: $_am_result" >&5 +echo "${ECHO_T}$_am_result" >&6 +rm -f confinc confmf + # Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval="$enable_dependency_tracking" - : -fi +fi; if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' @@ -782,302 +2175,657 @@ fi - -rm -f .deps 2>/dev/null -mkdir .deps 2>/dev/null -if test -d .deps; then - DEPDIR=.deps -else - # MS-DOS does not allow filenames that begin with a dot. - DEPDIR=_deps -fi -rmdir .deps 2>/dev/null - - -# test to see if srcdir already configured -if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - { echo "configure: error: source directory already configured; run \"make distclean\" there first" 1>&2; exit 1; } -fi - -# Define the identity of the package. -PACKAGE=tinc -VERSION=1.0pre7 -cat >> confdefs.h <> confdefs.h <> confdefs.h <<\EOF -#define _GNU_SOURCE __USE_BSD -EOF - - -ALL_LINGUAS="nl" - -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:877: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" fi if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:907: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift - if test $# -gt 0; then + if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:958: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - ;; - esac + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:990: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + test -n "$ac_ct_CC" && break +done -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross + CC=$ac_ct_CC +fi -cat > conftest.$ac_ext << EOF +fi -#line 1001 "configure" -#include "confdefs.h" -main(){return(0);} -EOF -if { (eval echo configure:1006: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no else - ac_cv_prog_cc_cross=yes + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1032: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1037: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done else - cat > conftest.c <&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me #endif -EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1046: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes else - GCC= + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1065: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else - ac_cv_prog_cc_g=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" + CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" @@ -1091,52 +2839,272 @@ else CFLAGS= fi fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -am_make=${MAKE-make} -cat > confinc << 'END' -doit: - @echo done -END -# If we don't find an include directive, just comment out the code. -echo $ac_n "checking for style of include used by $am_make""... $ac_c" 1>&6 -echo "configure:1104: checking for style of include used by $am_make" >&5 -am__include='#' -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# We grep out `Entering directory' and `Leaving directory' -# messages which can occur if `w' ends up in MAKEFLAGS. -# In particular we don't look at `^make:' because GNU make might -# be invoked under some other name (usually "gmake"), in which -# case it prints its new name instead of `make'. -if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU fi -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then - am__include=.include - am__quote='"' - _am_result=BSD - fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + fi +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac -echo "$ac_t""$_am_result" 1>&6 -rm -f confinc confmf +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= -echo $ac_n "checking dependency style of $depcc""... $ac_c" 1>&6 -echo "configure:1138: checking dependency style of $depcc" >&5 -if eval "test \"`echo '$''{'am_cv_CC_dependencies_compiler_type'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up @@ -1149,18 +3117,34 @@ else # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. - echo '#include "conftest.h"' > conftest.c - echo 'int i;' > conftest.h - echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) @@ -1178,13 +3162,25 @@ else # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ - source=conftest.c object=conftest.o \ - depfile=conftest.Po tmpdepfile=conftest.TPo \ - $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && - grep conftest.h conftest.Po > /dev/null 2>&1 && + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - am_cv_CC_dependencies_compiler_type=$depmode - break + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi fi done @@ -1195,170 +3191,2662 @@ else fi fi - -echo "$ac_t""$am_cv_CC_dependencies_compiler_type" 1>&6 -CCDEPMODE="depmode=$am_cv_CC_dependencies_compiler_type" +echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1205: checking how to run the C preprocessor" >&5 + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi; +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo "$as_me:$LINENO: checking for ld used by GCC" >&5 +echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 + 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. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path 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 + echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 +else + echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 +fi +if test "${acl_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_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. + if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + acl_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$acl_cv_path_LD" +if test -n "$LD"; then + echo "$as_me:$LINENO: result: $LD" >&5 +echo "${ECHO_T}$LD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 +if test "${acl_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + acl_cv_prog_gnu_ld=yes +else + acl_cv_prog_gnu_ld=no +fi +fi +echo "$as_me:$LINENO: result: $acl_cv_prog_gnu_ld" >&5 +echo "${ECHO_T}$acl_cv_prog_gnu_ld" >&6 +with_gnu_ld=$acl_cv_prog_gnu_ld + + + + echo "$as_me:$LINENO: checking for shared library run path origin" >&5 +echo $ECHO_N "checking for shared library run path origin... $ECHO_C" >&6 +if test "${acl_cv_rpath+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + +fi +echo "$as_me:$LINENO: result: $acl_cv_rpath" >&5 +echo "${ECHO_T}$acl_cv_rpath" >&6 + wl="$acl_cv_wl" + libext="$acl_cv_libext" + shlibext="$acl_cv_shlibext" + hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + hardcode_direct="$acl_cv_hardcode_direct" + hardcode_minus_L="$acl_cv_hardcode_minus_L" + # Check whether --enable-rpath or --disable-rpath was given. +if test "${enable_rpath+set}" = set; then + enableval="$enable_rpath" + : +else + enable_rpath=yes +fi; + + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libiconv-prefix or --without-libiconv-prefix was given. +if test "${with_libiconv_prefix+set}" = set; then + withval="$with_libiconv_prefix" + + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi + +fi; + LIBICONV= + LTLIBICONV= + INCICONV= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='iconv ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + if test $use_additional = yes; then + if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + found_dir="$additional_libdir" + found_so="$additional_libdir/lib$name.$shlibext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + else + if test -f "$additional_libdir/lib$name.$libext"; then + found_dir="$additional_libdir" + found_a="$additional_libdir/lib$name.$libext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + found_dir="$dir" + found_so="$dir/lib$name.$shlibext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + else + if test -f "$dir/lib$name.$libext"; then + found_dir="$dir" + found_a="$dir/lib$name.$libext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$hardcode_direct" = yes; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" + fi + if test "$hardcode_minus_L" != no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */lib | */lib/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" + ;; + esac + done + fi + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" + done + fi + + + + + + + + + + + + + + + + + + + + echo "$as_me:$LINENO: checking whether NLS is requested" >&5 +echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 + # Check whether --enable-nls or --disable-nls was given. +if test "${enable_nls+set}" = set; then + enableval="$enable_nls" + USE_NLS=$enableval +else + USE_NLS=yes +fi; + echo "$as_me:$LINENO: result: $USE_NLS" >&5 +echo "${ECHO_T}$USE_NLS" >&6 + + + + + LIBINTL= + LTLIBINTL= + POSUB= + + if test "$USE_NLS" = "yes"; then + gt_use_preinstalled_gnugettext=no + + + + + + + echo "$as_me:$LINENO: checking for GNU gettext in libc" >&5 +echo $ECHO_N "checking for GNU gettext in libc... $ECHO_C" >&6 +if test "${gt_cv_func_gnugettext1_libc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +extern int _nl_msg_cat_cntr; +extern int *_nl_domain_bindings; +int +main () +{ +bindtextdomain ("", ""); +return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gt_cv_func_gnugettext1_libc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gt_cv_func_gnugettext1_libc=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libc" >&5 +echo "${ECHO_T}$gt_cv_func_gnugettext1_libc" >&6 + + if test "$gt_cv_func_gnugettext1_libc" != "yes"; then + + + + + + am_save_CPPFLAGS="$CPPFLAGS" + + for element in $INCICONV; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + + echo "$as_me:$LINENO: checking for iconv" >&5 +echo $ECHO_N "checking for iconv... $ECHO_C" >&6 +if test "${am_cv_func_iconv+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_func_iconv=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_lib_iconv=yes + am_cv_func_iconv=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$am_save_LIBS" + fi + +fi +echo "$as_me:$LINENO: result: $am_cv_func_iconv" >&5 +echo "${ECHO_T}$am_cv_func_iconv" >&6 + if test "$am_cv_func_iconv" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ICONV 1 +_ACEOF + + fi + if test "$am_cv_lib_iconv" = yes; then + echo "$as_me:$LINENO: checking how to link with libiconv" >&5 +echo $ECHO_N "checking how to link with libiconv... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: $LIBICONV" >&5 +echo "${ECHO_T}$LIBICONV" >&6 + else + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libintl-prefix or --without-libintl-prefix was given. +if test "${with_libintl_prefix+set}" = set; then + withval="$with_libintl_prefix" + + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi + +fi; + LIBINTL= + LTLIBINTL= + INCINTL= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='intl ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + if test $use_additional = yes; then + if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + found_dir="$additional_libdir" + found_so="$additional_libdir/lib$name.$shlibext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + else + if test -f "$additional_libdir/lib$name.$libext"; then + found_dir="$additional_libdir" + found_a="$additional_libdir/lib$name.$libext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + found_dir="$dir" + found_so="$dir/lib$name.$shlibext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + else + if test -f "$dir/lib$name.$libext"; then + found_dir="$dir" + found_a="$dir/lib$name.$libext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$hardcode_direct" = yes; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir" + fi + if test "$hardcode_minus_L" != no; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a" + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */lib | */lib/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBINTL="${LIBINTL}${LIBINTL:+ }$dep" + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep" + ;; + esac + done + fi + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir" + done + fi + + echo "$as_me:$LINENO: checking for GNU gettext in libintl" >&5 +echo $ECHO_N "checking for GNU gettext in libintl... $ECHO_C" >&6 +if test "${gt_cv_func_gnugettext1_libintl+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCINTL" + gt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBINTL" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (); +int +main () +{ +bindtextdomain ("", ""); +return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias (0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gt_cv_func_gnugettext1_libintl=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gt_cv_func_gnugettext1_libintl=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$gt_cv_func_gnugettext1_libintl" != yes && test -n "$LIBICONV"; then + LIBS="$LIBS $LIBICONV" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (); +int +main () +{ +bindtextdomain ("", ""); +return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias (0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + LIBINTL="$LIBINTL $LIBICONV" + LTLIBINTL="$LTLIBINTL $LTLIBICONV" + gt_cv_func_gnugettext1_libintl=yes + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + CPPFLAGS="$gt_save_CPPFLAGS" + LIBS="$gt_save_LIBS" +fi +echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libintl" >&5 +echo "${ECHO_T}$gt_cv_func_gnugettext1_libintl" >&6 + fi + + if test "$gt_cv_func_gnugettext1_libc" = "yes" \ + || { test "$gt_cv_func_gnugettext1_libintl" = "yes" \ + && test "$PACKAGE" != gettext-runtime \ + && test "$PACKAGE" != gettext-tools; }; then + gt_use_preinstalled_gnugettext=yes + else + LIBINTL= + LTLIBINTL= + INCINTL= + fi + + + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define ENABLE_NLS 1 +_ACEOF + + else + USE_NLS=no + fi + fi + + echo "$as_me:$LINENO: checking whether to use NLS" >&5 +echo $ECHO_N "checking whether to use NLS... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: $USE_NLS" >&5 +echo "${ECHO_T}$USE_NLS" >&6 + if test "$USE_NLS" = "yes"; then + echo "$as_me:$LINENO: checking where the gettext function comes from" >&5 +echo $ECHO_N "checking where the gettext function comes from... $ECHO_C" >&6 + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then + gt_source="external libintl" + else + gt_source="libc" + fi + else + gt_source="included intl directory" + fi + echo "$as_me:$LINENO: result: $gt_source" >&5 +echo "${ECHO_T}$gt_source" >&6 + fi + + if test "$USE_NLS" = "yes"; then + + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then + echo "$as_me:$LINENO: checking how to link with libintl" >&5 +echo $ECHO_N "checking how to link with libintl... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: $LIBINTL" >&5 +echo "${ECHO_T}$LIBINTL" >&6 + + for element in $INCINTL; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + fi + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETTEXT 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DCGETTEXT 1 +_ACEOF + + fi + + POSUB=po + fi + + + + INTLLIBS="$LIBINTL" + + + + + + + + +# Enable GNU extensions. +# Define this here, not in acconfig's @TOP@ section, since definitions +# in the latter don't make it into the configure-time tests. + +cat >>confdefs.h <<\_ACEOF +#define _GNU_SOURCE 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define __USE_BSD 1 +_ACEOF + + +ALL_LINGUAS="nl" + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CC" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1226: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then : else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1243: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1260: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -rm -f conftest* -fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" -fi - CPP="$ac_cv_prog_CPP" -else - ac_cv_prog_CPP="$CPP" -fi -echo "$ac_t""$CPP" 1>&6 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -if test $ac_cv_prog_gcc = yes; then - echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:1286: checking whether ${CC-cc} needs -traditional" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + 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 +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +if test $ac_cv_c_compiler_gnu = yes; then + echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 +echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 +if test "${ac_cv_prog_gcc_traditional+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_pattern="Autoconf.*'x'" - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include Autoconf TIOCGETP -EOF +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "$ac_pattern" >/dev/null 2>&1; then - rm -rf conftest* + $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes else - rm -rf conftest* ac_cv_prog_gcc_traditional=no fi rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include Autoconf TCGETA -EOF +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "$ac_pattern" >/dev/null 2>&1; then - rm -rf conftest* + $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi - -echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 +echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi -for ac_prog in mawk gawk nawk awk +for ac_prog in gawk mawk nawk awk do -# Extract the first word of "$ac_prog", so it can be a program name with args. + # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1336: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AWK="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -AWK="$ac_cv_prog_AWK" +AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - echo "$ac_t""$AWK" 1>&6 + echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -test -n "$AWK" && break + test -n "$AWK" && break done # Find a good install program. We prefer a C program (faster), @@ -1368,344 +5856,543 @@ done # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1377: checking for a BSD compatible install" >&5 +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 fi fi done - ;; - esac - done - IFS="$ac_save_IFS" + done + ;; +esac +done + fi if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" + INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. - INSTALL="$ac_install_sh" + INSTALL=$ac_install_sh fi fi -echo "$ac_t""$INSTALL" 1>&6 +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1430: checking whether ln -s works" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 else - rm -f conftestdata -if ln -s X conftestdata 2>/dev/null -then - rm -f conftestdata - ac_cv_prog_LN_S="ln -s" -else - ac_cv_prog_LN_S=ln -fi -fi -LN_S="$ac_cv_prog_LN_S" -if test "$ac_cv_prog_LN_S" = "ln -s"; then - echo "$ac_t""yes" 1>&6 -else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6 fi -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1451: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftestmake <<\EOF + cat >conftest.make <<\_ACEOF all: - @echo 'ac_maketemp="${MAKE}"' -EOF + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi -rm -f conftestmake +rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 SET_MAKE= else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi - - echo $ac_n "checking for perl5.003 or newer""... $ac_c" 1>&6 -echo "configure:1479: checking for perl5.003 or newer" >&5 - if test "${PERL+set}" = set; then - # `PERL' is set in the user's environment. - candidate_perl_names="$PERL" - perl_specified=yes - else - candidate_perl_names='perl perl5' - perl_specified=no +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi +done +done - found=no - - PERL="$missing_dir/missing perl" - for perl in $candidate_perl_names; do - # Run test in a subshell; some versions of sh will print an error if - # an executable is not found, even if stderr is redirected. - if ( $perl -e 'require 5.003' ) > /dev/null 2>&1; then - PERL=$perl - found=yes - break - fi - done - - echo "$ac_t""$found" 1>&6 - test $found = no && echo "configure: warning: -*** You don't seem to have perl5.003 or newer installed. -*** Because of that, you may be unable to regenerate certain files -*** if you modify the sources from which they are derived. " 1>&2 - - - - - echo $ac_n "checking for strerror in -lcposix""... $ac_c" 1>&6 -echo "configure:1512: checking for strerror in -lcposix" >&5 -ac_lib_var=`echo cposix'_'strerror | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 else - ac_save_LIBS="$LIBS" -LIBS="-lcposix $LIBS" -cat > conftest.$ac_ext <&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + + +echo "$as_me:$LINENO: checking for library containing strerror" >&5 +echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6 +if test "${ac_cv_search_strerror+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_strerror=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char strerror(); - -int main() { -strerror() -; return 0; } -EOF -if { (eval echo configure:1531: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + builtin and then its argument prototype would still apply. */ +char strerror (); +int +main () +{ +strerror (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_strerror="none required" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - LIBS="$LIBS -lcposix" +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_strerror" = no; then + for ac_lib in cposix; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strerror (); +int +main () +{ +strerror (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_strerror="-l$ac_lib" +break else - echo "$ac_t""no" 1>&6 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5 +echo "${ECHO_T}$ac_cv_search_strerror" >&6 +if test "$ac_cv_search_strerror" != no; then + test "$ac_cv_search_strerror" = "none required" || LIBS="$ac_cv_search_strerror $LIBS" + fi - - - -# Make sure we can run config.sub. -if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : -else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } -fi - -echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:1562: checking host system type" >&5 - -host_alias=$host -case "$host_alias" in -NONE) - case $nonopt in - NONE) - if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : - else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } - fi ;; - *) host_alias=$nonopt ;; - esac ;; -esac - -host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$host" 1>&6 - +#AC_CANONICAL_HOST case $host_os in *linux*) - cat >> confdefs.h <<\EOF -#define HAVE_LINUX 1 -EOF - rm -f src/device.c; ln -sf linux/device.c src/device.c +cat >>confdefs.h <<\_ACEOF +#define HAVE_LINUX 1 +_ACEOF + + rm -f src/device.c; ln -sf linux/device.c src/device.c ;; *freebsd*) - cat >> confdefs.h <<\EOF -#define HAVE_FREEBSD 1 -EOF - rm -f src/device.c; ln -sf freebsd/device.c src/device.c +cat >>confdefs.h <<\_ACEOF +#define HAVE_FREEBSD 1 +_ACEOF + + rm -f src/device.c; ln -sf bsd/device.c src/device.c + ;; + *darwin*) + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DARWIN 1 +_ACEOF + + rm -f src/device.c; ln -sf bsd/device.c src/device.c ;; *solaris*) - cat >> confdefs.h <<\EOF -#define HAVE_SOLARIS 1 -EOF - rm -f src/device.c; ln -sf solaris/device.c src/device.c +cat >>confdefs.h <<\_ACEOF +#define HAVE_SOLARIS 1 +_ACEOF + + rm -f src/device.c; ln -sf solaris/device.c src/device.c ;; *openbsd*) - cat >> confdefs.h <<\EOF -#define HAVE_OPENBSD 1 -EOF - rm -f src/device.c; ln -sf openbsd/device.c src/device.c +cat >>confdefs.h <<\_ACEOF +#define HAVE_OPENBSD 1 +_ACEOF + + rm -f src/device.c; ln -sf bsd/device.c src/device.c ;; *netbsd*) - cat >> confdefs.h <<\EOF -#define HAVE_NETBSD 1 -EOF - rm -f src/device.c; ln -sf netbsd/device.c src/device.c +cat >>confdefs.h <<\_ACEOF +#define HAVE_NETBSD 1 +_ACEOF + + rm -f src/device.c; ln -sf bsd/device.c src/device.c + ;; + *bsd*) + { echo "$as_me:$LINENO: WARNING: \"Unknown BSD variant" >&5 +echo "$as_me: WARNING: \"Unknown BSD variant" >&2;} + +cat >>confdefs.h <<\_ACEOF +#define HAVE_BSD 1 +_ACEOF + + rm -f src/device.c; ln -sf bsd/device.c src/device.c + ;; + *cygwin*) + +cat >>confdefs.h <<\_ACEOF +#define HAVE_CYGWIN 1 +_ACEOF + + rm -f src/device.c; ln -sf cygwin/device.c src/device.c + ;; + *mingw*) + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MINGW 1 +_ACEOF + + rm -f src/device.c; cp -f src/mingw/device.c src/device.c + LIBS="$LIBS -lws2_32" + ;; + *) + { { echo "$as_me:$LINENO: error: \"Unknown operating system.\"" >&5 +echo "$as_me: error: \"Unknown operating system.\"" >&2;} + { (exit 1); exit 1; }; } ;; esac -cat > confcache <<\EOF +cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. # -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. # -EOF +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache +if test -d /sw/include ; then + CPPFLAGS="$CPPFLAGS -I/sw/include" +fi +if test -d /sw/lib ; then + LIBS="$LIBS -L/sw/lib" +fi -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1671: checking for ANSI C header files" >&5 -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include #include #include -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1684: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_header_stdc=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_stdc=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then + $EGREP "memchr" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -1714,16 +6401,19 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then + $EGREP "free" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -1732,377 +6422,2056 @@ fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. -if test "$cross_compiling" = yes; then + if test "$cross_compiling" = yes; then : else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int main () { int i; for (i = 0; i < 256; i++) -if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); -exit (0); } +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif -EOF -if { (eval echo configure:1751: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then : else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_header_stdc=no -fi -rm -fr conftest* -fi + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi - -echo "$ac_t""$ac_cv_header_stdc" 1>&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 -EOF +_ACEOF fi -for ac_hdr in fcntl.h limits.h sys/ioctl.h syslog.h unistd.h \ -sys/time.h malloc.h strings.h sys/file.h +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1779: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1789: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&6 +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + fi + done -echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1817: checking for working const" >&5 -if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + + + + + + + + + + + + +for ac_header in stdbool.h syslog.h sys/file.h sys/ioctl.h sys/mman.h sys/param.h sys/socket.h sys/time.h sys/uio.h sys/wait.h netdb.h arpa/inet.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - cat > conftest.$ac_ext <&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -int main() { +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 -/* Ultrix mips cc rejects this. */ -typedef int charset[2]; const charset x; -/* SunOS 4.1.1 cc rejects this. */ -char const *const *ccp; -char **p; -/* NEC SVR4.0.2 mips cc rejects this. */ -struct point {int x, y;}; -static struct point const zero = {0,0}; -/* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in an arm - of an if-expression whose if-part is not a constant expression */ -const char *g = "string"; -ccp = &g + (g ? g-g : 0); -/* HPUX 7.0 cc rejects these. */ -++ccp; -p = (char**) ccp; -ccp = (char const *const *) p; -{ /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - *t++ = 0; -} -{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; -} -{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; -} -{ /* AIX XL C 1.02.0.0 rejects this saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; -} -{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; -} + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 -; return 0; } -EOF -if { (eval echo configure:1871: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + + + + + + +for ac_header in net/if.h net/if_types.h net/if_tun.h net/if_tap.h net/ethernet.h net/if_arp.h netinet/in_systm.h netinet/in.h netinet/in6.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include "have.h" + + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + +for ac_header in netinet/if_ether.h netinet/ip.h netinet/ip6.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include "have.h" + + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + +for ac_header in netinet/tcp.h netinet/ip_icmp.h netinet/icmp6.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include "have.h" + + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +if test "${ac_cv_c_const+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_c_const=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_c_const=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$ac_cv_c_const" 1>&6 +ac_cv_c_const=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 if test $ac_cv_c_const = no; then - cat >> confdefs.h <<\EOF -#define const -EOF + +cat >>confdefs.h <<\_ACEOF +#define const +_ACEOF fi -echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:1892: checking for pid_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for working volatile" >&5 +echo $ECHO_N "checking for working volatile... $ECHO_C" >&6 +if test "${ac_cv_c_volatile+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext < -#if STDC_HEADERS -#include -#include -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + +volatile int x; +int * volatile y; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_volatile=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_volatile=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_volatile" >&5 +echo "${ECHO_T}$ac_cv_c_volatile" >&6 +if test $ac_cv_c_volatile = no; then + +cat >>confdefs.h <<\_ACEOF +#define volatile +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for pid_t" >&5 +echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 +if test "${ac_cv_type_pid_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((pid_t *) 0) + return 0; +if (sizeof (pid_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_type_pid_t=yes else - rm -rf conftest* - ac_cv_type_pid_t=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_type_pid_t=no fi -echo "$ac_t""$ac_cv_type_pid_t" 1>&6 -if test $ac_cv_type_pid_t = no; then - cat >> confdefs.h <<\EOF -#define pid_t int -EOF - +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - -echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1925: checking for size_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 +echo "${ECHO_T}$ac_cv_type_pid_t" >&6 +if test $ac_cv_type_pid_t = yes; then + : else - cat > conftest.$ac_ext < -#if STDC_HEADERS -#include -#include -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* + +cat >>confdefs.h <<_ACEOF +#define pid_t int +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6 +if test "${ac_cv_type_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((size_t *) 0) + return 0; +if (sizeof (size_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_type_size_t=yes else - rm -rf conftest* - ac_cv_type_size_t=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_type_size_t=no fi -echo "$ac_t""$ac_cv_type_size_t" 1>&6 -if test $ac_cv_type_size_t = no; then - cat >> confdefs.h <<\EOF -#define size_t unsigned -EOF - +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - -echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1958: checking whether time.h and sys/time.h may both be included" >&5 -if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6 +if test $ac_cv_type_size_t = yes; then + : else - cat > conftest.$ac_ext <>confdefs.h <<_ACEOF +#define size_t unsigned +_ACEOF + +fi + +echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 +echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 +if test "${ac_cv_header_time+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include #include -int main() { -struct tm *tp; -; return 0; } -EOF -if { (eval echo configure:1972: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + +int +main () +{ +if ((struct tm *) 0) +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_header_time=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_time=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$ac_cv_header_time" 1>&6 +ac_cv_header_time=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 +echo "${ECHO_T}$ac_cv_header_time" >&6 if test $ac_cv_header_time = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define TIME_WITH_SYS_TIME 1 -EOF +_ACEOF fi -echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:1993: checking whether struct tm is in sys/time.h or time.h" >&5 -if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 +echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6 +if test "${ac_cv_struct_tm+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include -int main() { + +int +main () +{ struct tm *tp; tp->tm_sec; -; return 0; } -EOF -if { (eval echo configure:2006: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_struct_tm=time.h else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_struct_tm=sys/time.h -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$ac_cv_struct_tm" 1>&6 +ac_cv_struct_tm=sys/time.h +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 +echo "${ECHO_T}$ac_cv_struct_tm" >&6 if test $ac_cv_struct_tm = sys/time.h; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define TM_IN_SYS_TIME 1 -EOF +_ACEOF fi -echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:2028: checking for 8-bit clean memcmp" >&5 -if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + + echo "$as_me:$LINENO: checking for working __malloc__ attribute" >&5 +echo $ECHO_N "checking for working __malloc__ attribute... $ECHO_C" >&6 +if test "${tinc_cv_attribute___malloc__+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + tempcflags="$CFLAGS" + CFLAGS="$CFLAGS -Wall -Werror" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +void test(void) __attribute__ ((__malloc__)); + void test(void) { return; } + +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tinc_cv_attribute___malloc__=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tinc_cv_attribute___malloc__=no + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$tempcflags" + +fi +echo "$as_me:$LINENO: result: $tinc_cv_attribute___malloc__" >&5 +echo "${ECHO_T}$tinc_cv_attribute___malloc__" >&6 + + if test ${tinc_cv_attribute___malloc__} = no; then + +cat >>confdefs.h <<\_ACEOF +#define __malloc__ +_ACEOF + + fi + + +echo "$as_me:$LINENO: checking for socklen_t" >&5 +echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6 +if test "${ac_cv_type_socklen_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include "have.h" + + +int +main () +{ +if ((socklen_t *) 0) + return 0; +if (sizeof (socklen_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_socklen_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_socklen_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5 +echo "${ECHO_T}$ac_cv_type_socklen_t" >&6 +if test $ac_cv_type_socklen_t = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_SOCKLEN_T 1 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking for struct ether_header" >&5 +echo $ECHO_N "checking for struct ether_header... $ECHO_C" >&6 +if test "${ac_cv_type_struct_ether_header+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include "have.h" + + +int +main () +{ +if ((struct ether_header *) 0) + return 0; +if (sizeof (struct ether_header)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_struct_ether_header=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_struct_ether_header=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_struct_ether_header" >&5 +echo "${ECHO_T}$ac_cv_type_struct_ether_header" >&6 +if test $ac_cv_type_struct_ether_header = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_ETHER_HEADER 1 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking for struct arphdr" >&5 +echo $ECHO_N "checking for struct arphdr... $ECHO_C" >&6 +if test "${ac_cv_type_struct_arphdr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include "have.h" + + +int +main () +{ +if ((struct arphdr *) 0) + return 0; +if (sizeof (struct arphdr)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_struct_arphdr=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_struct_arphdr=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_struct_arphdr" >&5 +echo "${ECHO_T}$ac_cv_type_struct_arphdr" >&6 +if test $ac_cv_type_struct_arphdr = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_ARPHDR 1 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking for struct ether_arp" >&5 +echo $ECHO_N "checking for struct ether_arp... $ECHO_C" >&6 +if test "${ac_cv_type_struct_ether_arp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include "have.h" + + +int +main () +{ +if ((struct ether_arp *) 0) + return 0; +if (sizeof (struct ether_arp)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_struct_ether_arp=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_struct_ether_arp=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_struct_ether_arp" >&5 +echo "${ECHO_T}$ac_cv_type_struct_ether_arp" >&6 +if test $ac_cv_type_struct_ether_arp = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_ETHER_ARP 1 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking for struct in_addr" >&5 +echo $ECHO_N "checking for struct in_addr... $ECHO_C" >&6 +if test "${ac_cv_type_struct_in_addr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include "have.h" + + +int +main () +{ +if ((struct in_addr *) 0) + return 0; +if (sizeof (struct in_addr)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_struct_in_addr=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_struct_in_addr=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_struct_in_addr" >&5 +echo "${ECHO_T}$ac_cv_type_struct_in_addr" >&6 +if test $ac_cv_type_struct_in_addr = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_IN_ADDR 1 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking for struct addrinfo" >&5 +echo $ECHO_N "checking for struct addrinfo... $ECHO_C" >&6 +if test "${ac_cv_type_struct_addrinfo+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include "have.h" + + +int +main () +{ +if ((struct addrinfo *) 0) + return 0; +if (sizeof (struct addrinfo)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_struct_addrinfo=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_struct_addrinfo=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_struct_addrinfo" >&5 +echo "${ECHO_T}$ac_cv_type_struct_addrinfo" >&6 +if test $ac_cv_type_struct_addrinfo = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_ADDRINFO 1 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking for struct ip" >&5 +echo $ECHO_N "checking for struct ip... $ECHO_C" >&6 +if test "${ac_cv_type_struct_ip+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include "have.h" + + +int +main () +{ +if ((struct ip *) 0) + return 0; +if (sizeof (struct ip)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_struct_ip=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_struct_ip=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_struct_ip" >&5 +echo "${ECHO_T}$ac_cv_type_struct_ip" >&6 +if test $ac_cv_type_struct_ip = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_IP 1 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking for struct icmp" >&5 +echo $ECHO_N "checking for struct icmp... $ECHO_C" >&6 +if test "${ac_cv_type_struct_icmp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include "have.h" + + +int +main () +{ +if ((struct icmp *) 0) + return 0; +if (sizeof (struct icmp)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_struct_icmp=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_struct_icmp=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_struct_icmp" >&5 +echo "${ECHO_T}$ac_cv_type_struct_icmp" >&6 +if test $ac_cv_type_struct_icmp = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_ICMP 1 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking for struct in6_addr" >&5 +echo $ECHO_N "checking for struct in6_addr... $ECHO_C" >&6 +if test "${ac_cv_type_struct_in6_addr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include "have.h" + + +int +main () +{ +if ((struct in6_addr *) 0) + return 0; +if (sizeof (struct in6_addr)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_struct_in6_addr=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_struct_in6_addr=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_struct_in6_addr" >&5 +echo "${ECHO_T}$ac_cv_type_struct_in6_addr" >&6 +if test $ac_cv_type_struct_in6_addr = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_IN6_ADDR 1 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking for struct sockaddr_in6" >&5 +echo $ECHO_N "checking for struct sockaddr_in6... $ECHO_C" >&6 +if test "${ac_cv_type_struct_sockaddr_in6+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include "have.h" + + +int +main () +{ +if ((struct sockaddr_in6 *) 0) + return 0; +if (sizeof (struct sockaddr_in6)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_struct_sockaddr_in6=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_struct_sockaddr_in6=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_struct_sockaddr_in6" >&5 +echo "${ECHO_T}$ac_cv_type_struct_sockaddr_in6" >&6 +if test $ac_cv_type_struct_sockaddr_in6 = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_SOCKADDR_IN6 1 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking for struct ip6_hdr" >&5 +echo $ECHO_N "checking for struct ip6_hdr... $ECHO_C" >&6 +if test "${ac_cv_type_struct_ip6_hdr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include "have.h" + + +int +main () +{ +if ((struct ip6_hdr *) 0) + return 0; +if (sizeof (struct ip6_hdr)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_struct_ip6_hdr=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_struct_ip6_hdr=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_struct_ip6_hdr" >&5 +echo "${ECHO_T}$ac_cv_type_struct_ip6_hdr" >&6 +if test $ac_cv_type_struct_ip6_hdr = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_IP6_HDR 1 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking for struct icmp6_hdr" >&5 +echo $ECHO_N "checking for struct icmp6_hdr... $ECHO_C" >&6 +if test "${ac_cv_type_struct_icmp6_hdr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include "have.h" + + +int +main () +{ +if ((struct icmp6_hdr *) 0) + return 0; +if (sizeof (struct icmp6_hdr)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_struct_icmp6_hdr=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_struct_icmp6_hdr=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_struct_icmp6_hdr" >&5 +echo "${ECHO_T}$ac_cv_type_struct_icmp6_hdr" >&6 +if test $ac_cv_type_struct_icmp6_hdr = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_ICMP6_HDR 1 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking for struct nd_neighbor_solicit" >&5 +echo $ECHO_N "checking for struct nd_neighbor_solicit... $ECHO_C" >&6 +if test "${ac_cv_type_struct_nd_neighbor_solicit+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include "have.h" + + +int +main () +{ +if ((struct nd_neighbor_solicit *) 0) + return 0; +if (sizeof (struct nd_neighbor_solicit)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_struct_nd_neighbor_solicit=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_struct_nd_neighbor_solicit=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_struct_nd_neighbor_solicit" >&5 +echo "${ECHO_T}$ac_cv_type_struct_nd_neighbor_solicit" >&6 +if test $ac_cv_type_struct_nd_neighbor_solicit = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_ND_NEIGHBOR_SOLICIT 1 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking for struct nd_opt_hdr" >&5 +echo $ECHO_N "checking for struct nd_opt_hdr... $ECHO_C" >&6 +if test "${ac_cv_type_struct_nd_opt_hdr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include "have.h" + + +int +main () +{ +if ((struct nd_opt_hdr *) 0) + return 0; +if (sizeof (struct nd_opt_hdr)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_struct_nd_opt_hdr=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_struct_nd_opt_hdr=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_struct_nd_opt_hdr" >&5 +echo "${ECHO_T}$ac_cv_type_struct_nd_opt_hdr" >&6 +if test $ac_cv_type_struct_nd_opt_hdr = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_ND_OPT_HDR 1 +_ACEOF + + +fi + + +echo "$as_me:$LINENO: checking for working memcmp" >&5 +echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6 +if test "${ac_cv_func_memcmp_working+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - ac_cv_func_memcmp_clean=no + ac_cv_func_memcmp_working=no else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () { + + /* Some versions of memcmp are not 8-bit clean. */ char c0 = 0x40, c1 = 0x80, c2 = 0x81; - exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1); + if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) + exit (1); + + /* The Next x86 OpenStep bug shows up only when comparing 16 bytes + or more and with at least one buffer not starting on a 4-byte boundary. + William Lewis provided this test program. */ + { + char foo[21]; + char bar[21]; + int i; + for (i = 0; i < 4; i++) + { + char *a = foo + i; + char *b = bar + i; + strcpy (a, "--------01111111"); + strcpy (b, "--------10000000"); + if (memcmp (a, b, 16) >= 0) + exit (1); + } + exit (0); + } + + ; + return 0; } - -EOF -if { (eval echo configure:2046: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_func_memcmp_clean=yes +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_memcmp_working=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_func_memcmp_clean=no -fi -rm -fr conftest* -fi + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_func_memcmp_working=no fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5 +echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6 +test $ac_cv_func_memcmp_working = no && case $LIBOBJS in + "memcmp.$ac_objext" | \ + *" memcmp.$ac_objext" | \ + "memcmp.$ac_objext "* | \ + *" memcmp.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;; +esac -echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6 -test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}" # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! -echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:2066: checking for working alloca.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for working alloca.h" >&5 +echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6 +if test "${ac_cv_working_alloca_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -int main() { -char *p = alloca(2 * sizeof(int)); -; return 0; } -EOF -if { (eval echo configure:2078: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_header_alloca_h=yes +int +main () +{ +char *p = (char *) alloca (2 * sizeof (int)); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_working_alloca_h=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_alloca_h=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$ac_cv_header_alloca_h" 1>&6 -if test $ac_cv_header_alloca_h = yes; then - cat >> confdefs.h <<\EOF +ac_cv_working_alloca_h=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5 +echo "${ECHO_T}$ac_cv_working_alloca_h" >&6 +if test $ac_cv_working_alloca_h = yes; then + +cat >>confdefs.h <<\_ACEOF #define HAVE_ALLOCA_H 1 -EOF +_ACEOF fi -echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:2099: checking for alloca" >&5 -if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for alloca" >&5 +echo $ECHO_N "checking for alloca... $ECHO_C" >&6 +if test "${ac_cv_func_alloca_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #ifdef __GNUC__ # define alloca __builtin_alloca #else @@ -2124,137 +8493,215 @@ char *alloca (); # endif #endif -int main() { -char *p = (char *) alloca(1); -; return 0; } -EOF -if { (eval echo configure:2132: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +int +main () +{ +char *p = (char *) alloca (1); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_func_alloca_works=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_func_alloca_works=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_alloca_works=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5 +echo "${ECHO_T}$ac_cv_func_alloca_works" >&6 -echo "$ac_t""$ac_cv_func_alloca_works" 1>&6 if test $ac_cv_func_alloca_works = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_ALLOCA 1 -EOF +_ACEOF -fi - -if test $ac_cv_func_alloca_works = no; then - # The SVR3 libPW and SVR4 libucb both contain incompatible functions - # that cause trouble. Some versions do not even contain alloca or - # contain a buggy version. If you still want to use their alloca, - # use ar to extract alloca.o from them instead of compiling alloca.c. - ALLOCA=alloca.${ac_objext} - cat >> confdefs.h <<\EOF -#define C_ALLOCA 1 -EOF - - -echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:2164: checking whether alloca needs Cray hooks" >&5 -if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 else - cat > conftest.$ac_ext <>confdefs.h <<\_ACEOF +#define C_ALLOCA 1 +_ACEOF + + +echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5 +echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6 +if test "${ac_cv_os_cray+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #if defined(CRAY) && ! defined(CRAY2) webecray #else wenotbecray #endif -EOF +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "webecray" >/dev/null 2>&1; then - rm -rf conftest* + $EGREP "webecray" >/dev/null 2>&1; then ac_cv_os_cray=yes else - rm -rf conftest* ac_cv_os_cray=no fi rm -f conftest* fi - -echo "$ac_t""$ac_cv_os_cray" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5 +echo "${ECHO_T}$ac_cv_os_cray" >&6 if test $ac_cv_os_cray = yes; then -for ac_func in _getb67 GETB67 getb67; do - echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2194: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + for ac_func in _getb67 GETB67 getb67; do + as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:2222: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + +cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func -EOF +_ACEOF - break -else - echo "$ac_t""no" 1>&6 + break fi -done + done fi -echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:2249: checking stack direction for C alloca" >&5 -if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking stack direction for C alloca" >&5 +echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6 +if test "${ac_cv_c_stack_direction+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_c_stack_direction=0 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +int find_stack_direction () { static char *addr = 0; @@ -2267,44 +8714,61 @@ find_stack_direction () else return (&dummy > addr) ? 1 : -1; } + +int main () { - exit (find_stack_direction() < 0); + exit (find_stack_direction () < 0); } -EOF -if { (eval echo configure:2276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_c_stack_direction=1 else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_c_stack_direction=-1 -fi -rm -fr conftest* -fi + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_c_stack_direction=-1 fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5 +echo "${ECHO_T}$ac_cv_c_stack_direction" >&6 -echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 -cat >> confdefs.h <>confdefs.h <<_ACEOF #define STACK_DIRECTION $ac_cv_c_stack_direction -EOF +_ACEOF + fi -echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:2298: checking return type of signal handlers" >&5 -if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking return type of signal handlers" >&5 +echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 +if test "${ac_cv_type_signal+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include #ifdef signal -#undef signal +# undef signal #endif #ifdef __cplusplus extern "C" void (*signal (int, void (*)(int)))(int); @@ -2312,159 +8776,296 @@ extern "C" void (*signal (int, void (*)(int)))(int); void (*signal ()) (); #endif -int main() { +int +main () +{ int i; -; return 0; } -EOF -if { (eval echo configure:2320: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_type_signal=void else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_type_signal=int -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$ac_cv_type_signal" 1>&6 -cat >> confdefs.h <&5 +echo "${ECHO_T}$ac_cv_type_signal" >&6 + +cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal -EOF +_ACEOF -for ac_func in ftime socket select strtol strerror flock unsetenv \ -asprintf putenv strdup fcloseall daemon strsignal get_current_dir_name + + + + + + + + + + + + + + + + + + + + +for ac_func in asprintf daemon fchmod flock ftime fork get_current_dir_name gettimeofday mlockall putenv random select strdup strerror strsignal strtol system unsetenv vsyslog writev do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2342: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:2370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 fi done if test x = y; then - for ac_func in DONE_WORKING_MALLOC_CHECK + +for ac_func in DONE_WORKING_MALLOC_CHECK do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2399: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:2427: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 fi done fi - ac_kludge=HAVE_DONE_WORKING_MALLOC_CHECK - cat >> confdefs.h <>confdefs.h <<\_ACEOF +#define HAVE_DONE_WORKING_MALLOC_CHECK 1 +_ACEOF - echo $ac_n "checking for working malloc""... $ac_c" 1>&6 -echo "configure:2459: checking for working malloc" >&5 -if eval "test \"`echo '$''{'jm_cv_func_working_malloc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for working malloc" >&5 +echo $ECHO_N "checking for working malloc... $ECHO_C" >&6 +if test "${jm_cv_func_working_malloc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - jm_cv_func_working_malloc=no + When crosscompiling else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ char *malloc (); int @@ -2472,107 +9073,174 @@ else { exit (malloc (0) ? 0 : 1); } - -EOF -if { (eval echo configure:2478: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then jm_cv_func_working_malloc=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - jm_cv_func_working_malloc=no + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +jm_cv_func_working_malloc=no fi -rm -fr conftest* +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - fi - -echo "$ac_t""$jm_cv_func_working_malloc" 1>&6 +echo "$as_me:$LINENO: result: $jm_cv_func_working_malloc" >&5 +echo "${ECHO_T}$jm_cv_func_working_malloc" >&6 if test $jm_cv_func_working_malloc = no; then - LIBOBJS="$LIBOBJS malloc.o" - cat >> confdefs.h <>confdefs.h <<\_ACEOF #define malloc rpl_malloc -EOF +_ACEOF fi if test x = y; then - for ac_func in DONE_WORKING_REALLOC_CHECK + +for ac_func in DONE_WORKING_REALLOC_CHECK do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2507: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:2535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 fi done fi - ac_kludge=HAVE_DONE_WORKING_REALLOC_CHECK - cat >> confdefs.h <>confdefs.h <<\_ACEOF +#define HAVE_DONE_WORKING_REALLOC_CHECK 1 +_ACEOF - echo $ac_n "checking for working realloc""... $ac_c" 1>&6 -echo "configure:2567: checking for working realloc" >&5 -if eval "test \"`echo '$''{'jm_cv_func_working_realloc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for working realloc" >&5 +echo $ECHO_N "checking for working realloc... $ECHO_C" >&6 +if test "${jm_cv_func_working_realloc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - jm_cv_func_working_realloc=no + When crosscompiling else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ char *realloc (); int @@ -2580,1562 +9248,546 @@ else { exit (realloc (0, 0) ? 0 : 1); } - -EOF -if { (eval echo configure:2586: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then jm_cv_func_working_realloc=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - jm_cv_func_working_realloc=no + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +jm_cv_func_working_realloc=no fi -rm -fr conftest* +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - fi - -echo "$ac_t""$jm_cv_func_working_realloc" 1>&6 +echo "$as_me:$LINENO: result: $jm_cv_func_working_realloc" >&5 +echo "${ECHO_T}$jm_cv_func_working_realloc" >&6 if test $jm_cv_func_working_realloc = no; then - LIBOBJS="$LIBOBJS realloc.o" - cat >> confdefs.h <>confdefs.h <<\_ACEOF #define realloc rpl_realloc -EOF +_ACEOF fi -# Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2614: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" -fi -fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi -echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:2642: checking for inline" >&5 -if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for socket" >&5 +echo $ECHO_N "checking for socket... $ECHO_C" >&6 +if test "${ac_cv_func_socket+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define socket to an innocuous variant, in case declares socket. + For example, HP-UX 11i declares gettimeofday. */ +#define socket innocuous_socket -int main() { -} $ac_kw foo() { -; return 0; } -EOF -if { (eval echo configure:2656: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_c_inline=$ac_kw; break -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -done - -fi - -echo "$ac_t""$ac_cv_c_inline" 1>&6 -case "$ac_cv_c_inline" in - inline | yes) ;; - no) cat >> confdefs.h <<\EOF -#define inline -EOF - ;; - *) cat >> confdefs.h <&6 -echo "configure:2682: checking for off_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#if STDC_HEADERS -#include -#include -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_type_off_t=yes -else - rm -rf conftest* - ac_cv_type_off_t=no -fi -rm -f conftest* - -fi -echo "$ac_t""$ac_cv_type_off_t" 1>&6 -if test $ac_cv_type_off_t = no; then - cat >> confdefs.h <<\EOF -#define off_t long -EOF - -fi - -for ac_hdr in unistd.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2718: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2728: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&6 -fi -done - -for ac_func in getpagesize -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2757: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < + which can conflict with char socket (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef socket + /* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:2785: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi -done - -echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:2810: checking for working mmap" >&5 -if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_mmap_fixed_mapped=no -else - cat > conftest.$ac_ext < -#include -#include - -/* This mess was copied from the GNU getpagesize.h. */ -#ifndef HAVE_GETPAGESIZE -# ifdef HAVE_UNISTD_H -# include -# endif - -/* Assume that all systems that can run configure have sys/param.h. */ -# ifndef HAVE_SYS_PARAM_H -# define HAVE_SYS_PARAM_H 1 -# endif - -# ifdef _SC_PAGESIZE -# define getpagesize() sysconf(_SC_PAGESIZE) -# else /* no _SC_PAGESIZE */ -# ifdef HAVE_SYS_PARAM_H -# include -# ifdef EXEC_PAGESIZE -# define getpagesize() EXEC_PAGESIZE -# else /* no EXEC_PAGESIZE */ -# ifdef NBPG -# define getpagesize() NBPG * CLSIZE -# ifndef CLSIZE -# define CLSIZE 1 -# endif /* no CLSIZE */ -# else /* no NBPG */ -# ifdef NBPC -# define getpagesize() NBPC -# else /* no NBPC */ -# ifdef PAGESIZE -# define getpagesize() PAGESIZE -# endif /* PAGESIZE */ -# endif /* no NBPC */ -# endif /* no NBPG */ -# endif /* no EXEC_PAGESIZE */ -# else /* no HAVE_SYS_PARAM_H */ -# define getpagesize() 8192 /* punt totally */ -# endif /* no HAVE_SYS_PARAM_H */ -# endif /* no _SC_PAGESIZE */ - -#endif /* no HAVE_GETPAGESIZE */ - #ifdef __cplusplus -extern "C" { void *malloc(unsigned); } -#else -char *malloc(); -#endif - -int -main() +extern "C" { - char *data, *data2, *data3; - int i, pagesize; - int fd; - - pagesize = getpagesize(); - - /* - * First, make a file with some known garbage in it. - */ - data = malloc(pagesize); - if (!data) - exit(1); - for (i = 0; i < pagesize; ++i) - *(data + i) = rand(); - umask(0); - fd = creat("conftestmmap", 0600); - if (fd < 0) - exit(1); - if (write(fd, data, pagesize) != pagesize) - exit(1); - close(fd); - - /* - * Next, try to mmap the file at a fixed address which - * already has something else allocated at it. If we can, - * also make sure that we see the same garbage. - */ - fd = open("conftestmmap", O_RDWR); - if (fd < 0) - exit(1); - data2 = malloc(2 * pagesize); - if (!data2) - exit(1); - data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); - if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_FIXED, fd, 0L)) - exit(1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data2 + i)) - exit(1); - - /* - * Finally, make sure that changes to the mapped area - * do not percolate back to the file as seen by read(). - * (This is a bug on some variants of i386 svr4.0.) - */ - for (i = 0; i < pagesize; ++i) - *(data2 + i) = *(data2 + i) + 1; - data3 = malloc(pagesize); - if (!data3) - exit(1); - if (read(fd, data3, pagesize) != pagesize) - exit(1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data3 + i)) - exit(1); - close(fd); - unlink("conftestmmap"); - exit(0); -} - -EOF -if { (eval echo configure:2958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_func_mmap_fixed_mapped=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_func_mmap_fixed_mapped=no -fi -rm -fr conftest* -fi - -fi - -echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6 -if test $ac_cv_func_mmap_fixed_mapped = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_MMAP 1 -EOF - -fi - - - echo $ac_n "checking whether we are using the GNU C Library 2.1 or newer""... $ac_c" 1>&6 -echo "configure:2982: checking whether we are using the GNU C Library 2.1 or newer" >&5 -if eval "test \"`echo '$''{'ac_cv_gnu_library_2_1'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#ifdef __GNU_LIBRARY__ - #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) - Lucky GNU user - #endif #endif - -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "Lucky GNU user" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_gnu_library_2_1=yes -else - rm -rf conftest* - ac_cv_gnu_library_2_1=no -fi -rm -f conftest* - - - -fi - -echo "$ac_t""$ac_cv_gnu_library_2_1" 1>&6 - - GLIBC21="$ac_cv_gnu_library_2_1" - - - - for ac_hdr in argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ -stdlib.h string.h unistd.h sys/param.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3023: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3033: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&6 -fi -done - - for ac_func in feof_unlocked fgets_unlocked getcwd getegid geteuid \ -getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \ -strdup strtoul tsearch __argz_count __argz_stringify __argz_next -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3064: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:3092: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi -done - - - - - # Check whether --with-libiconv-prefix or --without-libiconv-prefix was given. -if test "${with_libiconv_prefix+set}" = set; then - withval="$with_libiconv_prefix" - - for dir in `echo "$withval" | tr : ' '`; do - if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi - if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi - done - -fi - - - echo $ac_n "checking for iconv""... $ac_c" 1>&6 -echo "configure:3132: checking for iconv" >&5 -if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - - am_cv_func_iconv="no, consider installing GNU libiconv" - am_cv_lib_iconv=no - cat > conftest.$ac_ext < -#include -int main() { -iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd); -; return 0; } -EOF -if { (eval echo configure:3150: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - am_cv_func_iconv=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* - if test "$am_cv_func_iconv" != yes; then - am_save_LIBS="$LIBS" - LIBS="$LIBS -liconv" - cat > conftest.$ac_ext < -#include -int main() { -iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd); -; return 0; } -EOF -if { (eval echo configure:3172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - am_cv_lib_iconv=yes - am_cv_func_iconv=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* - LIBS="$am_save_LIBS" - fi - -fi - -echo "$ac_t""$am_cv_func_iconv" 1>&6 - if test "$am_cv_func_iconv" = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_ICONV 1 -EOF - - echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6 -echo "configure:3193: checking for iconv declaration" >&5 - if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - - cat > conftest.$ac_ext < -#include -extern -#ifdef __cplusplus -"C" -#endif -#if defined(__STDC__) || defined(__cplusplus) -size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); -#else -size_t iconv(); -#endif - -int main() { - -; return 0; } -EOF -if { (eval echo configure:3218: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - am_cv_proto_iconv_arg1="" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - am_cv_proto_iconv_arg1="const" -fi -rm -f conftest* - am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" -fi - - am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` - echo "$ac_t""${ac_t:- - }$am_cv_proto_iconv" 1>&6 - cat >> confdefs.h <&6 -echo "configure:3247: checking for nl_langinfo and CODESET" >&5 -if eval "test \"`echo '$''{'am_cv_langinfo_codeset'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -int main() { -char* cs = nl_langinfo(CODESET); -; return 0; } -EOF -if { (eval echo configure:3259: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - am_cv_langinfo_codeset=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - am_cv_langinfo_codeset=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$am_cv_langinfo_codeset" 1>&6 - if test $am_cv_langinfo_codeset = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_LANGINFO_CODESET 1 -EOF - - fi - - if test $ac_cv_header_locale_h = yes; then - echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:3282: checking for LC_MESSAGES" >&5 -if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -int main() { -return LC_MESSAGES -; return 0; } -EOF -if { (eval echo configure:3294: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - am_cv_val_LC_MESSAGES=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - am_cv_val_LC_MESSAGES=no -fi -rm -f conftest* -fi - -echo "$ac_t""$am_cv_val_LC_MESSAGES" 1>&6 - if test $am_cv_val_LC_MESSAGES = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_LC_MESSAGES 1 -EOF - - fi - fi - echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:3315: checking whether NLS is requested" >&5 - # Check whether --enable-nls or --disable-nls was given. -if test "${enable_nls+set}" = set; then - enableval="$enable_nls" - USE_NLS=$enableval -else - USE_NLS=yes -fi - - echo "$ac_t""$USE_NLS" 1>&6 - - - BUILD_INCLUDED_LIBINTL=no - USE_INCLUDED_LIBINTL=no - INTLLIBS= - - if test "$USE_NLS" = "yes"; then - cat >> confdefs.h <<\EOF -#define ENABLE_NLS 1 -EOF - - echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:3337: checking whether included gettext is requested" >&5 - # Check whether --with-included-gettext or --without-included-gettext was given. -if test "${with_included_gettext+set}" = set; then - withval="$with_included_gettext" - nls_cv_force_use_gnu_gettext=$withval -else - nls_cv_force_use_gnu_gettext=no -fi - - echo "$ac_t""$nls_cv_force_use_gnu_gettext" 1>&6 - - nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" - if test "$nls_cv_force_use_gnu_gettext" != "yes"; then - CATOBJEXT=NONE - - - - - ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:3357: checking for libintl.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3367: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - echo $ac_n "checking for GNU gettext in libc""... $ac_c" 1>&6 -echo "configure:3384: checking for GNU gettext in libc" >&5 -if eval "test \"`echo '$''{'gt_cv_func_gnugettext1_libc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -extern int _nl_msg_cat_cntr; -int main() { -bindtextdomain ("", ""); -return (int) gettext ("") + _nl_msg_cat_cntr -; return 0; } -EOF -if { (eval echo configure:3398: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - gt_cv_func_gnugettext1_libc=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gt_cv_func_gnugettext1_libc=no -fi -rm -f conftest* -fi - -echo "$ac_t""$gt_cv_func_gnugettext1_libc" 1>&6 - - if test "$gt_cv_func_gnugettext1_libc" != "yes"; then - echo $ac_n "checking for GNU gettext in libintl""... $ac_c" 1>&6 -echo "configure:3414: checking for GNU gettext in libintl" >&5 -if eval "test \"`echo '$''{'gt_cv_func_gnugettext1_libintl'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - gt_save_LIBS="$LIBS" - LIBS="$LIBS -lintl $LIBICONV" - cat > conftest.$ac_ext < -extern int _nl_msg_cat_cntr; -int main() { -bindtextdomain ("", ""); -return (int) gettext ("") + _nl_msg_cat_cntr -; return 0; } -EOF -if { (eval echo configure:3430: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - gt_cv_func_gnugettext1_libintl=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gt_cv_func_gnugettext1_libintl=no -fi -rm -f conftest* - LIBS="$gt_save_LIBS" -fi - -echo "$ac_t""$gt_cv_func_gnugettext1_libintl" 1>&6 - fi - - if test "$gt_cv_func_gnugettext1_libc" = "yes" \ - || { test "$gt_cv_func_gnugettext1_libintl" = "yes" \ - && test "$PACKAGE" != gettext; }; then - cat >> confdefs.h <<\EOF -#define HAVE_GETTEXT 1 -EOF - - - if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then - INTLLIBS="-lintl $LIBICONV" - fi - - gt_save_LIBS="$LIBS" - LIBS="$LIBS $INTLLIBS" - for ac_func in dcgettext -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3463: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:3491: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi -done - - LIBS="$gt_save_LIBS" - - # Extract the first word of "msgfmt", so it can be a program name with args. -set dummy msgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3520: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$MSGFMT" in - /*) - ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1; then - ac_cv_path_MSGFMT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" - ;; -esac -fi -MSGFMT="$ac_cv_path_MSGFMT" -if test "$MSGFMT" != ":"; then - echo "$ac_t""$MSGFMT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - # Extract the first word of "gmsgfmt", so it can be a program name with args. -set dummy gmsgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3554: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$GMSGFMT" in - /*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. - ;; - ?:/*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_GMSGFMT="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" - ;; -esac -fi -GMSGFMT="$ac_cv_path_GMSGFMT" -if test -n "$GMSGFMT"; then - echo "$ac_t""$GMSGFMT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - - # Extract the first word of "xgettext", so it can be a program name with args. -set dummy xgettext; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3591: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$XGETTEXT" in - /*) - ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1; then - ac_cv_path_XGETTEXT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" - ;; -esac -fi -XGETTEXT="$ac_cv_path_XGETTEXT" -if test "$XGETTEXT" != ":"; then - echo "$ac_t""$XGETTEXT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - - CATOBJEXT=.gmo - fi - -else - echo "$ac_t""no" 1>&6 -fi - - - if test "$CATOBJEXT" = "NONE"; then - nls_cv_use_gnu_gettext=yes - fi - fi - - if test "$nls_cv_use_gnu_gettext" = "yes"; then - INTLOBJS="\$(GETTOBJS)" - # Extract the first word of "msgfmt", so it can be a program name with args. -set dummy msgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3641: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$MSGFMT" in - /*) - ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1; then - ac_cv_path_MSGFMT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" - ;; -esac -fi -MSGFMT="$ac_cv_path_MSGFMT" -if test "$MSGFMT" != ":"; then - echo "$ac_t""$MSGFMT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - # Extract the first word of "gmsgfmt", so it can be a program name with args. -set dummy gmsgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3675: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$GMSGFMT" in - /*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. - ;; - ?:/*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_GMSGFMT="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" - ;; -esac -fi -GMSGFMT="$ac_cv_path_GMSGFMT" -if test -n "$GMSGFMT"; then - echo "$ac_t""$GMSGFMT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - # Extract the first word of "xgettext", so it can be a program name with args. -set dummy xgettext; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3711: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$XGETTEXT" in - /*) - ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1; then - ac_cv_path_XGETTEXT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" - ;; -esac -fi -XGETTEXT="$ac_cv_path_XGETTEXT" -if test "$XGETTEXT" != ":"; then - echo "$ac_t""$XGETTEXT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - - BUILD_INCLUDED_LIBINTL=yes - USE_INCLUDED_LIBINTL=yes - CATOBJEXT=.gmo - INTLLIBS="\$(top_builddir)/intl/libintl.a $LIBICONV" - LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` - fi - - if test "$GMSGFMT" != ":"; then - if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then - : ; - else - echo "$ac_t""found msgfmt program is not GNU msgfmt; ignore it" 1>&6 - GMSGFMT=":" - fi - fi - - if test "$XGETTEXT" != ":"; then - if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then - : ; - else - echo "$ac_t""found xgettext program is not GNU xgettext; ignore it" 1>&6 - XGETTEXT=":" - fi - fi - - POSUB=po - fi - - - - if test "$PACKAGE" = gettext; then - BUILD_INCLUDED_LIBINTL=yes - fi - - for ac_prog in bison -do -# Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3782: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_INTLBISON'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$INTLBISON"; then - ac_cv_prog_INTLBISON="$INTLBISON" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_INTLBISON="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -INTLBISON="$ac_cv_prog_INTLBISON" -if test -n "$INTLBISON"; then - echo "$ac_t""$INTLBISON" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$INTLBISON" && break -done - - if test -z "$INTLBISON"; then - ac_verc_fail=yes - else - echo $ac_n "checking version of bison""... $ac_c" 1>&6 -echo "configure:3815: checking version of bison" >&5 - ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` - case $ac_prog_version in - '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; - 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) - ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; - *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; - esac - echo "$ac_t""$ac_prog_version" 1>&6 - fi - if test $ac_verc_fail = yes; then - INTLBISON=: - fi - - for lang in $ALL_LINGUAS; do - GMOFILES="$GMOFILES $lang.gmo" - POFILES="$POFILES $lang.po" - done - - - - - - - - - - - - nls_cv_header_intl= - nls_cv_header_libgt= - - DATADIRNAME=share - - - INSTOBJEXT=.mo - - - GENCAT=gencat - - - - if test "x$CATOBJEXT" != "x"; then - if test "x$ALL_LINGUAS" = "x"; then - LINGUAS= - else - echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:3862: checking for catalogs to be installed" >&5 - NEW_LINGUAS= - for presentlang in $ALL_LINGUAS; do - useit=no - for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do - # Use the presentlang catalog if desiredlang is - # a. equal to presentlang, or - # b. a variant of presentlang (because in this case, - # presentlang can be used as a fallback for messages - # which are not translated in the desiredlang catalog). - case "$desiredlang" in - "$presentlang"*) useit=yes;; - esac - done - if test $useit = yes; then - NEW_LINGUAS="$NEW_LINGUAS $presentlang" - fi - done - LINGUAS=$NEW_LINGUAS - echo "$ac_t""$LINGUAS" 1>&6 - fi - - if test -n "$LINGUAS"; then - for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done - fi - fi - - MKINSTALLDIRS= - if test -n "$ac_aux_dir"; then - MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" - fi - if test -z "$MKINSTALLDIRS"; then - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" - fi - - - INTL_LIBTOOL_SUFFIX_PREFIX= - - - - - -echo $ac_n "checking for socket""... $ac_c" 1>&6 -echo "configure:3905: checking for socket" >&5 -if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char socket(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char socket (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_socket) || defined (__stub___socket) choke me #else -socket(); +char (*f) () = socket; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:3933: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_socket=yes" +int +main () +{ +return f != socket; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_socket=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_socket=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -if eval "test \"`echo '$ac_cv_func_'socket`\" = yes"; then - echo "$ac_t""yes" 1>&6 +ac_cv_func_socket=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_socket" >&5 +echo "${ECHO_T}$ac_cv_func_socket" >&6 +if test $ac_cv_func_socket = yes; then : else - echo "$ac_t""no" 1>&6 - echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:3952: checking for connect in -lsocket" >&5 -ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:$LINENO: checking for connect in -lsocket" >&5 +echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6 +if test "${ac_cv_lib_socket_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char connect(); - -int main() { -connect() -; return 0; } -EOF -if { (eval echo configure:3971: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + builtin and then its argument prototype would still apply. */ +char connect (); +int +main () +{ +connect (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_socket_connect=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_lib_socket_connect=no fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <&5 +echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6 +if test $ac_cv_lib_socket_connect = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBSOCKET 1 +_ACEOF LIBS="-lsocket $LIBS" -else - echo "$ac_t""no" 1>&6 fi fi -echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:4002: checking for gethostbyname" >&5 -if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for gethostbyname" >&5 +echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 +if test "${ac_cv_func_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define gethostbyname to an innocuous variant, in case declares gethostbyname. + For example, HP-UX 11i declares gettimeofday. */ +#define gethostbyname innocuous_gethostbyname + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char gethostbyname(); below. */ -#include + which can conflict with char gethostbyname (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef gethostbyname + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char gethostbyname(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char gethostbyname (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) choke me #else -gethostbyname(); +char (*f) () = gethostbyname; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:4030: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_gethostbyname=yes" +int +main () +{ +return f != gethostbyname; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_gethostbyname=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_gethostbyname=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then - echo "$ac_t""yes" 1>&6 +ac_cv_func_gethostbyname=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 +if test $ac_cv_func_gethostbyname = yes; then : else - echo "$ac_t""no" 1>&6 - echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:4049: checking for gethostbyname in -lnsl" >&5 -ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 +echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 +if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char gethostbyname(); - -int main() { -gethostbyname() -; return 0; } -EOF -if { (eval echo configure:4068: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +int +main () +{ +gethostbyname (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_nsl_gethostbyname=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_lib_nsl_gethostbyname=no fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <&5 +echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 +if test $ac_cv_lib_nsl_gethostbyname = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBNSL 1 +_ACEOF LIBS="-lnsl $LIBS" +fi + + +fi + + + + + + + +for ac_func in freeaddrinfo gai_strerror getaddrinfo getnameinfo inet_aton +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "$ac_t""no" 1>&6 -fi + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF fi +done -cat > confcache <<\EOF +cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. # -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. # -EOF +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi @@ -4143,6 +9795,9 @@ fi rm -f confcache +case $host_os in + *linux*) + # Check whether --with-kernel or --without-kernel was given. if test "${with_kernel+set}" = set; then @@ -4151,546 +9806,1332 @@ if test "${with_kernel+set}" = set; then else kerneldir="/usr/src/linux" -fi +fi; - -echo $ac_n "checking for linux/if_tun.h""... $ac_c" 1>&6 -echo "configure:4159: checking for linux/if_tun.h" >&5 -if eval "test \"`echo '$''{'tinc_cv_linux_if_tun_h'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for linux/if_tun.h" >&5 +echo $ECHO_N "checking for linux/if_tun.h... $ECHO_C" >&6 +if test "${tinc_cv_linux_if_tun_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - - cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include "$kerneldir/include/linux/if_tun.h" + int a = IFF_TAP; + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then if_tun_h="\"$kerneldir/include/linux/if_tun.h\"" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - cat > conftest.$ac_ext < -int main() { -int a = IFF_TAP; -; return 0; } -EOF -if { (eval echo configure:4187: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include + int a = IFF_TAP; + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then if_tun_h="default" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - if_tun_h="no" - -fi -rm -f conftest* - -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - if test $if_tun_h = no; then - tinc_cv_linux_if_tun_h=none - else - tinc_cv_linux_if_tun_h="$if_tun_h" - fi +if_tun_h="no" fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$ac_t""$tinc_cv_linux_if_tun_h" 1>&6 +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -if test $tinc_cv_linux_if_tun_h != none; then - cat >> confdefs.h <<\EOF + if test $if_tun_h = no; then + tinc_cv_linux_if_tun_h=none + else + tinc_cv_linux_if_tun_h="$if_tun_h" + fi + +fi +echo "$as_me:$LINENO: result: $tinc_cv_linux_if_tun_h" >&5 +echo "${ECHO_T}$tinc_cv_linux_if_tun_h" >&6 + + if test $tinc_cv_linux_if_tun_h != none; then + +cat >>confdefs.h <<\_ACEOF #define HAVE_TUNTAP 1 -EOF +_ACEOF - if test $tinc_cv_linux_if_tun_h != default; then - cat >> confdefs.h <>confdefs.h <<_ACEOF #define LINUX_IF_TUN_H $tinc_cv_linux_if_tun_h -EOF +_ACEOF + fi fi -fi + ;; +esac - tinc_ac_save_CPPFLAGS="$CPPFLAGS" - # Check whether --with-openssl-include or --without-openssl-include was given. + +# Check whether --with-openssl or --without-openssl was given. +if test "${with_openssl+set}" = set; then + withval="$with_openssl" + openssl="$withval" + CPPFLAGS="$CPPFLAGS -I$withval/include" + LDFLAGS="$LDFLAGS -L$withval/lib" + +fi; + + +# Check whether --with-openssl-include or --without-openssl-include was given. if test "${with_openssl_include+set}" = set; then withval="$with_openssl_include" openssl_include="$withval" - CFLAGS="$CFLAGS -I$withval" CPPFLAGS="$CPPFLAGS -I$withval" - -fi + +fi; - # Check whether --with-openssl-lib or --without-openssl-lib was given. +# Check whether --with-openssl-lib or --without-openssl-lib was given. if test "${with_openssl_lib+set}" = set; then withval="$with_openssl_lib" openssl_lib="$withval" - LIBS="$LIBS -L$withval" - -fi + LDFLAGS="$LDFLAGS -L$withval" + +fi; - for ac_hdr in openssl/evp.h openssl/rsa.h openssl/rand.h openssl/err.h openssl/sha.h openssl/pem.h + + + + + +for ac_header in openssl/evp.h openssl/rsa.h openssl/rand.h openssl/err.h openssl/sha.h openssl/pem.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4253: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4263: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - echo "$ac_t""no" 1>&6 -{ echo "configure: error: "OpenSSL header files not found."" 1>&2; exit 1; }; break - + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + { { echo "$as_me:$LINENO: error: OpenSSL header files not found." >&5 +echo "$as_me: error: OpenSSL header files not found." >&2;} + { (exit 1); exit 1; }; }; break + +fi + done - CPPFLAGS="$tinc_ac_save_CPPFLAGS" - - echo $ac_n "checking for SHA1_version in -lcrypto""... $ac_c" 1>&6 -echo "configure:4295: checking for SHA1_version in -lcrypto" >&5 -ac_lib_var=`echo crypto'_'SHA1_version | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +case $host_os in + *mingw*) + echo "$as_me:$LINENO: checking for SHA1_version in -lcrypto" >&5 +echo $ECHO_N "checking for SHA1_version in -lcrypto... $ECHO_C" >&6 +if test "${ac_cv_lib_crypto_SHA1_version+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-lcrypto $LIBS" -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char SHA1_version(); - -int main() { -SHA1_version() -; return 0; } -EOF -if { (eval echo configure:4314: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + builtin and then its argument prototype would still apply. */ +char SHA1_version (); +int +main () +{ +SHA1_version (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_crypto_SHA1_version=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_crypto_SHA1_version=no fi -rm -f conftest* -LIBS="$ac_save_LIBS" +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_SHA1_version" >&5 +echo "${ECHO_T}$ac_cv_lib_crypto_SHA1_version" >&6 +if test $ac_cv_lib_crypto_SHA1_version = yes; then + LIBS="$LIBS -lcrypto -lgdi32" +else + { { echo "$as_me:$LINENO: error: OpenSSL libraries not found." >&5 +echo "$as_me: error: OpenSSL libraries not found." >&2;} + { (exit 1); exit 1; }; } fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 + + ;; + *) + echo "$as_me:$LINENO: checking for SHA1_version in -lcrypto" >&5 +echo $ECHO_N "checking for SHA1_version in -lcrypto... $ECHO_C" >&6 +if test "${ac_cv_lib_crypto_SHA1_version+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcrypto $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char SHA1_version (); +int +main () +{ +SHA1_version (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_crypto_SHA1_version=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_crypto_SHA1_version=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_SHA1_version" >&5 +echo "${ECHO_T}$ac_cv_lib_crypto_SHA1_version" >&6 +if test $ac_cv_lib_crypto_SHA1_version = yes; then LIBS="$LIBS -lcrypto" else - echo "$ac_t""no" 1>&6 -{ echo "configure: error: "OpenSSL libraries not found."" 1>&2; exit 1; } - + { { echo "$as_me:$LINENO: error: OpenSSL libraries not found." >&5 +echo "$as_me: error: OpenSSL libraries not found." >&2;} + { (exit 1); exit 1; }; } + fi - for ac_func in RAND_pseudo_bytes -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4340: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me +#ifdef __STDC__ +# include #else -$ac_func(); +# include #endif -; return 0; } -EOF -if { (eval echo configure:4368: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi +#undef dlopen -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi -done - - - echo $ac_n "checking for OpenSSL_add_all_algorithms""... $ac_c" 1>&6 -echo "configure:4394: checking for OpenSSL_add_all_algorithms" >&5 -if eval "test \"`echo '$''{'ac_cv_func_OpenSSL_add_all_algorithms'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char OpenSSL_add_all_algorithms(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_OpenSSL_add_all_algorithms) || defined (__stub___OpenSSL_add_all_algorithms) -choke me -#else -OpenSSL_add_all_algorithms(); +#ifdef __cplusplus +extern "C" +{ #endif - -; return 0; } -EOF -if { (eval echo configure:4422: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_OpenSSL_add_all_algorithms=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_OpenSSL_add_all_algorithms=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'OpenSSL_add_all_algorithms`\" = yes"; then - echo "$ac_t""yes" 1>&6 - : -else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for SSLeay_add_all_algorithms""... $ac_c" 1>&6 -echo "configure:4440: checking for SSLeay_add_all_algorithms" >&5 -if eval "test \"`echo '$''{'ac_cv_func_SSLeay_add_all_algorithms'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char SSLeay_add_all_algorithms(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_SSLeay_add_all_algorithms) || defined (__stub___SSLeay_add_all_algorithms) -choke me -#else -SSLeay_add_all_algorithms(); -#endif - -; return 0; } -EOF -if { (eval echo configure:4468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_SSLeay_add_all_algorithms=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_SSLeay_add_all_algorithms=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'SSLeay_add_all_algorithms`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF -#define HAVE_SSLEAY_ADD_ALL_ALGORITHMS 1 -EOF - -else - echo "$ac_t""no" 1>&6 -{ echo "configure: error: "Missing required OpenSSL functionality!"" 1>&2; exit 1; } - -fi - - -fi - - - echo $ac_n "checking for dlopen""... $ac_c" 1>&6 -echo "configure:4497: checking for dlopen" >&5 -if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char dlopen (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_dlopen) || defined (__stub___dlopen) choke me #else -dlopen(); +char (*f) () = dlopen; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:4525: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_dlopen=yes" +int +main () +{ +return f != dlopen; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_dlopen=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_dlopen=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then - echo "$ac_t""yes" 1>&6 +ac_cv_func_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then : else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:4543: checking for dlopen in -ldl" >&5 -ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen(); - -int main() { -dlopen() -; return 0; } -EOF -if { (eval echo configure:4562: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_lib_dl_dlopen=no fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then LIBS="$LIBS -ldl" else - echo "$ac_t""no" 1>&6 -{ echo "configure: error: "OpenSSL depends on libdl."" 1>&2; exit 1; } - -fi + { { echo "$as_me:$LINENO: error: OpenSSL depends on libdl." >&5 +echo "$as_me: error: OpenSSL depends on libdl." >&2;} + { (exit 1); exit 1; }; }; break - fi - - tinc_ac_save_CPPFLAGS="$CPPFLAGS" - - # Check whether --with-zlib-include or --without-zlib-include was given. -if test "${with_zlib_include+set}" = set; then - withval="$with_zlib_include" - zlib_include="$withval" - CFLAGS="$CFLAGS -I$withval" - CPPFLAGS="$CPPFLAGS -I$withval" - fi - - # Check whether --with-zlib-lib or --without-zlib-lib was given. -if test "${with_zlib_lib+set}" = set; then - withval="$with_zlib_lib" - zlib_lib="$withval" - LIBS="$LIBS -L$withval" - -fi + ;; +esac - for ac_hdr in zlib.h + +for ac_func in RAND_pseudo_bytes EVP_EncryptInit_ex do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4614: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4624: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + else - echo "$ac_t""no" 1>&6 -{ echo "configure: error: "zlib header files not found."" 1>&2; exit 1; }; break - + { { echo "$as_me:$LINENO: error: Missing OpenSSL functionality, make sure you have installed the latest version." >&5 +echo "$as_me: error: Missing OpenSSL functionality, make sure you have installed the latest version." >&2;} + { (exit 1); exit 1; }; }; break fi done - CPPFLAGS="$tinc_ac_save_CPPFLAGS" - - echo $ac_n "checking for compress2 in -lz""... $ac_c" 1>&6 -echo "configure:4656: checking for compress2 in -lz" >&5 -ac_lib_var=`echo z'_'compress2 | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking whether OpenSSL_add_all_algorithms is declared" >&5 +echo $ECHO_N "checking whether OpenSSL_add_all_algorithms is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_OpenSSL_add_all_algorithms+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + + +int +main () +{ +#ifndef OpenSSL_add_all_algorithms + char *p = (char *) OpenSSL_add_all_algorithms; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_OpenSSL_add_all_algorithms=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_OpenSSL_add_all_algorithms=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_OpenSSL_add_all_algorithms" >&5 +echo "${ECHO_T}$ac_cv_have_decl_OpenSSL_add_all_algorithms" >&6 +if test $ac_cv_have_decl_OpenSSL_add_all_algorithms = yes; then + : +else + { { echo "$as_me:$LINENO: error: Missing OpenSSL functionality, make sure you have installed the latest version." >&5 +echo "$as_me: error: Missing OpenSSL functionality, make sure you have installed the latest version." >&2;} + { (exit 1); exit 1; }; }; break +fi + + + + +# Check whether --with-zlib or --without-zlib was given. +if test "${with_zlib+set}" = set; then + withval="$with_zlib" + zlib="$withval" + CPPFLAGS="$CPPFLAGS -I$withval/include" + LDFLAGS="$LDFLAGS -L$withval/lib" + +fi; + + +# Check whether --with-zlib-include or --without-zlib-include was given. +if test "${with_zlib_include+set}" = set; then + withval="$with_zlib_include" + zlib_include="$withval" + CPPFLAGS="$CPPFLAGS -I$withval" + +fi; + + +# Check whether --with-zlib-lib or --without-zlib-lib was given. +if test "${with_zlib_lib+set}" = set; then + withval="$with_zlib_lib" + zlib_lib="$withval" + LDFLAGS="$LDFLAGS -L$withval" + +fi; + + +for ac_header in zlib.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + { { echo "$as_me:$LINENO: error: \"zlib header files not found.\"" >&5 +echo "$as_me: error: \"zlib header files not found.\"" >&2;} + { (exit 1); exit 1; }; }; break + +fi + +done + + + echo "$as_me:$LINENO: checking for compress2 in -lz" >&5 +echo $ECHO_N "checking for compress2 in -lz... $ECHO_C" >&6 +if test "${ac_cv_lib_z_compress2+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char compress2(); - -int main() { -compress2() -; return 0; } -EOF -if { (eval echo configure:4675: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + builtin and then its argument prototype would still apply. */ +char compress2 (); +int +main () +{ +compress2 (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_z_compress2=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_lib_z_compress2=no fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_z_compress2" >&5 +echo "${ECHO_T}$ac_cv_lib_z_compress2" >&6 +if test $ac_cv_lib_z_compress2 = yes; then LIBS="$LIBS -lz" else - echo "$ac_t""no" 1>&6 -{ echo "configure: error: "zlib libraries not found."" 1>&2; exit 1; } - + { { echo "$as_me:$LINENO: error: \"zlib libraries not found.\"" >&5 +echo "$as_me: error: \"zlib libraries not found.\"" >&2;} + { (exit 1); exit 1; }; } + +fi + + + + +# Check whether --with-lzo or --without-lzo was given. +if test "${with_lzo+set}" = set; then + withval="$with_lzo" + lzo="$withval" + CPPFLAGS="$CPPFLAGS -I$withval/include" + LDFLAGS="$LDFLAGS -L$withval/lib" + +fi; + + +# Check whether --with-lzo-include or --without-lzo-include was given. +if test "${with_lzo_include+set}" = set; then + withval="$with_lzo_include" + lzo_include="$withval" + CPPFLAGS="$CPPFLAGS -I$withval" + +fi; + + +# Check whether --with-lzo-lib or --without-lzo-lib was given. +if test "${with_lzo_lib+set}" = set; then + withval="$with_lzo_lib" + lzo_lib="$withval" + LDFLAGS="$LDFLAGS -L$withval" + +fi; + + +for ac_header in lzo1x.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + { { echo "$as_me:$LINENO: error: \"lzo header files not found.\"" >&5 +echo "$as_me: error: \"lzo header files not found.\"" >&2;} + { (exit 1); exit 1; }; }; break + +fi + +done + + + echo "$as_me:$LINENO: checking for lzo1x_1_compress in -llzo" >&5 +echo $ECHO_N "checking for lzo1x_1_compress in -llzo... $ECHO_C" >&6 +if test "${ac_cv_lib_lzo_lzo1x_1_compress+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-llzo $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char lzo1x_1_compress (); +int +main () +{ +lzo1x_1_compress (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_lzo_lzo1x_1_compress=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_lzo_lzo1x_1_compress=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_lzo_lzo1x_1_compress" >&5 +echo "${ECHO_T}$ac_cv_lib_lzo_lzo1x_1_compress" >&6 +if test $ac_cv_lib_lzo_lzo1x_1_compress = yes; then + LIBS="$LIBS -llzo" +else + { { echo "$as_me:$LINENO: error: \"lzo libraries not found.\"" >&5 +echo "$as_me: error: \"lzo libraries not found.\"" >&2;} + { (exit 1); exit 1; }; } + fi @@ -4698,490 +11139,1499 @@ fi # Check whether --enable-jumbograms or --disable-jumbograms was given. if test "${enable_jumbograms+set}" = set; then enableval="$enable_jumbograms" - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define ENABLE_JUMBOGRAMS 1 -EOF - +_ACEOF -fi +fi; # Check whether --enable-tracing or --disable-tracing was given. if test "${enable_tracing+set}" = set; then enableval="$enable_tracing" - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define ENABLE_TRACING 1 -EOF - +_ACEOF -fi + +fi; + ac_config_files="$ac_config_files Makefile src/Makefile doc/Makefile lib/Makefile po/Makefile.in m4/Makefile" -trap '' 1 2 15 -cat > confcache <<\EOF + +cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. # -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. # -EOF +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' fi -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - DEFS=-DHAVE_CONFIG_H -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS </dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done +LIBOBJS=$ac_libobjs -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" +LTLIBOBJS=$ac_ltlibobjs -trap 'rm -fr `echo "Makefile -src/Makefile -doc/Makefile -doc/es/Makefile -intl/Makefile -lib/Makefile -m4/Makefile -po/Makefile.in - config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@PACKAGE@%$PACKAGE%g -s%@VERSION@%$VERSION%g -s%@EXEEXT@%$EXEEXT%g -s%@OBJEXT@%$OBJEXT%g -s%@ACLOCAL@%$ACLOCAL%g -s%@AUTOCONF@%$AUTOCONF%g -s%@AUTOMAKE@%$AUTOMAKE%g -s%@AUTOHEADER@%$AUTOHEADER%g -s%@MAKEINFO@%$MAKEINFO%g -s%@AMTAR@%$AMTAR%g -s%@install_sh@%$install_sh%g -s%@INSTALL_STRIP_PROGRAM@%$INSTALL_STRIP_PROGRAM%g -s%@AWK@%$AWK%g -s%@SET_MAKE@%$SET_MAKE%g -s%@AMDEP_TRUE@%$AMDEP_TRUE%g -s%@AMDEP_FALSE@%$AMDEP_FALSE%g -s%@AMDEPBACKSLASH@%$AMDEPBACKSLASH%g -s%@DEPDIR@%$DEPDIR%g -s%@CC@%$CC%g -s%@am__include@%$am__include%g -s%@am__quote@%$am__quote%g -s%@CCDEPMODE@%$CCDEPMODE%g -s%@CPP@%$CPP%g -s%@LN_S@%$LN_S%g -s%@PERL@%$PERL%g -s%@host@%$host%g -s%@host_alias@%$host_alias%g -s%@host_cpu@%$host_cpu%g -s%@host_vendor@%$host_vendor%g -s%@host_os@%$host_os%g -s%@LIBOBJS@%$LIBOBJS%g -s%@ALLOCA@%$ALLOCA%g -s%@RANLIB@%$RANLIB%g -s%@GLIBC21@%$GLIBC21%g -s%@LIBICONV@%$LIBICONV%g -s%@USE_NLS@%$USE_NLS%g -s%@MSGFMT@%$MSGFMT%g -s%@GMSGFMT@%$GMSGFMT%g -s%@XGETTEXT@%$XGETTEXT%g -s%@INTLBISON@%$INTLBISON%g -s%@BUILD_INCLUDED_LIBINTL@%$BUILD_INCLUDED_LIBINTL%g -s%@USE_INCLUDED_LIBINTL@%$USE_INCLUDED_LIBINTL%g -s%@CATALOGS@%$CATALOGS%g -s%@CATOBJEXT@%$CATOBJEXT%g -s%@GMOFILES@%$GMOFILES%g -s%@INTLLIBS@%$INTLLIBS%g -s%@INTLOBJS@%$INTLOBJS%g -s%@POFILES@%$POFILES%g -s%@POSUB@%$POSUB%g -s%@DATADIRNAME@%$DATADIRNAME%g -s%@INSTOBJEXT@%$INSTOBJEXT%g -s%@GENCAT@%$GENCAT%g -s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g -s%@INTL_LIBTOOL_SUFFIX_PREFIX@%$INTL_LIBTOOL_SUFFIX_PREFIX%g -s%@LINUX_IF_TUN_H@%$LINUX_IF_TUN_H%g -s%@HAVE_TUNTAP@%$HAVE_TUNTAP%g -s%@INCLUDES@%$INCLUDES%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } fi -EOF -cat >> $CONFIG_STATUS <&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. -CONFIG_FILES=\${CONFIG_FILES-"Makefile -src/Makefile -doc/Makefile -doc/es/Makefile -intl/Makefile -lib/Makefile -m4/Makefile -po/Makefile.in -"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; esac - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' else - ac_dir_suffix= ac_dots= + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS section. +# + +# Capture the value of obsolete ALL_LINGUAS because we need it to compute + # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it + # from automake. + eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" + +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "lib/Makefile" ) CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; + "po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; + "m4/Makefile" ) CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;; + "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; + "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@CYGPATH_W@,$CYGPATH_W,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@AMTAR@,$AMTAR,;t t +s,@install_sh@,$install_sh,;t t +s,@STRIP@,$STRIP,;t t +s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t +s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t +s,@mkdir_p@,$mkdir_p,;t t +s,@AWK@,$AWK,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@am__leading_dot@,$am__leading_dot,;t t +s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t +s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t +s,@MAINT@,$MAINT,;t t +s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t +s,@USE_NLS@,$USE_NLS,;t t +s,@MSGFMT@,$MSGFMT,;t t +s,@GMSGFMT@,$GMSGFMT,;t t +s,@XGETTEXT@,$XGETTEXT,;t t +s,@MSGMERGE@,$MSGMERGE,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@DEPDIR@,$DEPDIR,;t t +s,@am__include@,$am__include,;t t +s,@am__quote@,$am__quote,;t t +s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t +s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t +s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t +s,@CCDEPMODE@,$CCDEPMODE,;t t +s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t +s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@LIBICONV@,$LIBICONV,;t t +s,@LTLIBICONV@,$LTLIBICONV,;t t +s,@INTLLIBS@,$INTLLIBS,;t t +s,@LIBINTL@,$LIBINTL,;t t +s,@LTLIBINTL@,$LTLIBINTL,;t t +s,@POSUB@,$POSUB,;t t +s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t +s,@LN_S@,$LN_S,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@ALLOCA@,$ALLOCA,;t t +s,@LINUX_IF_TUN_H@,$LINUX_IF_TUN_H,;t t +s,@HAVE_TUNTAP@,$HAVE_TUNTAP,;t t +s,@INCLUDES@,$INCLUDES,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out fi - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; - esac - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* +# +# CONFIG_HEADER section. +# # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' -ac_dC='\3' -ac_dD='%g' -# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". -ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='\([ ]\)%\1#\2define\3' +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' ac_uC=' ' -ac_uD='\4%g' -# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_eB='$%\1#\2define\3' -ac_eC=' ' -ac_eD='%g' +ac_uD=',;t' -if test "${CONFIG_HEADERS+set}" != set; then -EOF -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -fi -for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; esac - echo creating $ac_file + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} - rm -f conftest.frag conftest.in conftest.out - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - cat $ac_file_inputs > conftest.in + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + # Do quote $f, to prevent DOS paths from being IFS'd. + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in -EOF +_ACEOF -# Transform confdefs.h into a sed script conftest.vals that substitutes -# the proper values into config.h.in to produce config.h. And first: -# Protect against being on the right side of a sed subst in config.status. -# Protect against being in an unquoted here document in config.status. -rm -f conftest.vals -cat > conftest.hdr <<\EOF -s/[\\&%]/\\&/g -s%[\\$`]%\\&%g -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp -s%ac_d%ac_u%gp -s%ac_u%ac_e%gp -EOF -sed -n -f conftest.hdr confdefs.h > conftest.vals -rm -f conftest.hdr +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. -cat >> conftest.vals <<\EOF -s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% -EOF - -# Break up conftest.vals because some shells have a limit on -# the size of here documents, and old seds have small limits too. +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS rm -f conftest.tail -while : +while grep . conftest.defines >/dev/null do - ac_lines=`grep -c . conftest.vals` - # grep -c gives empty output for an empty file on some AIX systems. - if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi - # Write a limited-size here document to conftest.frag. - echo ' cat > conftest.frag <> $CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF - sed -f conftest.frag conftest.in > conftest.out - rm -f conftest.in - mv conftest.out conftest.in -' >> $CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail - rm -f conftest.vals - mv conftest.tail conftest.vals + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines done -rm -f conftest.vals +rm -f conftest.defines +echo ' fi # grep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS -cat >> $CONFIG_STATUS <<\EOF - rm -f conftest.frag conftest.h - echo "/* $ac_file. Generated automatically by configure. */" > conftest.h - cat conftest.in >> conftest.h - rm -f conftest.in - if cmp -s $ac_file conftest.h 2>/dev/null; then - echo "$ac_file is unchanged" - rm -f conftest.h +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\_ACEOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated by configure. */" >$tmp/config.h else - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - fi - rm -f $ac_file - mv conftest.h $ac_file + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi -fi; done + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if diff $ac_file $tmp/config.h >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } -EOF -cat >> $CONFIG_STATUS < "\$am_dir"stamp-h\$am_indx - ;; + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +# Compute $ac_file's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $ac_file | $ac_file:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac - am_indx=\`expr \$am_indx + 1\` done -AMDEP_TRUE="$AMDEP_TRUE" -ac_aux_dir="$ac_aux_dir" +echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || +$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X$ac_file : 'X\(//\)[^/]' \| \ + X$ac_file : 'X\(//\)$' \| \ + X$ac_file : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X$ac_file | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'`/stamp-h$_am_stamp_count +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac -EOF -cat >> $CONFIG_STATUS <<\EOF -test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h - -test x"$AMDEP_TRUE" != x"" || -for mf in $CONFIG_FILES; do - case "$mf" in - Makefile) dirpart=.;; - */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;; - *) continue;; - esac + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + default-1 ) + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + POMAKEFILEDEPS="POTFILES.in" + # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend + # on $ac_dir but don't depend on user-specified configuration + # parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$OBSOLETE_ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assigment from automake. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" + else + # The set of available languages was given in configure.in. + eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' + fi + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + POFILES= + GMOFILES= + UPDATEPOFILES= + DUMMYPOFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do + if test -f "$f"; then + case "$f" in + *.orig | *.bak | *~) ;; + *) cat "$f" >> "$ac_dir/Makefile" ;; + esac + fi + done + fi + ;; + esac + done ;; + depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`(dirname "$mf") 2>/dev/null || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + else + continue + fi grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. - DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n -e '/^U = / s///p' < "$mf"` + U=`sed -n 's/^U = //p' < "$mf"` test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" # We invoke sed twice because it is the simplest approach to # changing $(DEPDIR) to its actual value in the expansion. - for file in `sed -n -e ' + for file in `sed -n ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop @@ -5195,46 +12645,78 @@ for mf in $CONFIG_FILES; do sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue - fdir=`echo "$file" | sed -e 's|/[^/]*$||'` - $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1 + fdir=`(dirname "$file") 2>/dev/null || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p $dirpart/$fdir + else + as_dir=$dirpart/$fdir + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 +echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} + { (exit 1); exit 1; }; }; } + # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done + ;; + esac +done +_ACEOF -for ac_file in $CONFIG_FILES; do - # Support "outfile[:infile[:infile...]]" - case "$ac_file" in - *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - esac - # PO directories have a Makefile.in generated from Makefile.in.in. - case "$ac_file" in */Makefile.in) - # Adjust a relative srcdir. - ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` - ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" - ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` - # In autoconf-2.13 it is called $ac_given_srcdir. - # In autoconf-2.50 it is called $srcdir. - test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" - case "$ac_given_srcdir" in - .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; - /*) top_srcdir="$ac_given_srcdir" ;; - *) top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then - rm -f "$ac_dir/POTFILES" - test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" - sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES" - test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" - sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" - fi - ;; - esac - done +cat >>$CONFIG_STATUS <<\_ACEOF -exit 0 -EOF +{ (exit 0); exit 0; } +_ACEOF chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi diff --git a/configure.in b/configure.in index 6114a08..e639862 100644 --- a/configure.in +++ b/configure.in @@ -1,18 +1,25 @@ dnl Process this file with autoconf to produce a configure script. -dnl $Id: configure.in,v 1.13.2.43.2.1 2002/04/09 11:51:16 guus Exp $ +dnl $Id: configure.in 1415 2004-11-10 23:20:59Z guus $ -AC_INIT(src/tincd.c) -AM_INIT_AUTOMAKE(tinc, 1.0pre7) -AM_CONFIG_HEADER(config.h) +AC_PREREQ(2.59) +AC_INIT +AC_CONFIG_SRCDIR([src/tincd.c]) +AM_INIT_AUTOMAKE(tinc, 1.0.3) +AC_CONFIG_HEADERS([config.h]) +AM_MAINTAINER_MODE dnl Include the macros from the m4/ directory AM_ACLOCAL_INCLUDE(m4) +AM_GNU_GETTEXT([external]) +AM_GNU_GETTEXT_VERSION(0.12.1) + # Enable GNU extensions. # Define this here, not in acconfig's @TOP@ section, since definitions # in the latter don't make it into the configure-time tests. -AC_DEFINE([_GNU_SOURCE], [__USE_BSD]) +AC_DEFINE([_GNU_SOURCE], 1, [Enable GNU extenstions]) +AC_DEFINE([__USE_BSD], 1, [Enable BSD extensions]) ALL_LINGUAS="nl" @@ -24,66 +31,108 @@ AC_PROG_AWK AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET -jm_PERL - +AC_PROG_RANLIB AC_ISC_POSIX dnl Check and set OS -AC_CANONICAL_HOST +#AC_CANONICAL_HOST case $host_os in *linux*) - AC_DEFINE(HAVE_LINUX) + AC_DEFINE(HAVE_LINUX, 1, [Linux]) [ rm -f src/device.c; ln -sf linux/device.c src/device.c ] ;; *freebsd*) - AC_DEFINE(HAVE_FREEBSD) - [ rm -f src/device.c; ln -sf freebsd/device.c src/device.c ] + AC_DEFINE(HAVE_FREEBSD, 1, [FreeBSD]) + [ rm -f src/device.c; ln -sf bsd/device.c src/device.c ] + ;; + *darwin*) + AC_DEFINE(HAVE_DARWIN, 1, [Darwin (MacOS/X)]) + [ rm -f src/device.c; ln -sf bsd/device.c src/device.c ] ;; *solaris*) - AC_DEFINE(HAVE_SOLARIS) + AC_DEFINE(HAVE_SOLARIS, 1, [Solaris/SunOS]) [ rm -f src/device.c; ln -sf solaris/device.c src/device.c ] ;; *openbsd*) - AC_DEFINE(HAVE_OPENBSD) - [ rm -f src/device.c; ln -sf openbsd/device.c src/device.c ] + AC_DEFINE(HAVE_OPENBSD, 1, [OpenBSD]) + [ rm -f src/device.c; ln -sf bsd/device.c src/device.c ] ;; *netbsd*) - AC_DEFINE(HAVE_NETBSD) - [ rm -f src/device.c; ln -sf netbsd/device.c src/device.c ] + AC_DEFINE(HAVE_NETBSD, 1, [NetBSD]) + [ rm -f src/device.c; ln -sf bsd/device.c src/device.c ] + ;; + *bsd*) + AC_MSG_WARN("Unknown BSD variant, tinc might not compile or work!") + AC_DEFINE(HAVE_BSD, 1, [Unknown BSD variant]) + [ rm -f src/device.c; ln -sf bsd/device.c src/device.c ] + ;; + *cygwin*) + AC_DEFINE(HAVE_CYGWIN, 1, [Cygwin]) + [ rm -f src/device.c; ln -sf cygwin/device.c src/device.c ] + ;; + *mingw*) + AC_DEFINE(HAVE_MINGW, 1, [MinGW]) + [ rm -f src/device.c; cp -f src/mingw/device.c src/device.c ] + LIBS="$LIBS -lws2_32" + ;; + *) + AC_MSG_ERROR("Unknown operating system.") ;; esac AC_CACHE_SAVE +if test -d /sw/include ; then + CPPFLAGS="$CPPFLAGS -I/sw/include" +fi +if test -d /sw/lib ; then + LIBS="$LIBS -L/sw/lib" +fi + dnl Checks for libraries. dnl Checks for header files. +dnl We do this in multiple stages, because unlike Linux all the other operating systems really suck and don't include their own dependencies. + AC_HEADER_STDC -AC_CHECK_HEADERS([fcntl.h limits.h sys/ioctl.h syslog.h unistd.h \ -sys/time.h malloc.h strings.h sys/file.h]) +AC_CHECK_HEADERS([stdbool.h syslog.h sys/file.h sys/ioctl.h sys/mman.h sys/param.h sys/socket.h sys/time.h sys/uio.h sys/wait.h netdb.h arpa/inet.h]) +AC_CHECK_HEADERS([net/if.h net/if_types.h net/if_tun.h net/if_tap.h net/ethernet.h net/if_arp.h netinet/in_systm.h netinet/in.h netinet/in6.h], + [], [], [#include "have.h"] +) +AC_CHECK_HEADERS([netinet/if_ether.h netinet/ip.h netinet/ip6.h], + [], [], [#include "have.h"] +) +AC_CHECK_HEADERS([netinet/tcp.h netinet/ip_icmp.h netinet/icmp6.h], + [], [], [#include "have.h"] +) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST +AC_C_VOLATILE AC_TYPE_PID_T AC_TYPE_SIZE_T AC_HEADER_TIME AC_STRUCT_TM +tinc_ATTRIBUTE(__malloc__) + +AC_CHECK_TYPES([socklen_t, struct ether_header, struct arphdr, struct ether_arp, struct in_addr, struct addrinfo, struct ip, struct icmp, struct in6_addr, struct sockaddr_in6, struct ip6_hdr, struct icmp6_hdr, struct nd_neighbor_solicit, struct nd_opt_hdr], , , + [#include "have.h"] +) + dnl Checks for library functions. AC_FUNC_MEMCMP AC_FUNC_ALLOCA AC_TYPE_SIGNAL -AC_CHECK_FUNCS([ftime socket select strtol strerror flock unsetenv \ -asprintf putenv strdup fcloseall daemon strsignal get_current_dir_name]) +AC_CHECK_FUNCS([asprintf daemon fchmod flock ftime fork get_current_dir_name gettimeofday mlockall putenv random select strdup strerror strsignal strtol system unsetenv vsyslog writev], + [], [], [#include "have.h"] +) jm_FUNC_MALLOC jm_FUNC_REALLOC -AM_GNU_GETTEXT - - dnl Support for SunOS AC_CHECK_FUNC(socket, [], [ @@ -93,33 +142,38 @@ AC_CHECK_FUNC(gethostbyname, [], [ AC_CHECK_LIB(nsl, gethostbyname) ]) +AC_CHECK_FUNCS([freeaddrinfo gai_strerror getaddrinfo getnameinfo inet_aton], + [], [], [#include "have.h"] +) + AC_CACHE_SAVE dnl These are defined in files in m4/ -tinc_TUNTAP + +case $host_os in + *linux*) + tinc_TUNTAP + ;; +esac + tinc_OPENSSL tinc_ZLIB +tinc_LZO dnl Check if support for jumbograms is requested AC_ARG_ENABLE(jumbograms, - [ --enable-jumbograms enable support for jumbograms (packets up to 9000 bytes)], - [ AC_DEFINE(ENABLE_JUMBOGRAMS) ] + AS_HELP_STRING([--enable-jumbograms], [enable support for jumbograms (packets up to 9000 bytes)]), + [ AC_DEFINE(ENABLE_JUMBOGRAMS, 1, [Support for jumbograms (packets up to 9000 bytes)]) ] ) dnl Check if checkpoint tracing has to be enabled AC_ARG_ENABLE(tracing, - [ --enable-tracing enable checkpoint tracing (debugging only)], - [ AC_DEFINE(ENABLE_TRACING) ] + AS_HELP_STRING([--enable-tracing], [enable checkpoint tracing (debugging only)]), + [ AC_DEFINE(ENABLE_TRACING, 1, [Checkpoint tracing]) ] ) AC_SUBST(INCLUDES) -AC_OUTPUT(Makefile -src/Makefile -doc/Makefile -doc/es/Makefile -intl/Makefile -lib/Makefile -m4/Makefile -po/Makefile.in -) +AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile lib/Makefile po/Makefile.in m4/Makefile]) + +AC_OUTPUT diff --git a/depcomp b/depcomp index 6589965..25bdb18 100755 --- a/depcomp +++ b/depcomp @@ -1,7 +1,9 @@ #! /bin/sh - # depcomp - compile a program generating dependencies as side-effects -# Copyright 1999, 2000 Free Software Foundation, Inc. + +scriptversion=2004-04-25.13 + +# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -25,13 +27,52 @@ # Originally written by Alexandre Oliva . +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit 0 + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit 0 + ;; +esac + if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # `libtool' can also be set to `yes' or `no'. -depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`} +if test -z "$depfile"; then + base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` + dir=`echo "$object" | sed 's,/.*$,/,'` + if test "$dir" = "$object"; then + dir= + fi + # FIXME: should be _deps on DOS. + depfile="$dir.deps/$base" +fi + tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" @@ -163,19 +204,25 @@ sgi) aix) # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. This file always lives in the current directory. - # Also, the AIX compiler puts `$object:' at the start of each line; - # $object doesn't have directory information. - stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" - outname="$stripped.o" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi - stat=$? + + if test -f "$tmpdepfile"; then : + else + stripped=`echo "$stripped" | sed 's,^.*/,,'` + tmpdepfile="$stripped.u" + fi + if test $stat -eq 0; then : else rm -f "$tmpdepfile" @@ -183,6 +230,7 @@ aix) fi if test -f "$tmpdepfile"; then + outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. @@ -197,37 +245,86 @@ aix) rm -f "$tmpdepfile" ;; +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + tru64) - # The Tru64 AIX compiler uses -MD to generate dependencies as a side + # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - tmpdepfile1="$object.d" - tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'` if test "$libtool" = yes; then + # Dependencies are output in .lo.d with libtool 1.4. + # They are output in .o.d with libtool 1.5. + tmpdepfile1="$dir.libs/$base.lo.d" + tmpdepfile2="$dir.libs/$base.o.d" + tmpdepfile3="$dir.libs/$base.d" "$@" -Wc,-MD else + tmpdepfile1="$dir$base.o.d" + tmpdepfile2="$dir$base.d" + tmpdepfile3="$dir$base.d" "$@" -MD fi stat=$? if test $stat -eq 0; then : else - rm -f "$tmpdepfile1" "$tmpdepfile2" + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi if test -f "$tmpdepfile1"; then tmpdepfile="$tmpdepfile1" - else + elif test -f "$tmpdepfile2"; then tmpdepfile="$tmpdepfile2" + else + tmpdepfile="$tmpdepfile3" fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a space and a tab in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi @@ -240,34 +337,42 @@ tru64) dashmstdout) # Important note: in order to support this mode, a compiler *must* - # always write the proprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - test -z "$dashmflag" && dashmflag=-M - ( IFS=" " - case " $* " in - *" --mode=compile "*) # this is libtool, let us make it quiet - for arg - do # cycle over the arguments - case "$arg" in - "--mode=compile") - # insert --quiet before "--mode=compile" - set fnord "$@" --quiet - shift # fnord - ;; - esac - set fnord "$@" "$arg" - shift # fnord - shift # "$arg" - done + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg ;; esac - "$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' @@ -285,36 +390,40 @@ dashXmstdout) ;; makedepend) - # X makedepend - ( - shift - cleared=no - for arg in "$@"; do - case $cleared in no) - set ""; shift - cleared=yes - esac - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift;; - -*) - ;; - *) - set fnord "$@" "$arg"; shift;; - esac + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift done - obj_suffix="`echo $object | sed 's/^.*\././'`" - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" - tail +3 "$tmpdepfile" | tr ' ' ' + sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. @@ -324,35 +433,39 @@ makedepend) cpp) # Important note: in order to support this mode, a compiler *must* - # always write the proprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - ( IFS=" " - case " $* " in - *" --mode=compile "*) - for arg - do # cycle over the arguments - case $arg in - "--mode=compile") - # insert --quiet before "--mode=compile" - set fnord "$@" --quiet - shift # fnord - ;; - esac - set fnord "$@" "$arg" - shift # fnord - shift # "$arg" - done + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg ;; esac - "$@" -E | + done + + "$@" -E | sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" @@ -362,34 +475,27 @@ cpp) msvisualcpp) # Important note: in order to support this mode, a compiler *must* - # always write the proprocessed file to stdout, regardless of -o, + # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. - ( IFS=" " - case " $* " in - *" --mode=compile "*) - for arg - do # cycle over the arguments - case $arg in - "--mode=compile") - # insert --quiet before "--mode=compile" - set fnord "$@" --quiet - shift # fnord - ;; - esac + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) set fnord "$@" "$arg" - shift # fnord - shift # "$arg" - done - ;; + shift + shift + ;; esac - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" @@ -409,3 +515,12 @@ none) esac exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/doc/GNUmakefile b/doc/GNUmakefile deleted file mode 100644 index 8fb7a6b..0000000 --- a/doc/GNUmakefile +++ /dev/null @@ -1,23 +0,0 @@ -# Having a separate GNUmakefile lets me use features of GNU make -# to generate the man pages. -# This makefile is used only if you run GNU Make. -# It is necessary if you want to build targets usually of interest -# only to the maintainer. - -have-Makefile := $(shell test -f Makefile && echo yes) - -# If the user runs GNU make but has not yet run ./configure, -# give them a diagnostic. -ifeq ($(have-Makefile),yes) - -include Makefile -include $(srcdir)/Makefile.maint - -else - -all: - @echo There seems to be no Makefile in this directory. - @echo "You must run ./configure before running \`make'." - @exit 1 - -endif diff --git a/doc/Makefile.am b/doc/Makefile.am index b62feb7..7985251 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,20 +1,12 @@ ## Process this file with automake to get Makefile.in -SUBDIRS = es - info_TEXINFOS = tinc.texi -dyn_MANS = -man_aux = $(dyn_MANS:.8=.x) +man_MANS = tincd.8 tinc.conf.5 -man_MANS = tincd.8 tinc.conf.5 $(dyn_MANS) +EXTRA_DIST = tincinclude.texi.in tincd.8.in tinc.conf.5.in sample-config.tar.gz -PERL = @PERL@ -HELP2MAN = help2man -MAINTAINERCLEANFILES = $(dyn_MANS) - -EXTRA_DIST = $(man_MANS) $(HELP2MAN) $(man_aux) \ - Makefile.maint GNUmakefile Makefile.summ sample-config.tar.gz +CLEANFILES = *.html tinc.info tincd.8 tinc.conf.5 tincinclude.texi # Use `ginstall' in the definition of man_MANS to avoid # confusion with the `install' target. The install rule transforms `ginstall' @@ -23,3 +15,29 @@ transform = s/ginstall/install/; @program_transform_name@ # For additional rules usually of interest only to the maintainer, # see GNUmakefile and Makefile.maint. + +sample-config.tar.gz: sample-config + GZIP=$(GZIP_ENV) $(AMTAR) chozf sample-config.tar.gz --exclude .svn sample-config + +texi2html: tinc.texi + texi2html -split=chapter tinc.texi + +%.html: $(man_MANS) + w3mman2html $< > $@ + +substitute = sed \ + -e s,'@PACKAGE\@',"$(PACKAGE)",g \ + -e s,'@VERSION\@',"$(VERSION)",g \ + -e s,'@sysconfdir\@',"$(sysconfdir)",g \ + -e s,'@localstatedir\@',"$(localstatedir)",g + +tincd.8: tincd.8.in + $(substitute) tincd.8.in > tincd.8 + +tinc.conf.5: tinc.conf.5.in + $(substitute) tinc.conf.5.in > tinc.conf.5 + +tincinclude.texi: tincinclude.texi.in + $(substitute) tincinclude.texi.in > tincinclude.texi + +tinc.texi: tincinclude.texi diff --git a/doc/Makefile.in b/doc/Makefile.in index 28ae503..ea2c80d 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,7 +1,8 @@ -# Makefile.in generated automatically by automake 1.5 from Makefile.am. +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -12,41 +13,18 @@ # PARTICULAR PURPOSE. @SET_MAKE@ - -SHELL = @SHELL@ - srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) NORMAL_INSTALL = : PRE_INSTALL = : @@ -54,170 +32,282 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -host_alias = @host_alias@ host_triplet = @host@ -AMTAR = @AMTAR@ -AWK = @AWK@ -BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CPP = @CPP@ -DATADIRNAME = @DATADIRNAME@ -DEPDIR = @DEPDIR@ -EXEEXT = @EXEEXT@ -GENCAT = @GENCAT@ -GLIBC21 = @GLIBC21@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -HAVE_TUNTAP = @HAVE_TUNTAP@ -INCLUDES = @INCLUDES@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLBISON = @INTLBISON@ -INTLLIBS = @INTLLIBS@ -INTLOBJS = @INTLOBJS@ -INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ -LIBICONV = @LIBICONV@ -LINUX_IF_TUN_H = @LINUX_IF_TUN_H@ -LN_S = @LN_S@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -RANLIB = @RANLIB@ -USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ -USE_NLS = @USE_NLS@ -VERSION = @VERSION@ -am__include = @am__include@ -am__quote = @am__quote@ -install_sh = @install_sh@ +subdir = doc +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in texinfo.tex +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \ + $(top_srcdir)/m4/attribute.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/lzo.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/openssl.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/tuntap.m4 \ + $(top_srcdir)/m4/zlib.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +INFO_DEPS = tinc.info +am__TEXINFO_TEX_DIR = $(srcdir) +DVIS = tinc.dvi +PDFS = tinc.pdf +PSS = tinc.ps +HTMLS = tinc.html +TEXINFOS = tinc.texi +TEXI2DVI = texi2dvi +TEXI2PDF = $(TEXI2DVI) --pdf --batch +MAKEINFOHTML = $(MAKEINFO) --html +AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS) +DVIPS = dvips +am__installdirs = "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)" +man5dir = $(mandir)/man5 +man8dir = $(mandir)/man8 +NROFF = nroff +MANS = $(man_MANS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) # Use `ginstall' in the definition of man_MANS to avoid # confusion with the `install' target. The install rule transforms `ginstall' # to install before applying any user-specified name transformations. transform = s/ginstall/install/; @program_transform_name@ - -PERL = @PERL@ - -SUBDIRS = es - +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GMSGFMT = @GMSGFMT@ +HAVE_TUNTAP = @HAVE_TUNTAP@ +INCLUDES = @INCLUDES@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LINUX_IF_TUN_H = @LINUX_IF_TUN_H@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ info_TEXINFOS = tinc.texi +man_MANS = tincd.8 tinc.conf.5 +EXTRA_DIST = tincinclude.texi.in tincd.8.in tinc.conf.5.in sample-config.tar.gz +CLEANFILES = *.html tinc.info tincd.8 tinc.conf.5 tincinclude.texi +substitute = sed \ + -e s,'@PACKAGE\@',"$(PACKAGE)",g \ + -e s,'@VERSION\@',"$(VERSION)",g \ + -e s,'@sysconfdir\@',"$(sysconfdir)",g \ + -e s,'@localstatedir\@',"$(localstatedir)",g -dyn_MANS = -man_aux = $(dyn_MANS:.8=.x) - -man_MANS = tincd.8 tinc.conf.5 $(dyn_MANS) -HELP2MAN = help2man -MAINTAINERCLEANFILES = $(dyn_MANS) - -EXTRA_DIST = $(man_MANS) $(HELP2MAN) $(man_aux) \ - Makefile.maint GNUmakefile Makefile.summ sample-config.tar.gz - -subdir = doc -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = -INFO_DEPS = tinc.info -DVIS = tinc.dvi -TEXINFOS = tinc.texi - -NROFF = nroff -MANS = $(man_MANS) - -RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ - uninstall-info-recursive all-recursive install-data-recursive \ - install-exec-recursive installdirs-recursive install-recursive \ - uninstall-recursive check-recursive installcheck-recursive -DIST_COMMON = Makefile.am Makefile.in texinfo.tex -DIST_SUBDIRS = $(SUBDIRS) -all: all-recursive +all: all-am .SUFFIXES: -.SUFFIXES: .dvi .info .ps .texi -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +.SUFFIXES: .dvi .ps +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && \ - CONFIG_HEADERS= CONFIG_LINKS= \ - CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; -tinc.info: tinc.texi -tinc.dvi: tinc.texi +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -.texi.info: - @cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9] - cd $(srcdir) \ - && $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) \ - `echo $< | sed 's,.*/,,'` +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -.texi.dvi: - TEXINPUTS=$(srcdir):$$TEXINPUTS \ +tinc.info: tinc.texi + restore=: && \ + backupdir="$(am__leading_dot)am$$$$" && \ + rm -rf $$backupdir && mkdir $$backupdir && \ + for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ + if test -f $$f; then \ + mv $$f $$backupdir; \ + restore=mv; \ + fi; \ + done; \ + if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ + -o $@ `test -f 'tinc.texi' || echo '$(srcdir)/'`tinc.texi; \ + then \ + rc=0; \ + else \ + rc=$$?; \ + $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ + fi; \ + rm -rf $$backupdir; \ + exit $$rc + +tinc.dvi: tinc.texi + TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ - $(TEXI2DVI) $< + $(TEXI2DVI) -o $@ `test -f 'tinc.texi' || echo '$(srcdir)/'`tinc.texi -.texi: - @cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9] - cd $(srcdir) \ - && $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) \ - `echo $< | sed 's,.*/,,'` +tinc.pdf: tinc.texi + TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ + $(TEXI2PDF) -o $@ `test -f 'tinc.texi' || echo '$(srcdir)/'`tinc.texi -MAKEINFO = @MAKEINFO@ -TEXI2DVI = texi2dvi -DVIPS = dvips +tinc.html: tinc.texi + $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ + -o $@ `test -f 'tinc.texi' || echo '$(srcdir)/'`tinc.texi + if test ! -d $@ && test -d $(@:.html=); then \ + mv $(@:.html=) $@; else :; fi .dvi.ps: - $(DVIPS) $< -o $@ + $(DVIPS) -o $@ $< uninstall-info-am: $(PRE_UNINSTALL) @if (install-info --version && \ - install-info --version | fgrep -i -v debian) >/dev/null 2>&1; then \ + install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ list='$(INFO_DEPS)'; \ for file in $$list; do \ - echo " install-info --info-dir=$(DESTDIR)$(infodir) --remove $(DESTDIR)$(infodir)/$$file"; \ - install-info --info-dir=$(DESTDIR)$(infodir) --remove $(DESTDIR)$(infodir)/$$file; \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \ + install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \ done; \ else :; fi @$(NORMAL_UNINSTALL) @list='$(INFO_DEPS)'; \ for file in $$list; do \ - (if cd $(DESTDIR)$(infodir); then \ - echo " rm -f $$file $$file-[0-9] $$file-[0-9][0-9])"; \ - rm -f $$file $$file-[0-9] $$file-[0-9][0-9]; \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ + (if cd "$(DESTDIR)$(infodir)"; then \ + echo " rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9])"; \ + rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ else :; fi); \ done dist-info: $(INFO_DEPS) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ list='$(INFO_DEPS)'; \ for base in $$list; do \ - d=$(srcdir); \ - for file in `CDPATH=: && cd $$d && eval echo $$base*`; do \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file; \ + case $$base in \ + $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ + if test -f $$base; then d=.; else d=$(srcdir); fi; \ + for file in $$d/$$base*; do \ + relfile=`expr "$$file" : "$$d/\(.*\)"`; \ + test -f $(distdir)/$$relfile || \ + cp -p $$file $(distdir)/$$relfile; \ done; \ done mostlyclean-aminfo: - -rm -f tinc.aux tinc.cp tinc.cps tinc.dvi tinc.fn tinc.ky tinc.log tinc.pg \ - tinc.ps tinc.toc tinc.tp tinc.vr + -rm -rf tinc.aux tinc.cp tinc.cps tinc.fn tinc.fns tinc.ky tinc.kys tinc.log \ + tinc.pg tinc.pgs tinc.tmp tinc.toc tinc.tp tinc.tps tinc.vr \ + tinc.vrs tinc.dvi tinc.pdf tinc.ps tinc.html maintainer-clean-aminfo: - cd $(srcdir) && \ - for i in $(INFO_DEPS); do \ - rm -f $$i; \ - if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \ - rm -f $$i-[0-9]*; \ - fi; \ + @list='$(INFO_DEPS)'; for i in $$list; do \ + i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \ + echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \ + rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \ done - -man5dir = $(mandir)/man5 install-man5: $(man5_MANS) $(man_MANS) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(man5dir) + test -z "$(man5dir)" || $(mkdir_p) "$(DESTDIR)$(man5dir)" @list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ @@ -229,11 +319,15 @@ install-man5: $(man5_MANS) $(man_MANS) if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 5*) ;; \ + *) ext='5' ;; \ + esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man5dir)/$$inst"; \ - $(INSTALL_DATA) $$file $(DESTDIR)$(man5dir)/$$inst; \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst"; \ done uninstall-man5: @$(NORMAL_UNINSTALL) @@ -246,17 +340,19 @@ uninstall-man5: done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 5*) ;; \ + *) ext='5' ;; \ + esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " rm -f $(DESTDIR)$(man5dir)/$$inst"; \ - rm -f $(DESTDIR)$(man5dir)/$$inst; \ + echo " rm -f '$(DESTDIR)$(man5dir)/$$inst'"; \ + rm -f "$(DESTDIR)$(man5dir)/$$inst"; \ done - -man8dir = $(mandir)/man8 install-man8: $(man8_MANS) $(man_MANS) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(man8dir) + test -z "$(man8dir)" || $(mkdir_p) "$(DESTDIR)$(man8dir)" @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ @@ -268,11 +364,15 @@ install-man8: $(man8_MANS) $(man_MANS) if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 8*) ;; \ + *) ext='8' ;; \ + esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \ - $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst"; \ done uninstall-man8: @$(NORMAL_UNINSTALL) @@ -285,186 +385,102 @@ uninstall-man8: done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 8*) ;; \ + *) ext='8' ;; \ + esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \ - rm -f $(DESTDIR)$(man8dir)/$$inst; \ + echo " rm -f '$(DESTDIR)$(man8dir)/$$inst'"; \ + rm -f "$(DESTDIR)$(man8dir)/$$inst"; \ done - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @set fnord $(MAKEFLAGS); amf=$$2; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @set fnord $(MAKEFLAGS); amf=$$2; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done - tags: TAGS +TAGS: -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique $(LISP) +ctags: CTAGS +CTAGS: -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) - -GTAGS: - here=`CDPATH=: && cd $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = .. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - $(mkinstalldirs) "$(distdir)/$$dir"; \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ fi; \ if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir) \ - || exit 1; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done - for subdir in $(SUBDIRS); do \ - if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" \ - distdir=../$(distdir)/$$subdir \ - distdir) \ - || exit 1; \ - fi; \ - done $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="${top_distdir}" distdir="$(distdir)" \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-info check-am: all-am -check: check-recursive +check: check-am all-am: Makefile $(INFO_DEPS) $(MANS) -installdirs: installdirs-recursive -installdirs-am: - $(mkinstalldirs) $(DESTDIR)$(infodir) $(DESTDIR)$(man5dir) $(DESTDIR)$(man8dir) - -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive +installdirs: + for dir in "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -installcheck: installcheck-recursive +installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* + -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -clean: clean-recursive +clean: clean-am clean-am: clean-generic mostlyclean-am -distclean: distclean-recursive +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic -distclean-am: clean-am distclean-generic distclean-tags - -dvi: dvi-recursive +dvi: dvi-am dvi-am: $(DVIS) -info: info-recursive +html: html-am + +html-am: $(HTMLS) + +info: info-am info-am: $(INFO_DEPS) @@ -472,68 +488,97 @@ install-data-am: install-info-am install-man install-exec-am: -install-info: install-info-recursive +install-info: install-info-am install-info-am: $(INFO_DEPS) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(infodir) - @list='$(INFO_DEPS)'; \ + test -z "$(infodir)" || $(mkdir_p) "$(DESTDIR)$(infodir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + list='$(INFO_DEPS)'; \ for file in $$list; do \ - d=$(srcdir); \ - for ifile in `CDPATH=: && cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \ - if test -f $$d/$$ifile; then \ - echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; \ - $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile; \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \ + for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \ + $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \ + if test -f $$ifile; then \ + relfile=`echo "$$ifile" | sed 's|^.*/||'`; \ + echo " $(INSTALL_DATA) '$$ifile' '$(DESTDIR)$(infodir)/$$relfile'"; \ + $(INSTALL_DATA) "$$ifile" "$(DESTDIR)$(infodir)/$$relfile"; \ else : ; fi; \ done; \ done @$(POST_INSTALL) @if (install-info --version && \ - install-info --version | fgrep -i -v debian) >/dev/null 2>&1; then \ + install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ list='$(INFO_DEPS)'; \ for file in $$list; do \ - echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\ - install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\ + install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\ done; \ else : ; fi install-man: install-man5 install-man8 installcheck-am: -maintainer-clean: maintainer-clean-recursive - +maintainer-clean: maintainer-clean-am + -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-aminfo \ maintainer-clean-generic -mostlyclean: mostlyclean-recursive +mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-aminfo mostlyclean-generic -uninstall-am: uninstall-info-am uninstall-man +pdf: pdf-am -uninstall-info: uninstall-info-recursive +pdf-am: $(PDFS) + +ps: ps-am + +ps-am: $(PSS) + +uninstall-am: uninstall-info-am uninstall-man uninstall-man: uninstall-man5 uninstall-man8 -.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ - clean-generic clean-recursive dist-info distclean \ - distclean-generic distclean-recursive distclean-tags distdir \ - dvi dvi-am dvi-recursive info info-am info-recursive install \ - install-am install-data install-data-am install-data-recursive \ - install-exec install-exec-am install-exec-recursive \ - install-info install-info-am install-info-recursive install-man \ - install-man5 install-man8 install-recursive install-strip \ - installcheck installcheck-am installdirs installdirs-am \ - installdirs-recursive maintainer-clean maintainer-clean-aminfo \ - maintainer-clean-generic maintainer-clean-recursive mostlyclean \ - mostlyclean-aminfo mostlyclean-generic mostlyclean-recursive \ - tags tags-recursive uninstall uninstall-am uninstall-info-am \ - uninstall-info-recursive uninstall-man uninstall-man5 \ - uninstall-man8 uninstall-recursive +.PHONY: all all-am check check-am clean clean-generic dist-info \ + distclean distclean-generic distdir dvi dvi-am html html-am \ + info info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-man5 install-man8 install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-aminfo maintainer-clean-generic mostlyclean \ + mostlyclean-aminfo mostlyclean-generic pdf pdf-am ps ps-am \ + uninstall uninstall-am uninstall-info-am uninstall-man \ + uninstall-man5 uninstall-man8 # For additional rules usually of interest only to the maintainer, # see GNUmakefile and Makefile.maint. + +sample-config.tar.gz: sample-config + GZIP=$(GZIP_ENV) $(AMTAR) chozf sample-config.tar.gz --exclude .svn sample-config + +texi2html: tinc.texi + texi2html -split=chapter tinc.texi + +%.html: $(man_MANS) + w3mman2html $< > $@ + +tincd.8: tincd.8.in + $(substitute) tincd.8.in > tincd.8 + +tinc.conf.5: tinc.conf.5.in + $(substitute) tinc.conf.5.in > tinc.conf.5 + +tincinclude.texi: tincinclude.texi.in + $(substitute) tincinclude.texi.in > tincinclude.texi + +tinc.texi: tincinclude.texi # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/doc/Makefile.maint b/doc/Makefile.maint deleted file mode 100644 index 75804f0..0000000 --- a/doc/Makefile.maint +++ /dev/null @@ -1,38 +0,0 @@ -# This -*- Makefile -*- uses features of GNU make. -# It is included via GNUmakefile. - -# The following one line summaries were extracted from the -# original man pages using this bit of sh code: -# for i in *.1; do echo "$i: "|tr -d '\012'; \ -# grep -A1 SH.NAME $i|sed '/SH NAME/d;s/^[^ ][^ ]* .- //'; done - -include Makefile.summ - -HELP2MAN-run = $(PERL) -w -- $(srcdir)/$(HELP2MAN) - -# Depend on configure.in to get version number changes. -$(dyn_MANS): $(top_srcdir)/configure.in - -# Depend on the source file containing the --help text. -# Filter out irregular cases. -regular-men = $(filter-out $(irregular-men),$(dyn_MANS)) -$(regular-men): %.8: $(top_srcdir)/src/%.c - -executable = $(patsubst %/install,%/ginstall, ../src/$(basename $@)) -$(dyn_MANS): %.8: %.x $(HELP2MAN) - @if test -f $(executable); then \ - echo "Updating man page $@"; \ - rm -f $@-t $@; \ - $(HELP2MAN-run) \ - --name="$($(basename $@)-summary)" \ - --include=$(basename $@).x \ - $(executable) > $@-t; \ - chmod -w $@-t; \ - mv $@-t $@; \ - else \ - echo "WARNING: The man page $@ cannot be updated yet."; \ - echo " Retry once the corresponding executable is built."; \ - fi - -sample-config.tar.gz: - GZIP=$(GZIP_ENV) $(AMTAR) chozf sample-config.tar.gz sample-config diff --git a/doc/Makefile.summ b/doc/Makefile.summ deleted file mode 100644 index a97b492..0000000 --- a/doc/Makefile.summ +++ /dev/null @@ -1,2 +0,0 @@ -# -*- makefile -*- -tincd-summary = tinc VPN daemon diff --git a/doc/es/Makefile.am b/doc/es/Makefile.am deleted file mode 100644 index 756d670..0000000 --- a/doc/es/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -## Process this file with automake to get Makefile.in - -# Nothing to see here, go away! diff --git a/doc/es/Makefile.in b/doc/es/Makefile.in deleted file mode 100644 index 7261008..0000000 --- a/doc/es/Makefile.in +++ /dev/null @@ -1,218 +0,0 @@ -# Makefile.in generated automatically by automake 1.5 from Makefile.am. - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# Nothing to see here, go away! - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_HEADER = $(INSTALL_DATA) -transform = @program_transform_name@ -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_alias = @host_alias@ -host_triplet = @host@ -AMTAR = @AMTAR@ -AWK = @AWK@ -BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CPP = @CPP@ -DATADIRNAME = @DATADIRNAME@ -DEPDIR = @DEPDIR@ -EXEEXT = @EXEEXT@ -GENCAT = @GENCAT@ -GLIBC21 = @GLIBC21@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -HAVE_TUNTAP = @HAVE_TUNTAP@ -INCLUDES = @INCLUDES@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLBISON = @INTLBISON@ -INTLLIBS = @INTLLIBS@ -INTLOBJS = @INTLOBJS@ -INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ -LIBICONV = @LIBICONV@ -LINUX_IF_TUN_H = @LINUX_IF_TUN_H@ -LN_S = @LN_S@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PERL = @PERL@ -POFILES = @POFILES@ -POSUB = @POSUB@ -RANLIB = @RANLIB@ -USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ -USE_NLS = @USE_NLS@ -VERSION = @VERSION@ -am__include = @am__include@ -am__quote = @am__quote@ -install_sh = @install_sh@ -subdir = doc/es -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = -DIST_COMMON = Makefile.am Makefile.in -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu doc/es/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && \ - CONFIG_HEADERS= CONFIG_LINKS= \ - CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status -uninstall-info-am: -tags: TAGS -TAGS: - - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - $(mkinstalldirs) "$(distdir)/$$dir"; \ - fi; \ - if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir) \ - || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile - -installdirs: - -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-am - -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic - -uninstall-am: uninstall-info-am - -.PHONY: all all-am check check-am clean clean-generic distclean \ - distclean-generic distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic uninstall uninstall-am uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/doc/help2man b/doc/help2man deleted file mode 100755 index 71778a9..0000000 --- a/doc/help2man +++ /dev/null @@ -1,375 +0,0 @@ -#!/usr/bin/perl -w - -# Generate a short man page from --help and --version output. -# Copyright © 1997, 98 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Written by Brendan O'Dea - -use 5.004; -use strict; -use Getopt::Long; -use POSIX qw(strftime setlocale LC_TIME); - -my $this_program = 'help2man'; -my $this_version = '1.006'; -my $version_info = < -EOT - -my $help_info = < \$opt_name, - 'include=s' => \$include, - 'opt-include=s' => \$opt_include, - 'output=s' => \$opt_output, - 'no-info' => \$opt_no_info, - help => sub { print $help_info; exit }, - version => sub { print $version_info; exit }, -) or die $help_info; - -die $help_info unless @ARGV == 1; - -my %include = (); -my @include = (); # to retain order - -# Process include file (if given). Format is: -# -# [section name] -# verbatim text - -if ($include or $opt_include) -{ - if (open INC, $include || $opt_include) - { - my $sect; - - while () - { - if (/^\[([^]]+)\]/) - { - $sect = uc $1; - $sect =~ s/^\s+//; - $sect =~ s/\s+$//; - next; - } - - # Silently ignore anything before the first - # section--allows for comments and revision info. - next unless $sect; - - push @include, $sect unless $include{$sect}; - $include{$sect} ||= ''; - $include{$sect} .= $_; - } - - close INC; - - die "$this_program: no valid information found in `$include'\n" - unless %include; - - # Compress trailing blank lines. - for (keys %include) - { - $include{$_} =~ s/\n+$//; - $include{$_} .= "\n" unless /^NAME$/; - } - } - else - { - die "$this_program: can't open `$include' ($!)\n" if $include; - } -} - -# Turn off localisation of executable's ouput. -@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; - -# Turn off localisation of date (for strftime) -setlocale LC_TIME, 'C'; - -# Grab help and version paragraphs from executable -my @help = split /\n\n+/, `$ARGV[0] --help 2>/dev/null` - or die "$this_program: can't get `--help' info from $ARGV[0]\n"; - -my @version = split /\n\n+/, `$ARGV[0] --version 2>/dev/null` - or die "$this_program: can't get `--version' info from $ARGV[0]\n"; - -my $date = strftime "%B %Y", localtime; -my $program = $ARGV[0]; $program =~ s!.*/!!; -my $package = $program; -my $version; - -if ($opt_output) -{ - unlink $opt_output - or die "$this_program: can't unlink $opt_output ($!)\n" - if -e $opt_output; - - open STDOUT, ">$opt_output" - or die "$this_program: can't create $opt_output ($!)\n"; -} - -# The first line of the --version information is assumed to be in one -# of the following formats: -# -# -# -# GNU -# (GNU ) -# - GNU -# -# and seperated from any copyright/author details by a blank line. - -$_ = shift @version; - -if (/^(\S+)\s+\((GNU\s+[^)]+)\)\s+(.*)/ or - /^(\S+)\s+-\s*(GNU\s+\S+)\s+(.*)/) -{ - $program = $1; - $package = $2; - $version = $3; -} -elsif (/^(GNU\s+)?(\S+)\s+(.*)/) -{ - $program = $2; - $package = $1 ? "$1$2" : $2; - $version = $3; -} -else -{ - $version = $_; -} - -$program =~ s!.*/!!; - -# no info for `info' itself -$opt_no_info = 1 if $program eq 'info'; - -# --name overrides --include contents -$include{NAME} = "$program \\- $opt_name" if $opt_name; - -# Default (useless) NAME paragraph -$include{NAME} ||= "$program \\- manual page for $program $version"; - -# Man pages traditionally have the page title in caps. -my $PROGRAM = uc $program; - -# Header. -print < +\let\ptexhat=^ \let\ptexi=\i +\let\ptexindent=\indent +\let\ptexnoindent=\noindent +\let\ptexinsert=\insert \let\ptexlbrace=\{ +\let\ptexless=< +\let\ptexplus=+ \let\ptexrbrace=\} +\let\ptexslash=\/ \let\ptexstar=\* \let\ptext=\t -% We never want plain's outer \+ definition in Texinfo. -% For @tex, we can use \tabalign. -\let\+ = \relax - - -\message{Basics,} -\chardef\other=12 - % If this character appears in an error message or help string, it % starts a new line in the output. \newlinechar = `^^J +% Use TeX 3.0's \inputlineno to get the line number, for better error +% messages, but if we're using an old version of TeX, don't do anything. +% +\ifx\inputlineno\thisisundefined + \let\linenumber = \empty % Pre-3.0. +\else + \def\linenumber{l.\the\inputlineno:\space} +\fi + % Set up fixed words for English if not already set. -\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi -\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi -\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi -\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi -\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi -\ifx\putwordon\undefined \gdef\putwordon{on}\fi -\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi -\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi -\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi -\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi -\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi -\ifx\putwordShortContents\undefined \gdef\putwordShortContents{Short Contents}\fi -\ifx\putwordTableofContents\undefined\gdef\putwordTableofContents{Table of Contents}\fi +\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi +\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi +\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi +\ifx\putwordin\undefined \gdef\putwordin{in}\fi +\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi +\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi +\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi +\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi +\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi +\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi +\ifx\putwordof\undefined \gdef\putwordof{of}\fi +\ifx\putwordon\undefined \gdef\putwordon{on}\fi +\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi +\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi +\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi +\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi +\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi +\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi +\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi +% +\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi +\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi +\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi +\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi +\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi +\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi +\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi +\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi +\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi +\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi +\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi +\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi +% +\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi +\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi +\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi +\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi +\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi + +% In some macros, we cannot use the `\? notation---the left quote is +% in some cases the escape char. +\chardef\colonChar = `\: +\chardef\commaChar = `\, +\chardef\dotChar = `\. +\chardef\exclamChar= `\! +\chardef\questChar = `\? +\chardef\semiChar = `\; +\chardef\underChar = `\_ + +\chardef\spaceChar = `\ % +\chardef\spacecat = 10 +\def\spaceisspace{\catcode\spaceChar=\spacecat} % Ignore a token. % \def\gobble#1{} -\hyphenation{ap-pen-dix} -\hyphenation{mini-buf-fer mini-buf-fers} -\hyphenation{eshell} -\hyphenation{white-space} +% The following is used inside several \edef's. +\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} + +% Hyphenation fixes. +\hyphenation{ + Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script + ap-pen-dix bit-map bit-maps + data-base data-bases eshell fall-ing half-way long-est man-u-script + man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm + par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces + spell-ing spell-ings + stand-alone strong-est time-stamp time-stamps which-ever white-space + wide-spread wrap-around +} % Margin to add to right of even pages, to left of odd pages. -\newdimen \bindingoffset -\newdimen \normaloffset +\newdimen\bindingoffset +\newdimen\normaloffset \newdimen\pagewidth \newdimen\pageheight +% For a final copy, take out the rectangles +% that mark overfull boxes (in case you have decided +% that the text looks ok even though it passes the margin). +% +\def\finalout{\overfullrule=0pt} + +% @| inserts a changebar to the left of the current line. It should +% surround any changed text. This approach does *not* work if the +% change spans more than two lines of output. To handle that, we would +% have adopt a much more difficult approach (putting marks into the main +% vertical list for the beginning and end of each change). +% +\def\|{% + % \vadjust can only be used in horizontal mode. + \leavevmode + % + % Append this vertical mode material after the current line in the output. + \vadjust{% + % We want to insert a rule with the height and depth of the current + % leading; that is exactly what \strutbox is supposed to record. + \vskip-\baselineskip + % + % \vadjust-items are inserted at the left edge of the type. So + % the \llap here moves out into the left-hand margin. + \llap{% + % + % For a thicker or thinner bar, change the `1pt'. + \vrule height\baselineskip width1pt + % + % This is the space between the bar and the text. + \hskip 12pt + }% + }% +} + % Sometimes it is convenient to have everything in the transcript file % and nothing on the terminal. We don't just call \tracingall here, -% since that produces some useless output on the terminal. +% since that produces some useless output on the terminal. We also make +% some effort to order the tracing commands to reduce output in the log +% file; cf. trace.sty in LaTeX. % \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% -\ifx\eTeXversion\undefined -\def\loggingall{\tracingcommands2 \tracingstats2 - \tracingpages1 \tracingoutput1 \tracinglostchars1 - \tracingmacros2 \tracingparagraphs1 \tracingrestores1 - \showboxbreadth\maxdimen\showboxdepth\maxdimen +\def\loggingall{% + \tracingstats2 + \tracingpages1 + \tracinglostchars2 % 2 gives us more in etex + \tracingparagraphs1 + \tracingoutput1 + \tracingmacros2 + \tracingrestores1 + \showboxbreadth\maxdimen \showboxdepth\maxdimen + \ifx\eTeXversion\undefined\else % etex gives us more logging + \tracingscantokens1 + \tracingifs1 + \tracinggroups1 + \tracingnesting2 + \tracingassigns1 + \fi + \tracingcommands3 % 3 gives us more in etex + \errorcontextlines16 }% -\else -\def\loggingall{\tracingcommands3 \tracingstats2 - \tracingpages1 \tracingoutput1 \tracinglostchars1 - \tracingmacros2 \tracingparagraphs1 \tracingrestores1 - \tracingscantokens1 \tracingassigns1 \tracingifs1 - \tracinggroups1 \tracingnesting2 - \showboxbreadth\maxdimen\showboxdepth\maxdimen -}% -\fi + +% add check for \lastpenalty to plain's definitions. If the last thing +% we did was a \nobreak, we don't want to insert more space. +% +\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount + \removelastskip\penalty-50\smallskip\fi\fi} +\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount + \removelastskip\penalty-100\medskip\fi\fi} +\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount + \removelastskip\penalty-200\bigskip\fi\fi} % For @cropmarks command. % Do @cropmarks to get crop marks. -% +% \newif\ifcropmarks \let\cropmarks = \cropmarkstrue % @@ -185,6 +306,9 @@ \normalturnoffactive % \ in index entries must not stay \, e.g., if % the page break happens to be in the middle of an example. \shipout\vbox{% + % Do this early so pdf references go to the beginning of the page. + \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi + % \ifcropmarks \vbox to \outervsize\bgroup \hsize = \outerhsize \vskip-\topandbottommargin @@ -231,7 +355,7 @@ \egroup % \vbox from first cropmarks clause \fi }% end of \shipout\vbox - }% end of group with \turnoffactive + }% end of group with \normalturnoffactive \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi } @@ -264,143 +388,162 @@ % the input line (except we remove a trailing comment). #1 should be a % macro which expects an ordinary undelimited TeX argument. % -\def\parsearg#1{% - \let\next = #1% +\def\parsearg{\parseargusing{}} +\def\parseargusing#1#2{% + \def\next{#2}% \begingroup \obeylines - \futurelet\temp\parseargx + \spaceisspace + #1% + \parseargline\empty% Insert the \empty token, see \finishparsearg below. } -% If the next token is an obeyed space (from an @example environment or -% the like), remove it and recurse. Otherwise, we're done. -\def\parseargx{% - % \obeyedspace is defined far below, after the definition of \sepspaces. - \ifx\obeyedspace\temp - \expandafter\parseargdiscardspace - \else - \expandafter\parseargline - \fi -} - -% Remove a single space (as the delimiter token to the macro call). -{\obeyspaces % - \gdef\parseargdiscardspace {\futurelet\temp\parseargx}} - {\obeylines % \gdef\parseargline#1^^M{% \endgroup % End of the group started in \parsearg. - % - % First remove any @c comment, then any @comment. - % Result of each macro is put in \toks0. - \argremovec #1\c\relax % - \expandafter\argremovecomment \the\toks0 \comment\relax % - % - % Call the caller's macro, saved as \next in \parsearg. - \expandafter\next\expandafter{\the\toks0}% + \argremovecomment #1\comment\ArgTerm% }% } -% Since all \c{,omment} does is throw away the argument, we can let TeX -% do that for us. The \relax here is matched by the \relax in the call -% in \parseargline; it could be more or less anything, its purpose is -% just to delimit the argument to the \c. -\def\argremovec#1\c#2\relax{\toks0 = {#1}} -\def\argremovecomment#1\comment#2\relax{\toks0 = {#1}} +% First remove any @comment, then any @c comment. +\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} +\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} -% \argremovec{,omment} might leave us with trailing spaces, though; e.g., +% Each occurence of `\^^M' or `\^^M' is replaced by a single space. +% +% \argremovec might leave us with trailing space, e.g., % @end itemize @c foo -% will have two active spaces as part of the argument with the -% `itemize'. Here we remove all active spaces from #1, and assign the -% result to \toks0. +% This space token undergoes the same procedure and is eventually removed +% by \finishparsearg. % -% This loses if there are any *other* active characters besides spaces -% in the argument -- _ ^ +, for example -- since they get expanded. -% Fortunately, Texinfo does not define any such commands. (If it ever -% does, the catcode of the characters in questionwill have to be changed -% here.) But this means we cannot call \removeactivespaces as part of -% \argremovec{,omment}, since @c uses \parsearg, and thus the argument -% that \parsearg gets might well have any character at all in it. -% -\def\removeactivespaces#1{% - \begingroup - \ignoreactivespaces - \edef\temp{#1}% - \global\toks0 = \expandafter{\temp}% - \endgroup +\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} +\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} +\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% + \def\temp{#3}% + \ifx\temp\empty + % We cannot use \next here, as it holds the macro to run; + % thus we reuse \temp. + \let\temp\finishparsearg + \else + \let\temp\argcheckspaces + \fi + % Put the space token in: + \temp#1 #3\ArgTerm } -% Change the active space to expand to nothing. +% If a _delimited_ argument is enclosed in braces, they get stripped; so +% to get _exactly_ the rest of the line, we had to prevent such situation. +% We prepended an \empty token at the very beginning and we expand it now, +% just before passing the control to \next. +% (Similarily, we have to think about #3 of \argcheckspacesY above: it is +% either the null string, or it ends with \^^M---thus there is no danger +% that a pair of braces would be stripped. % -\begingroup +% But first, we have to remove the trailing space token. +% +\def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}} + +% \parseargdef\foo{...} +% is roughly equivalent to +% \def\foo{\parsearg\Xfoo} +% \def\Xfoo#1{...} +% +% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my +% favourite TeX trick. --kasal, 16nov03 + +\def\parseargdef#1{% + \expandafter \doparseargdef \csname\string#1\endcsname #1% +} +\def\doparseargdef#1#2{% + \def#2{\parsearg#1}% + \def#1##1% +} + +% Several utility definitions with active space: +{ \obeyspaces - \gdef\ignoreactivespaces{\obeyspaces\let =\empty} -\endgroup + \gdef\obeyedspace{ } + + % Make each space character in the input produce a normal interword + % space in the output. Don't allow a line break at this space, as this + % is used only in environments like @example, where each line of input + % should produce a line of output anyway. + % + \gdef\sepspaces{\obeyspaces\let =\tie} + + % If an index command is used in an @example environment, any spaces + % therein should become regular spaces in the raw index file, not the + % expansion of \tie (\leavevmode \penalty \@M \ ). + \gdef\unsepspaces{\let =\space} +} \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} -%% These are used to keep @begin/@end levels from running away -%% Call \inENV within environments (after a \begingroup) -\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi} -\def\ENVcheck{% -\ifENV\errmessage{Still within an environment; press RETURN to continue} -\endgroup\fi} % This is not perfect, but it should reduce lossage - -% @begin foo is the same as @foo, for now. -\newhelp\EMsimple{Press RETURN to continue.} - -\outer\def\begin{\parsearg\beginxxx} - -\def\beginxxx #1{% -\expandafter\ifx\csname #1\endcsname\relax -{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else -\csname #1\endcsname\fi} - -% @end foo executes the definition of \Efoo. +% Define the framework for environments in texinfo.tex. It's used like this: % -\def\end{\parsearg\endxxx} -\def\endxxx #1{% - \removeactivespaces{#1}% - \edef\endthing{\the\toks0}% - % - \expandafter\ifx\csname E\endthing\endcsname\relax - \expandafter\ifx\csname \endthing\endcsname\relax - % There's no \foo, i.e., no ``environment'' foo. - \errhelp = \EMsimple - \errmessage{Undefined command `@end \endthing'}% - \else - \unmatchedenderror\endthing - \fi +% \envdef\foo{...} +% \def\Efoo{...} +% +% It's the responsibility of \envdef to insert \begingroup before the +% actual body; @end closes the group after calling \Efoo. \envdef also +% defines \thisenv, so the current environment is known; @end checks +% whether the environment name matches. The \checkenv macro can also be +% used to check whether the current environment is the one expected. +% +% Non-false conditionals (@iftex, @ifset) don't fit into this, so they +% are not treated as enviroments; they don't open a group. (The +% implementation of @end takes care not to call \endgroup in this +% special case.) + + +% At runtime, environments start with this: +\def\startenvironment#1{\begingroup\def\thisenv{#1}} +% initialize +\let\thisenv\empty + +% ... but they get defined via ``\envdef\foo{...}'': +\long\def\envdef#1#2{\def#1{\startenvironment#1#2}} +\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} + +% Check whether we're in the right environment: +\def\checkenv#1{% + \def\temp{#1}% + \ifx\thisenv\temp \else - % Everything's ok; the right environment has been started. - \csname E\endthing\endcsname + \badenverr \fi } -% There is an environment #1, but it hasn't been started. Give an error. -% -\def\unmatchedenderror#1{% +% Evironment mismatch, #1 expected: +\def\badenverr{% \errhelp = \EMsimple - \errmessage{This `@end #1' doesn't have a matching `@#1'}% + \errmessage{This command can appear only \inenvironment\temp, + not \inenvironment\thisenv}% +} +\def\inenvironment#1{% + \ifx#1\empty + out of any environment% + \else + in environment \expandafter\string#1% + \fi } -% Define the control sequence \E#1 to give an unmatched @end error. +% @end foo executes the definition of \Efoo. +% But first, it executes a specialized version of \checkenv % -\def\defineunmatchedend#1{% - \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}% +\parseargdef\end{% + \if 1\csname iscond.#1\endcsname + \else + % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03 + \expandafter\checkenv\csname#1\endcsname + \csname E#1\endcsname + \endgroup + \fi } +\newhelp\EMsimple{Press RETURN to continue.} -% Single-spacing is done by various environments (specifically, in -% \nonfillstart and \quotations). -\newskip\singlespaceskip \singlespaceskip = 12.5pt -\def\singlespace{% - % Why was this kern here? It messes up equalizing space above and below - % environments. --karl, 6may93 - %{\advance \baselineskip by -\singlespaceskip - %\kern \baselineskip}% - \setleading \singlespaceskip -} %% Simple single-character @ commands @@ -421,16 +564,22 @@ \let\{=\mylbrace \let\}=\myrbrace \begingroup - % Definitions to produce actual \{ & \} command in an index. - \catcode`\{ = 12 \catcode`\} = 12 + % Definitions to produce \{ and \} commands for indices, + % and @{ and @} for the aux file. + \catcode`\{ = \other \catcode`\} = \other \catcode`\[ = 1 \catcode`\] = 2 - \catcode`\@ = 0 \catcode`\\ = 12 - @gdef@lbracecmd[\{]% - @gdef@rbracecmd[\}]% -@endgroup + \catcode`\! = 0 \catcode`\\ = \other + !gdef!lbracecmd[\{]% + !gdef!rbracecmd[\}]% + !gdef!lbraceatcmd[@{]% + !gdef!rbraceatcmd[@}]% +!endgroup + +% @comma{} to avoid , parsing problems. +\let\comma = , % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent -% Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H. +% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. \let\, = \c \let\dotaccent = \. \def\ringaccent#1{{\accent23 #1}} @@ -438,10 +587,12 @@ \let\ubaraccent = \b \let\udotaccent = \d -% Other special characters: @questiondown @exclamdown -% Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss. +% Other special characters: @questiondown @exclamdown @ordf @ordm +% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. \def\questiondown{?`} \def\exclamdown{!`} +\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} +\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} % Dotless i and dotless j, used for accents. \def\imacro{i} @@ -454,6 +605,25 @@ \fi\fi } +% The \TeX{} logo, as in plain, but resetting the spacing so that a +% period following counts as ending a sentence. (Idea found in latex.) +% +\edef\TeX{\TeX \spacefactor=3000 } + +% @LaTeX{} logo. Not quite the same results as the definition in +% latex.ltx, since we use a different font for the raised A; it's most +% convenient for us to use an explicitly smaller font, rather than using +% the \scriptstyle font (since we don't reset \scriptstyle and +% \scriptscriptstyle). +% +\def\LaTeX{% + L\kern-.36em + {\setbox0=\hbox{T}% + \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}% + \kern-.15em + \TeX +} + % Be sure we're in horizontal mode when doing a tie, since we make space % equivalent to this in @example-like environments. Otherwise, a space % at the beginning of a line will start with \penalty -- and @@ -472,6 +642,9 @@ % @* forces a line break. \def\*{\hfil\break\hbox{}\ignorespaces} +% @/ allows a line break. +\let\/=\allowbreak + % @. is an end-of-sentence period. \def\.{.\spacefactor=3000 } @@ -494,47 +667,24 @@ % therefore, no glue is inserted, and the space between the headline and % the text is small, which looks bad. % -\def\group{\begingroup - \ifnum\catcode13=\active \else +% Another complication is that the group might be very large. This can +% cause the glue on the previous page to be unduly stretched, because it +% does not have much material. In this case, it's better to add an +% explicit \vfill so that the extra space is at the bottom. The +% threshold for doing this is if the group is more than \vfilllimit +% percent of a page (\vfilllimit can be changed inside of @tex). +% +\newbox\groupbox +\def\vfilllimit{0.7} +% +\envdef\group{% + \ifnum\catcode`\^^M=\active \else \errhelp = \groupinvalidhelp \errmessage{@group invalid in context where filling is enabled}% \fi + \startsavinginserts % - % The \vtop we start below produces a box with normal height and large - % depth; thus, TeX puts \baselineskip glue before it, and (when the - % next line of text is done) \lineskip glue after it. (See p.82 of - % the TeXbook.) Thus, space below is not quite equal to space - % above. But it's pretty close. - \def\Egroup{% - \egroup % End the \vtop. - \endgroup % End the \group. - }% - % - \vtop\bgroup - % We have to put a strut on the last line in case the @group is in - % the midst of an example, rather than completely enclosing it. - % Otherwise, the interline space between the last line of the group - % and the first line afterwards is too small. But we can't put the - % strut in \Egroup, since there it would be on a line by itself. - % Hence this just inserts a strut at the beginning of each line. - \everypar = {\strut}% - % - % Since we have a strut on every line, we don't need any of TeX's - % normal interline spacing. - \offinterlineskip - % - % OK, but now we have to do something about blank - % lines in the input in @example-like environments, which normally - % just turn into \lisppar, which will insert no space now that we've - % turned off the interline space. Simplest is to make them be an - % empty paragraph. - \ifx\par\lisppar - \edef\par{\leavevmode \par}% - % - % Reset ^^M's definition to new definition of \par. - \obeylines - \fi - % + \setbox\groupbox = \vtop\bgroup % Do @comment since we are called inside an environment such as % @example, where each end-of-line in the input causes an % end-of-line in the output. We don't want the end-of-line after @@ -544,6 +694,32 @@ \comment } % +% The \vtop produces a box with normal height and large depth; thus, TeX puts +% \baselineskip glue before it, and (when the next line of text is done) +% \lineskip glue after it. Thus, space below is not quite equal to space +% above. But it's pretty close. +\def\Egroup{% + % To get correct interline space between the last line of the group + % and the first line afterwards, we have to propagate \prevdepth. + \endgraf % Not \par, as it may have been set to \lisppar. + \global\dimen1 = \prevdepth + \egroup % End the \vtop. + % \dimen0 is the vertical size of the group's box. + \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox + % \dimen2 is how much space is left on the page (more or less). + \dimen2 = \pageheight \advance\dimen2 by -\pagetotal + % if the group doesn't fit on the current page, and it's a big big + % group, force a page break. + \ifdim \dimen0 > \dimen2 + \ifdim \pagetotal < \vfilllimit\pageheight + \page + \fi + \fi + \box\groupbox + \prevdepth = \dimen1 + \checkinserts +} +% % TeX puts in an \escapechar (i.e., `@') at the beginning of the help % message, so this ends up printing `@group can only ...'. % @@ -556,10 +732,8 @@ where each line of input produces a line of output.} \newdimen\mil \mil=0.001in -\def\need{\parsearg\needx} - % Old definition--didn't work. -%\def\needx #1{\par % +%\parseargdef\need{\par % %% This method tries to make TeX break the page naturally %% if the depth of the box does not fit. %{\baselineskip=0pt% @@ -567,70 +741,50 @@ where each line of input produces a line of output.} %\prevdepth=-1000pt %}} -\def\needx#1{% - % Go into vertical mode, so we don't make a big box in the middle of a +\parseargdef\need{% + % Ensure vertical mode, so we don't make a big box in the middle of a % paragraph. \par % - % Don't add any leading before our big empty box, but allow a page - % break, since the best break might be right here. - \allowbreak - \nointerlineskip - \vtop to #1\mil{\vfil}% - % - % TeX does not even consider page breaks if a penalty added to the - % main vertical list is 10000 or more. But in order to see if the - % empty box we just added fits on the page, we must make it consider - % page breaks. On the other hand, we don't want to actually break the - % page after the empty box. So we use a penalty of 9999. - % - % There is an extremely small chance that TeX will actually break the - % page at this \penalty, if there are no other feasible breakpoints in - % sight. (If the user is using lots of big @group commands, which - % almost-but-not-quite fill up a page, TeX will have a hard time doing - % good page breaking, for example.) However, I could not construct an - % example where a page broke at this \penalty; if it happens in a real - % document, then we can reconsider our strategy. - \penalty9999 - % - % Back up by the size of the box, whether we did a page break or not. - \kern -#1\mil - % - % Do not allow a page break right after this kern. - \nobreak + % If the @need value is less than one line space, it's useless. + \dimen0 = #1\mil + \dimen2 = \ht\strutbox + \advance\dimen2 by \dp\strutbox + \ifdim\dimen0 > \dimen2 + % + % Do a \strut just to make the height of this box be normal, so the + % normal leading is inserted relative to the preceding line. + % And a page break here is fine. + \vtop to #1\mil{\strut\vfil}% + % + % TeX does not even consider page breaks if a penalty added to the + % main vertical list is 10000 or more. But in order to see if the + % empty box we just added fits on the page, we must make it consider + % page breaks. On the other hand, we don't want to actually break the + % page after the empty box. So we use a penalty of 9999. + % + % There is an extremely small chance that TeX will actually break the + % page at this \penalty, if there are no other feasible breakpoints in + % sight. (If the user is using lots of big @group commands, which + % almost-but-not-quite fill up a page, TeX will have a hard time doing + % good page breaking, for example.) However, I could not construct an + % example where a page broke at this \penalty; if it happens in a real + % document, then we can reconsider our strategy. + \penalty9999 + % + % Back up by the size of the box, whether we did a page break or not. + \kern -#1\mil + % + % Do not allow a page break right after this kern. + \nobreak + \fi } -% @br forces paragraph break +% @br forces paragraph break (and is undocumented). \let\br = \par -% @dots{} output an ellipsis using the current font. -% We do .5em per period so that it has the same spacing in a typewriter -% font as three actual period characters. -% -\def\dots{% - \leavevmode - \hbox to 1.5em{% - \hskip 0pt plus 0.25fil minus 0.25fil - .\hss.\hss.% - \hskip 0pt plus 0.5fil minus 0.5fil - }% -} - -% @enddots{} is an end-of-sentence ellipsis. -% -\def\enddots{% - \leavevmode - \hbox to 2em{% - \hskip 0pt plus 0.25fil minus 0.25fil - .\hss.\hss.\hss.% - \hskip 0pt plus 0.5fil minus 0.5fil - }% - \spacefactor=3000 -} - - -% @page forces the start of a new page +% @page forces the start of a new page. % \def\page{\par\vfill\supereject} @@ -642,57 +796,127 @@ where each line of input produces a line of output.} \newskip\exdentamount % This defn is used inside fill environments such as @defun. -\def\exdent{\parsearg\exdentyyy} -\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}} +\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} % This defn is used inside nofill environments such as @example. -\def\nofillexdent{\parsearg\nofillexdentyyy} -\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount -\leftline{\hskip\leftskip{\rm#1}}}} +\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount + \leftline{\hskip\leftskip{\rm#1}}}} -% @inmargin{TEXT} puts TEXT in the margin next to the current paragraph. - -\def\inmargin#1{% -\strut\vadjust{\nobreak\kern-\strutdepth - \vtop to \strutdepth{\baselineskip\strutdepth\vss - \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}} +% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current +% paragraph. For more general purposes, use the \margin insertion +% class. WHICH is `l' or `r'. +% \newskip\inmarginspacing \inmarginspacing=1cm \def\strutdepth{\dp\strutbox} - -%\hbox{{\rm#1}}\hfil\break}} +% +\def\doinmargin#1#2{\strut\vadjust{% + \nobreak + \kern-\strutdepth + \vtop to \strutdepth{% + \baselineskip=\strutdepth + \vss + % if you have multiple lines of stuff to put here, you'll need to + % make the vbox yourself of the appropriate size. + \ifx#1l% + \llap{\ignorespaces #2\hskip\inmarginspacing}% + \else + \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% + \fi + \null + }% +}} +\def\inleftmargin{\doinmargin l} +\def\inrightmargin{\doinmargin r} +% +% @inmargin{TEXT [, RIGHT-TEXT]} +% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; +% else use TEXT for both). +% +\def\inmargin#1{\parseinmargin #1,,\finish} +\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \def\lefttext{#1}% have both texts + \def\righttext{#2}% + \else + \def\lefttext{#1}% have only one text + \def\righttext{#1}% + \fi + % + \ifodd\pageno + \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin + \else + \def\temp{\inleftmargin\lefttext}% + \fi + \temp +} % @include file insert text of that file as input. -% Allow normal characters that we make active in the argument (a file name). -\def\include{\begingroup - \catcode`\\=12 - \catcode`~=12 - \catcode`^=12 - \catcode`_=12 - \catcode`|=12 - \catcode`<=12 - \catcode`>=12 - \catcode`+=12 - \parsearg\includezzz} -% Restore active chars for included file. -\def\includezzz#1{\endgroup\begingroup - % Read the included file in a group so nested @include's work. +% +\def\include{\parseargusing\filenamecatcodes\includezzz} +\def\includezzz#1{% + \pushthisfilestack \def\thisfile{#1}% - \input\thisfile -\endgroup} + {% + \makevalueexpandable + \def\temp{\input #1 }% + \expandafter + }\temp + \popthisfilestack +} +\def\filenamecatcodes{% + \catcode`\\=\other + \catcode`~=\other + \catcode`^=\other + \catcode`_=\other + \catcode`|=\other + \catcode`<=\other + \catcode`>=\other + \catcode`+=\other + \catcode`-=\other +} + +\def\pushthisfilestack{% + \expandafter\pushthisfilestackX\popthisfilestack\StackTerm +} +\def\pushthisfilestackX{% + \expandafter\pushthisfilestackY\thisfile\StackTerm +} +\def\pushthisfilestackY #1\StackTerm #2\StackTerm {% + \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% +} + +\def\popthisfilestack{\errthisfilestackempty} +\def\errthisfilestackempty{\errmessage{Internal error: + the stack of filenames is empty.}} \def\thisfile{} -% @center line outputs that line, centered - -\def\center{\parsearg\centerzzz} -\def\centerzzz #1{{\advance\hsize by -\leftskip -\advance\hsize by -\rightskip -\centerline{#1}}} +% @center line +% outputs that line, centered. +% +\parseargdef\center{% + \ifhmode + \let\next\centerH + \else + \let\next\centerV + \fi + \next{\hfil \ignorespaces#1\unskip \hfil}% +} +\def\centerH#1{% + {% + \hfil\break + \advance\hsize by -\leftskip + \advance\hsize by -\rightskip + \line{#1}% + \break + }% +} +\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}} % @sp n outputs n lines of vertical space -\def\sp{\parsearg\spxxx} -\def\spxxx #1{\vskip #1\baselineskip} +\parseargdef\sp{\vskip #1\baselineskip} % @comment ...line which is ignored... % @c is the same as @comment @@ -705,374 +929,175 @@ where each line of input produces a line of output.} \let\c=\comment -% @paragraphindent is defined for the Info formatting commands only. -\let\paragraphindent=\comment - -% Prevent errors for section commands. -% Used in @ignore and in failing conditionals. -\def\ignoresections{% -\let\chapter=\relax -\let\unnumbered=\relax -\let\top=\relax -\let\unnumberedsec=\relax -\let\unnumberedsection=\relax -\let\unnumberedsubsec=\relax -\let\unnumberedsubsection=\relax -\let\unnumberedsubsubsec=\relax -\let\unnumberedsubsubsection=\relax -\let\section=\relax -\let\subsec=\relax -\let\subsubsec=\relax -\let\subsection=\relax -\let\subsubsection=\relax -\let\appendix=\relax -\let\appendixsec=\relax -\let\appendixsection=\relax -\let\appendixsubsec=\relax -\let\appendixsubsection=\relax -\let\appendixsubsubsec=\relax -\let\appendixsubsubsection=\relax -\let\contents=\relax -\let\smallbook=\relax -\let\titlepage=\relax -} - -% Used in nested conditionals, where we have to parse the Texinfo source -% and so want to turn off most commands, in case they are used -% incorrectly. +% @paragraphindent NCHARS +% We'll use ems for NCHARS, close enough. +% NCHARS can also be the word `asis' or `none'. +% We cannot feasibly implement @paragraphindent asis, though. % -\def\ignoremorecommands{% - \let\defcodeindex = \relax - \let\defcv = \relax - \let\deffn = \relax - \let\deffnx = \relax - \let\defindex = \relax - \let\defivar = \relax - \let\defmac = \relax - \let\defmethod = \relax - \let\defop = \relax - \let\defopt = \relax - \let\defspec = \relax - \let\deftp = \relax - \let\deftypefn = \relax - \let\deftypefun = \relax - \let\deftypevar = \relax - \let\deftypevr = \relax - \let\defun = \relax - \let\defvar = \relax - \let\defvr = \relax - \let\ref = \relax - \let\xref = \relax - \let\printindex = \relax - \let\pxref = \relax - \let\settitle = \relax - \let\setchapternewpage = \relax - \let\setchapterstyle = \relax - \let\everyheading = \relax - \let\evenheading = \relax - \let\oddheading = \relax - \let\everyfooting = \relax - \let\evenfooting = \relax - \let\oddfooting = \relax - \let\headings = \relax - \let\include = \relax - \let\lowersections = \relax - \let\down = \relax - \let\raisesections = \relax - \let\up = \relax - \let\set = \relax - \let\clear = \relax - \let\item = \relax -} - -% Ignore @ignore ... @end ignore. +\def\asisword{asis} % no translation, these are keywords +\def\noneword{none} % -\def\ignore{\doignore{ignore}} - -% Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text. -% -\def\ifinfo{\doignore{ifinfo}} -\def\ifhtml{\doignore{ifhtml}} -\def\ifnottex{\doignore{ifnottex}} -\def\html{\doignore{html}} -\def\menu{\doignore{menu}} -\def\direntry{\doignore{direntry}} - -% @dircategory CATEGORY -- specify a category of the dir file -% which this file should belong to. Ignore this in TeX. -\let\dircategory = \comment - -% Ignore text until a line `@end #1'. -% -\def\doignore#1{\begingroup - % Don't complain about control sequences we have declared \outer. - \ignoresections - % - % Define a command to swallow text until we reach `@end #1'. - % This @ is a catcode 12 token (that is the normal catcode of @ in - % this texinfo.tex file). We change the catcode of @ below to match. - \long\def\doignoretext##1@end #1{\enddoignore}% - % - % Make sure that spaces turn into tokens that match what \doignoretext wants. - \catcode32 = 10 - % - % Ignore braces, too, so mismatched braces don't cause trouble. - \catcode`\{ = 9 - \catcode`\} = 9 - % - % We must not have @c interpreted as a control sequence. - \catcode`\@ = 12 - % - % Make the letter c a comment character so that the rest of the line - % will be ignored. This way, the document can have (for example) - % @c @end ifinfo - % and the @end ifinfo will be properly ignored. - % (We've just changed @ to catcode 12.) - \catcode`\c = 14 - % - % And now expand that command. - \doignoretext -} - -% What we do to finish off ignored text. -% -\def\enddoignore{\endgroup\ignorespaces}% - -\newif\ifwarnedobs\warnedobsfalse -\def\obstexwarn{% - \ifwarnedobs\relax\else - % We need to warn folks that they may have trouble with TeX 3.0. - % This uses \immediate\write16 rather than \message to get newlines. - \immediate\write16{} - \immediate\write16{***WARNING*** for users of Unix TeX 3.0!} - \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).} - \immediate\write16{If you are running another version of TeX, relax.} - \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.} - \immediate\write16{ Then upgrade your TeX installation if you can.} - \immediate\write16{ (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)} - \immediate\write16{If you are stuck with version 3.0, run the} - \immediate\write16{ script ``tex3patch'' from the Texinfo distribution} - \immediate\write16{ to use a workaround.} - \immediate\write16{} - \global\warnedobstrue +\parseargdef\paragraphindent{% + \def\temp{#1}% + \ifx\temp\asisword + \else + \ifx\temp\noneword + \defaultparindent = 0pt + \else + \defaultparindent = #1em \fi -} - -% **In TeX 3.0, setting text in \nullfont hangs tex. For a -% workaround (which requires the file ``dummy.tfm'' to be installed), -% uncomment the following line: -%%%%%\font\nullfont=dummy\let\obstexwarn=\relax - -% Ignore text, except that we keep track of conditional commands for -% purposes of nesting, up to an `@end #1' command. -% -\def\nestedignore#1{% - \obstexwarn - % We must actually expand the ignored text to look for the @end - % command, so that nested ignore constructs work. Thus, we put the - % text into a \vbox and then do nothing with the result. To minimize - % the change of memory overflow, we follow the approach outlined on - % page 401 of the TeXbook: make the current font be a dummy font. - % - \setbox0 = \vbox\bgroup - % Don't complain about control sequences we have declared \outer. - \ignoresections - % - % Define `@end #1' to end the box, which will in turn undefine the - % @end command again. - \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}% - % - % We are going to be parsing Texinfo commands. Most cause no - % trouble when they are used incorrectly, but some commands do - % complicated argument parsing or otherwise get confused, so we - % undefine them. - % - % We can't do anything about stray @-signs, unfortunately; - % they'll produce `undefined control sequence' errors. - \ignoremorecommands - % - % Set the current font to be \nullfont, a TeX primitive, and define - % all the font commands to also use \nullfont. We don't use - % dummy.tfm, as suggested in the TeXbook, because not all sites - % might have that installed. Therefore, math mode will still - % produce output, but that should be an extremely small amount of - % stuff compared to the main input. - % - \nullfont - \let\tenrm = \nullfont \let\tenit = \nullfont \let\tensl = \nullfont - \let\tenbf = \nullfont \let\tentt = \nullfont \let\smallcaps = \nullfont - \let\tensf = \nullfont - % Similarly for index fonts (mostly for their use in - % smallexample) - \let\indrm = \nullfont \let\indit = \nullfont \let\indsl = \nullfont - \let\indbf = \nullfont \let\indtt = \nullfont \let\indsc = \nullfont - \let\indsf = \nullfont - % - % Don't complain when characters are missing from the fonts. - \tracinglostchars = 0 - % - % Don't bother to do space factor calculations. - \frenchspacing - % - % Don't report underfull hboxes. - \hbadness = 10000 - % - % Do minimal line-breaking. - \pretolerance = 10000 - % - % Do not execute instructions in @tex - \def\tex{\doignore{tex}}% - % Do not execute macro definitions. - % `c' is a comment character, so the word `macro' will get cut off. - \def\macro{\doignore{ma}}% -} - -% @set VAR sets the variable VAR to an empty value. -% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. -% -% Since we want to separate VAR from REST-OF-LINE (which might be -% empty), we can't just use \parsearg; we have to insert a space of our -% own to delimit the rest of the line, and then take it out again if we -% didn't need it. Make sure the catcode of space is correct to avoid -% losing inside @example, for instance. -% -\def\set{\begingroup\catcode` =10 - \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR. - \parsearg\setxxx} -\def\setxxx#1{\setyyy#1 \endsetyyy} -\def\setyyy#1 #2\endsetyyy{% - \def\temp{#2}% - \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty - \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted. \fi - \endgroup + \parindent = \defaultparindent } -% Can't use \xdef to pre-expand #2 and save some time, since \temp or -% \next or other control sequences that we've defined might get us into -% an infinite loop. Consider `@set foo @cite{bar}'. -\def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}} -% @clear VAR clears (i.e., unsets) the variable VAR. -% -\def\clear{\parsearg\clearxxx} -\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax} - -% @value{foo} gets the text saved in variable foo. -% -{ - \catcode`\_ = \active - % - % We might end up with active _ or - characters in the argument if - % we're called from @code, as @code{@value{foo-bar_}}. So \let any - % such active characters to their normal equivalents. - \gdef\value{\begingroup - \catcode`\-=12 \catcode`\_=12 - \indexbreaks \let_\normalunderscore - \valuexxx} -} -\def\valuexxx#1{\expandablevalue{#1}\endgroup} - -% We have this subroutine so that we can handle at least some @value's -% properly in indexes (we \let\value to this in \indexdummies). Ones -% whose names contain - or _ still won't work, but we can't do anything -% about that. The command has to be fully expandable, since the result -% winds up in the index file. This means that if the variable's value -% contains other Texinfo commands, it's almost certain it will fail -% (although perhaps we could fix that with sufficient work to do a -% one-level expansion on the result, instead of complete). -% -\def\expandablevalue#1{% - \expandafter\ifx\csname SET#1\endcsname\relax - {[No value for ``#1'']}% +% @exampleindent NCHARS +% We'll use ems for NCHARS like @paragraphindent. +% It seems @exampleindent asis isn't necessary, but +% I preserve it to make it similar to @paragraphindent. +\parseargdef\exampleindent{% + \def\temp{#1}% + \ifx\temp\asisword \else - \csname SET#1\endcsname + \ifx\temp\noneword + \lispnarrowing = 0pt + \else + \lispnarrowing = #1em + \fi \fi } -% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined -% with @set. +% @firstparagraphindent WORD +% If WORD is `none', then suppress indentation of the first paragraph +% after a section heading. If WORD is `insert', then do indent at such +% paragraphs. % -\def\ifset{\parsearg\ifsetxxx} -\def\ifsetxxx #1{% - \expandafter\ifx\csname SET#1\endcsname\relax - \expandafter\ifsetfail +% The paragraph indentation is suppressed or not by calling +% \suppressfirstparagraphindent, which the sectioning commands do. +% We switch the definition of this back and forth according to WORD. +% By default, we suppress indentation. +% +\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} +\def\insertword{insert} +% +\parseargdef\firstparagraphindent{% + \def\temp{#1}% + \ifx\temp\noneword + \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent + \else\ifx\temp\insertword + \let\suppressfirstparagraphindent = \relax \else - \expandafter\ifsetsucceed - \fi + \errhelp = \EMsimple + \errmessage{Unknown @firstparagraphindent option `\temp'}% + \fi\fi } -\def\ifsetsucceed{\conditionalsucceed{ifset}} -\def\ifsetfail{\nestedignore{ifset}} -\defineunmatchedend{ifset} -% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been -% defined with @set, or has been undefined with @clear. +% Here is how we actually suppress indentation. Redefine \everypar to +% \kern backwards by \parindent, and then reset itself to empty. % -\def\ifclear{\parsearg\ifclearxxx} -\def\ifclearxxx #1{% - \expandafter\ifx\csname SET#1\endcsname\relax - \expandafter\ifclearsucceed - \else - \expandafter\ifclearfail - \fi -} -\def\ifclearsucceed{\conditionalsucceed{ifclear}} -\def\ifclearfail{\nestedignore{ifclear}} -\defineunmatchedend{ifclear} - -% @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text -% following, through the first @end iftex (etc.). Make `@end iftex' -% (etc.) valid only after an @iftex. +% We also make \indent itself not actually do anything until the next +% paragraph. % -\def\iftex{\conditionalsucceed{iftex}} -\def\ifnothtml{\conditionalsucceed{ifnothtml}} -\def\ifnotinfo{\conditionalsucceed{ifnotinfo}} -\defineunmatchedend{iftex} -\defineunmatchedend{ifnothtml} -\defineunmatchedend{ifnotinfo} - -% We can't just want to start a group at @iftex (for example) and end it -% at @end iftex, since then @set commands inside the conditional have no -% effect (they'd get reverted at the end of the group). So we must -% define \Eiftex to redefine itself to be its previous value. (We can't -% just define it to fail again with an ``unmatched end'' error, since -% the @ifset might be nested.) -% -\def\conditionalsucceed#1{% - \edef\temp{% - % Remember the current value of \E#1. - \let\nece{prevE#1} = \nece{E#1}% - % - % At the `@end #1', redefine \E#1 to be its previous value. - \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}% +\gdef\dosuppressfirstparagraphindent{% + \gdef\indent{% + \restorefirstparagraphindent + \indent + }% + \gdef\noindent{% + \restorefirstparagraphindent + \noindent + }% + \global\everypar = {% + \kern -\parindent + \restorefirstparagraphindent }% - \temp } -% We need to expand lots of \csname's, but we don't want to expand the -% control sequences after we've constructed them. -% -\def\nece#1{\expandafter\noexpand\csname#1\endcsname} +\gdef\restorefirstparagraphindent{% + \global \let \indent = \ptexindent + \global \let \noindent = \ptexnoindent + \global \everypar = {}% +} + % @asis just yields its argument. Used with @table, for example. % \def\asis#1{#1} -% @math means output in math mode. -% We don't use $'s directly in the definition of \math because control -% sequences like \math are expanded when the toc file is written. Then, -% we read the toc file back, the $'s will be normal characters (as they -% should be, according to the definition of Texinfo). So we must use a -% control sequence to switch into and out of math mode. +% @math outputs its argument in math mode. % -% This isn't quite enough for @math to work properly in indices, but it -% seems unlikely it will ever be needed there. +% One complication: _ usually means subscripts, but it could also mean +% an actual _ character, as in @math{@var{some_variable} + 1}. So make +% _ active, and distinguish by seeing if the current family is \slfam, +% which is what @var uses. +{ + \catcode\underChar = \active + \gdef\mathunderscore{% + \catcode\underChar=\active + \def_{\ifnum\fam=\slfam \_\else\sb\fi}% + } +} +% Another complication: we want \\ (and @\) to output a \ character. +% FYI, plain.tex uses \\ as a temporary control sequence (why?), but +% this is not advertised and we don't care. Texinfo does not +% otherwise define @\. % -\let\implicitmath = $ -\def\math#1{\implicitmath #1\implicitmath} +% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. +\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} +% +\def\math{% + \tex + \mathunderscore + \let\\ = \mathbackslash + \mathactive + $\finishmath +} +\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. + +% Some active characters (such as <) are spaced differently in math. +% We have to reset their definitions in case the @math was an argument +% to a command which sets the catcodes (such as @item or @section). +% +{ + \catcode`^ = \active + \catcode`< = \active + \catcode`> = \active + \catcode`+ = \active + \gdef\mathactive{% + \let^ = \ptexhat + \let< = \ptexless + \let> = \ptexgtr + \let+ = \ptexplus + } +} % @bullet and @minus need the same treatment as @math, just above. -\def\bullet{\implicitmath\ptexbullet\implicitmath} -\def\minus{\implicitmath-\implicitmath} +\def\bullet{$\ptexbullet$} +\def\minus{$-$} + +% @dots{} outputs an ellipsis using the current font. +% We do .5em per period so that it has the same spacing in a typewriter +% font as three actual period characters. +% +\def\dots{% + \leavevmode + \hbox to 1.5em{% + \hskip 0pt plus 0.25fil + .\hfil.\hfil.% + \hskip 0pt plus 0.5fil + }% +} + +% @enddots{} is an end-of-sentence ellipsis. +% +\def\enddots{% + \dots + \spacefactor=3000 +} + +% @comma{} is so commas can be inserted into text without messing up +% Texinfo's parsing. +% +\let\comma = , % @refill is a no-op. \let\refill=\relax @@ -1088,26 +1113,26 @@ where each line of input produces a line of output.} % So open here the files we need to have open while reading the input. % This makes it possible to make a .fmt file for texinfo. \def\setfilename{% - \iflinks - \readauxfile + \fixbackslash % Turn off hack to swallow `\input texinfo'. + \iflinks + \tryauxfile + % Open the new aux file. TeX will close it automatically at exit. + \immediate\openout\auxfile=\jobname.aux \fi % \openindices needs to do some work in any case. \openindices - \fixbackslash % Turn off hack to swallow `\input texinfo'. - \global\let\setfilename=\comment % Ignore extra @setfilename cmds. + \let\setfilename=\comment % Ignore extra @setfilename cmds. % % If texinfo.cnf is present on the system, read it. % Useful for site-wide @afourpaper, etc. - % Just to be on the safe side, close the input stream before the \input. \openin 1 texinfo.cnf - \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi - \closein1 - \temp + \ifeof 1 \else \input texinfo.cnf \fi + \closein 1 % \comment % Ignore the actual filename. } % Called from \setfilename. -% +% \def\openindices{% \newindex{cp}% \newcodeindex{fn}% @@ -1121,21 +1146,298 @@ where each line of input produces a line of output.} \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} +\message{pdf,} +% adobe `portable' document format +\newcount\tempnum +\newcount\lnkcount +\newtoks\filename +\newcount\filenamelength +\newcount\pgn +\newtoks\toksA +\newtoks\toksB +\newtoks\toksC +\newtoks\toksD +\newbox\boxA +\newcount\countA +\newif\ifpdf +\newif\ifpdfmakepagedest + +% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 +% can be set). So we test for \relax and 0 as well as \undefined, +% borrowed from ifpdf.sty. +\ifx\pdfoutput\undefined +\else + \ifx\pdfoutput\relax + \else + \ifcase\pdfoutput + \else + \pdftrue + \fi + \fi +\fi +% +\ifpdf + \input pdfcolor + \pdfcatalog{/PageMode /UseOutlines}% + \def\dopdfimage#1#2#3{% + \def\imagewidth{#2}% + \def\imageheight{#3}% + % without \immediate, pdftex seg faults when the same image is + % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) + \ifnum\pdftexversion < 14 + \immediate\pdfimage + \else + \immediate\pdfximage + \fi + \ifx\empty\imagewidth\else width \imagewidth \fi + \ifx\empty\imageheight\else height \imageheight \fi + \ifnum\pdftexversion<13 + #1.pdf% + \else + {#1.pdf}% + \fi + \ifnum\pdftexversion < 14 \else + \pdfrefximage \pdflastximage + \fi} + \def\pdfmkdest#1{{% + % We have to set dummies so commands such as @code in a section title + % aren't expanded. + \atdummies + \normalturnoffactive + \pdfdest name{#1} xyz% + }} + \def\pdfmkpgn#1{#1} + \let\linkcolor = \Blue % was Cyan, but that seems light? + \def\endlink{\Black\pdfendlink} + % Adding outlines to PDF; macros for calculating structure of outlines + % come from Petr Olsak + \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% + \else \csname#1\endcsname \fi} + \def\advancenumber#1{\tempnum=\expnumber{#1}\relax + \advance\tempnum by 1 + \expandafter\xdef\csname#1\endcsname{\the\tempnum}} + % + % #1 is the section text. #2 is the pdf expression for the number + % of subentries (or empty, for subsubsections). #3 is the node + % text, which might be empty if this toc entry had no + % corresponding node. #4 is the page number. + % + \def\dopdfoutline#1#2#3#4{% + % Generate a link to the node text if that exists; else, use the + % page number. We could generate a destination for the section + % text in the case where a section has no node, but it doesn't + % seem worthwhile, since most documents are normally structured. + \def\pdfoutlinedest{#3}% + \ifx\pdfoutlinedest\empty \def\pdfoutlinedest{#4}\fi + % + \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{#1}% + } + % + \def\pdfmakeoutlines{% + \begingroup + % Thanh's hack / proper braces in bookmarks + \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace + \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace + % + % Read toc silently, to get counts of subentries for \pdfoutline. + \def\numchapentry##1##2##3##4{% + \def\thischapnum{##2}% + \let\thissecnum\empty + \let\thissubsecnum\empty + }% + \def\numsecentry##1##2##3##4{% + \advancenumber{chap\thischapnum}% + \def\thissecnum{##2}% + \let\thissubsecnum\empty + }% + \def\numsubsecentry##1##2##3##4{% + \advancenumber{sec\thissecnum}% + \def\thissubsecnum{##2}% + }% + \def\numsubsubsecentry##1##2##3##4{% + \advancenumber{subsec\thissubsecnum}% + }% + \let\thischapnum\empty + \let\thissecnum\empty + \let\thissubsecnum\empty + % + % use \def rather than \let here because we redefine \chapentry et + % al. a second time, below. + \def\appentry{\numchapentry}% + \def\appsecentry{\numsecentry}% + \def\appsubsecentry{\numsubsecentry}% + \def\appsubsubsecentry{\numsubsubsecentry}% + \def\unnchapentry{\numchapentry}% + \def\unnsecentry{\numsecentry}% + \def\unnsubsecentry{\numsubsecentry}% + \def\unnsubsubsecentry{\numsubsubsecentry}% + \input \jobname.toc + % + % Read toc second time, this time actually producing the outlines. + % The `-' means take the \expnumber as the absolute number of + % subentries, which we calculated on our first read of the .toc above. + % + % We use the node names as the destinations. + \def\numchapentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% + \def\numsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% + \def\numsubsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% + \def\numsubsubsecentry##1##2##3##4{% count is always zero + \dopdfoutline{##1}{}{##3}{##4}}% + % + % PDF outlines are displayed using system fonts, instead of + % document fonts. Therefore we cannot use special characters, + % since the encoding is unknown. For example, the eogonek from + % Latin 2 (0xea) gets translated to a | character. Info from + % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. + % + % xx to do this right, we have to translate 8-bit characters to + % their "best" equivalent, based on the @documentencoding. Right + % now, I guess we'll just let the pdf reader have its way. + \indexnofonts + \turnoffactive + \input \jobname.toc + \endgroup + } + % + \def\makelinks #1,{% + \def\params{#1}\def\E{END}% + \ifx\params\E + \let\nextmakelinks=\relax + \else + \let\nextmakelinks=\makelinks + \ifnum\lnkcount>0,\fi + \picknum{#1}% + \startlink attr{/Border [0 0 0]} + goto name{\pdfmkpgn{\the\pgn}}% + \linkcolor #1% + \advance\lnkcount by 1% + \endlink + \fi + \nextmakelinks + } + \def\picknum#1{\expandafter\pn#1} + \def\pn#1{% + \def\p{#1}% + \ifx\p\lbrace + \let\nextpn=\ppn + \else + \let\nextpn=\ppnn + \def\first{#1} + \fi + \nextpn + } + \def\ppn#1{\pgn=#1\gobble} + \def\ppnn{\pgn=\first} + \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,} + \def\skipspaces#1{\def\PP{#1}\def\D{|}% + \ifx\PP\D\let\nextsp\relax + \else\let\nextsp\skipspaces + \ifx\p\space\else\addtokens{\filename}{\PP}% + \advance\filenamelength by 1 + \fi + \fi + \nextsp} + \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} + \ifnum\pdftexversion < 14 + \let \startlink \pdfannotlink + \else + \let \startlink \pdfstartlink + \fi + \def\pdfurl#1{% + \begingroup + \normalturnoffactive\def\@{@}% + \makevalueexpandable + \leavevmode\Red + \startlink attr{/Border [0 0 0]}% + user{/Subtype /Link /A << /S /URI /URI (#1) >>}% + \endgroup} + \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} + \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} + \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} + \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} + \def\maketoks{% + \expandafter\poptoks\the\toksA|ENDTOKS|\relax + \ifx\first0\adn0 + \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 + \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 + \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 + \else + \ifnum0=\countA\else\makelink\fi + \ifx\first.\let\next=\done\else + \let\next=\maketoks + \addtokens{\toksB}{\the\toksD} + \ifx\first,\addtokens{\toksB}{\space}\fi + \fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \next} + \def\makelink{\addtokens{\toksB}% + {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} + \def\pdflink#1{% + \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} + \linkcolor #1\endlink} + \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} +\else + \let\pdfmkdest = \gobble + \let\pdfurl = \gobble + \let\endlink = \relax + \let\linkcolor = \relax + \let\pdfmakeoutlines = \relax +\fi % \ifx\pdfoutput + + \message{fonts,} -% Font-change commands. + +% Change the current font style to #1, remembering it in \curfontstyle. +% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in +% italics, not bold italics. +% +\def\setfontstyle#1{% + \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. + \csname ten#1\endcsname % change the current font +} + +% Select #1 fonts with the current style. +% +\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} + +\def\rm{\fam=0 \setfontstyle{rm}} +\def\it{\fam=\itfam \setfontstyle{it}} +\def\sl{\fam=\slfam \setfontstyle{sl}} +\def\bf{\fam=\bffam \setfontstyle{bf}} +\def\tt{\fam=\ttfam \setfontstyle{tt}} % Texinfo sort of supports the sans serif font style, which plain TeX does not. -% So we set up a \sf analogous to plain's \rm, etc. +% So we set up a \sf. \newfam\sffam -\def\sf{\fam=\sffam \tensf} +\def\sf{\fam=\sffam \setfontstyle{sf}} \let\li = \sf % Sometimes we call it \li, not \sf. -% We don't need math for this one. -\def\ttsl{\tenttsl} +% We don't need math for this font style. +\def\ttsl{\setfontstyle{ttsl}} -% Use Computer Modern fonts at \magstephalf (11pt). -\newcount\mainmagstep -\mainmagstep=\magstephalf +% Default leading. +\newdimen\textleading \textleading = 13.2pt + +% Set the baselineskip to #1, and the lineskip and strut size +% correspondingly. There is no deep meaning behind these magic numbers +% used as factors; they just match (closely enough) what Knuth defined. +% +\def\lineskipfactor{.08333} +\def\strutheightpercent{.70833} +\def\strutdepthpercent {.29167} +% +\def\setleading#1{% + \normalbaselineskip = #1\relax + \normallineskip = \lineskipfactor\normalbaselineskip + \normalbaselines + \setbox\strutbox =\hbox{% + \vrule width0pt height\strutheightpercent\baselineskip + depth \strutdepthpercent \baselineskip + }% +} % Set the font macro #1 to the font named #2, adding on the % specified font prefix (normally `cm'). @@ -1165,17 +1467,18 @@ where each line of input produces a line of output.} \def\scshape{csc} \def\scbshape{csc} +% Text fonts (11.2pt, magstep1). +\newcount\mainmagstep \ifx\bigger\relax -\let\mainmagstep=\magstep1 -\setfont\textrm\rmshape{12}{1000} -\setfont\texttt\ttshape{12}{1000} + % not really supported. + \mainmagstep=\magstep1 + \setfont\textrm\rmshape{12}{1000} + \setfont\texttt\ttshape{12}{1000} \else -\setfont\textrm\rmshape{10}{\mainmagstep} -\setfont\texttt\ttshape{10}{\mainmagstep} + \mainmagstep=\magstephalf + \setfont\textrm\rmshape{10}{\mainmagstep} + \setfont\texttt\ttshape{10}{\mainmagstep} \fi -% Instead of cmb10, you many want to use cmbx10. -% cmbx10 is a prettier font on its own, but cmb10 -% looks better when embedded in a line with cmr10. \setfont\textbf\bfshape{10}{\mainmagstep} \setfont\textit\itshape{10}{\mainmagstep} \setfont\textsl\slshape{10}{\mainmagstep} @@ -1185,30 +1488,37 @@ where each line of input produces a line of output.} \font\texti=cmmi10 scaled \mainmagstep \font\textsy=cmsy10 scaled \mainmagstep -% A few fonts for @defun, etc. -\setfont\defbf\bxshape{10}{\magstep1} %was 1314 +% A few fonts for @defun names and args. +\setfont\defbf\bfshape{10}{\magstep1} \setfont\deftt\ttshape{10}{\magstep1} -\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf} +\setfont\defttsl\ttslshape{10}{\magstep1} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} -% Fonts for indices and small examples (9pt). -% We actually use the slanted font rather than the italic, -% because texinfo normally uses the slanted fonts for that. -% Do not make many font distinctions in general in the index, since they -% aren't very useful. -\setfont\ninett\ttshape{9}{1000} -\setfont\ninettsl\ttslshape{10}{900} -\setfont\indrm\rmshape{9}{1000} -\setfont\indit\itshape{9}{1000} -\setfont\indsl\slshape{9}{1000} -\let\indtt=\ninett -\let\indttsl=\ninettsl -\let\indsf=\indrm -\let\indbf=\indrm -\setfont\indsc\scshape{10}{900} -\font\indi=cmmi9 -\font\indsy=cmsy9 +% Fonts for indices, footnotes, small examples (9pt). +\setfont\smallrm\rmshape{9}{1000} +\setfont\smalltt\ttshape{9}{1000} +\setfont\smallbf\bfshape{10}{900} +\setfont\smallit\itshape{9}{1000} +\setfont\smallsl\slshape{9}{1000} +\setfont\smallsf\sfshape{9}{1000} +\setfont\smallsc\scshape{10}{900} +\setfont\smallttsl\ttslshape{10}{900} +\font\smalli=cmmi9 +\font\smallsy=cmsy9 -% Fonts for title page: +% Fonts for small examples (8pt). +\setfont\smallerrm\rmshape{8}{1000} +\setfont\smallertt\ttshape{8}{1000} +\setfont\smallerbf\bfshape{10}{800} +\setfont\smallerit\itshape{8}{1000} +\setfont\smallersl\slshape{8}{1000} +\setfont\smallersf\sfshape{8}{1000} +\setfont\smallersc\scshape{10}{800} +\setfont\smallerttsl\ttslshape{10}{800} +\font\smalleri=cmmi8 +\font\smallersy=cmsy8 + +% Fonts for title page (20.4pt): \setfont\titlerm\rmbshape{12}{\magstep3} \setfont\titleit\itbshape{10}{\magstep4} \setfont\titlesl\slbshape{10}{\magstep4} @@ -1220,6 +1530,7 @@ where each line of input produces a line of output.} \font\titlei=cmmi12 scaled \magstep3 \font\titlesy=cmsy10 scaled \magstep4 \def\authorrm{\secrm} +\def\authortt{\sectt} % Chapter (and unnumbered) fonts (17.28pt). \setfont\chaprm\rmbshape{12}{\magstep2} @@ -1245,20 +1556,6 @@ where each line of input produces a line of output.} \font\seci=cmmi12 scaled \magstep1 \font\secsy=cmsy10 scaled \magstep2 -% \setfont\ssecrm\bxshape{10}{\magstep1} % This size an font looked bad. -% \setfont\ssecit\itshape{10}{\magstep1} % The letters were too crowded. -% \setfont\ssecsl\slshape{10}{\magstep1} -% \setfont\ssectt\ttshape{10}{\magstep1} -% \setfont\ssecsf\sfshape{10}{\magstep1} - -%\setfont\ssecrm\bfshape{10}{1315} % Note the use of cmb rather than cmbx. -%\setfont\ssecit\itshape{10}{1315} % Also, the size is a little larger than -%\setfont\ssecsl\slshape{10}{1315} % being scaled magstep1. -%\setfont\ssectt\ttshape{10}{1315} -%\setfont\ssecsf\sfshape{10}{1315} - -%\let\ssecbf=\ssecrm - % Subsection fonts (13.15pt). \setfont\ssecrm\rmbshape{12}{\magstephalf} \setfont\ssecit\itbshape{10}{1315} @@ -1267,68 +1564,124 @@ where each line of input produces a line of output.} \setfont\ssecttsl\ttslshape{10}{1315} \setfont\ssecsf\sfbshape{12}{\magstephalf} \let\ssecbf\ssecrm -\setfont\ssecsc\scbshape{10}{\magstep1} +\setfont\ssecsc\scbshape{10}{1315} \font\sseci=cmmi12 scaled \magstephalf \font\ssecsy=cmsy10 scaled 1315 -% The smallcaps and symbol fonts should actually be scaled \magstep1.5, -% but that is not a standard magnification. + +% Reduced fonts for @acro in text (10pt). +\setfont\reducedrm\rmshape{10}{1000} +\setfont\reducedtt\ttshape{10}{1000} +\setfont\reducedbf\bfshape{10}{1000} +\setfont\reducedit\itshape{10}{1000} +\setfont\reducedsl\slshape{10}{1000} +\setfont\reducedsf\sfshape{10}{1000} +\setfont\reducedsc\scshape{10}{1000} +\setfont\reducedttsl\ttslshape{10}{1000} +\font\reducedi=cmmi10 +\font\reducedsy=cmsy10 % In order for the font changes to affect most math symbols and letters, % we have to define the \textfont of the standard families. Since -% texinfo doesn't allow for producing subscripts and superscripts, we -% don't bother to reset \scriptfont and \scriptscriptfont (which would -% also require loading a lot more fonts). +% texinfo doesn't allow for producing subscripts and superscripts except +% in the main text, we don't bother to reset \scriptfont and +% \scriptscriptfont (which would also require loading a lot more fonts). % \def\resetmathfonts{% - \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy - \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf - \textfont\ttfam = \tentt \textfont\sffam = \tensf + \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy + \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf + \textfont\ttfam=\tentt \textfont\sffam=\tensf } - % The font-changing commands redefine the meanings of \tenSTYLE, instead -% of just \STYLE. We do this so that font changes will continue to work -% in math mode, where it is the current \fam that is relevant in most -% cases, not the current font. Plain TeX does \def\bf{\fam=\bffam -% \tenbf}, for example. By redefining \tenbf, we obviate the need to -% redefine \bf itself. +% of just \STYLE. We do this because \STYLE needs to also set the +% current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire +% \tenSTYLE to set the current font. +% +% Each font-changing command also sets the names \lsize (one size lower) +% and \lllsize (three sizes lower). These relative commands are used in +% the LaTeX logo and acronyms. +% +% This all needs generalizing, badly. +% \def\textfonts{% \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc - \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl - \resetmathfonts} + \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy + \let\tenttsl=\textttsl + \def\lsize{reduced}\def\lllsize{smaller}% + \resetmathfonts \setleading{\textleading}} \def\titlefonts{% \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy \let\tenttsl=\titlettsl + \def\lsize{chap}\def\lllsize{subsec}% \resetmathfonts \setleading{25pt}} \def\titlefont#1{{\titlefonts\rm #1}} \def\chapfonts{% \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl + \def\lsize{sec}\def\lllsize{text}% \resetmathfonts \setleading{19pt}} \def\secfonts{% \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc - \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl + \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy + \let\tenttsl=\secttsl + \def\lsize{subsec}\def\lllsize{reduced}% \resetmathfonts \setleading{16pt}} \def\subsecfonts{% \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc - \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl + \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy + \let\tenttsl=\ssecttsl + \def\lsize{text}\def\lllsize{small}% \resetmathfonts \setleading{15pt}} -\let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf? -\def\indexfonts{% - \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl - \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc - \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy \let\tenttsl=\indttsl - \resetmathfonts \setleading{12pt}} +\let\subsubsecfonts = \subsecfonts +\def\reducedfonts{% + \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl + \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc + \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy + \let\tenttsl=\reducedttsl + \def\lsize{small}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} +\def\smallfonts{% + \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl + \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc + \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy + \let\tenttsl=\smallttsl + \def\lsize{smaller}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} +\def\smallerfonts{% + \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl + \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc + \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy + \let\tenttsl=\smallerttsl + \def\lsize{smaller}\def\lllsize{smaller}% + \resetmathfonts \setleading{9.5pt}} + +% Set the fonts to use with the @small... environments. +\let\smallexamplefonts = \smallfonts + +% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample +% can fit this many characters: +% 8.5x11=86 smallbook=72 a4=90 a5=69 +% If we use \scriptfonts (8pt), then we can fit this many characters: +% 8.5x11=90+ smallbook=80 a4=90+ a5=77 +% For me, subjectively, the few extra characters that fit aren't worth +% the additional smallness of 8pt. So I'm making the default 9pt. +% +% By the way, for comparison, here's what fits with @example (10pt): +% 8.5x11=71 smallbook=60 a4=75 a5=58 +% +% I wish the USA used A4 paper. +% --karl, 24jan03. + % Set up the default fonts, so we can use them for creating boxes. % -\textfonts +\textfonts \rm % Define these so they can be easily changed for other fonts. \def\angleleft{$\langle$} @@ -1339,23 +1692,32 @@ where each line of input produces a line of output.} % Fonts for short table of contents. \setfont\shortcontrm\rmshape{12}{1000} -\setfont\shortcontbf\bxshape{12}{1000} +\setfont\shortcontbf\bfshape{10}{\magstep1} % no cmb12 \setfont\shortcontsl\slshape{12}{1000} +\setfont\shortconttt\ttshape{12}{1000} %% Add scribe-like font environments, plus @l for inline lisp (usually sans %% serif) and @ii for TeX italic % \smartitalic{ARG} outputs arg in italics, followed by an italic correction % unless the following character is such as not to need one. -\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi} -\def\smartslanted#1{{\sl #1}\futurelet\next\smartitalicx} -\def\smartitalic#1{{\it #1}\futurelet\next\smartitalicx} +\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else + \ptexslash\fi\fi\fi} +\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx} +\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx} + +% like \smartslanted except unconditionally uses \ttsl. +% @var is set to this for defun arguments. +\def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx} + +% like \smartslanted except unconditionally use \sl. We never want +% ttsl for book titles, do we? +\def\cite#1{{\sl #1}\futurelet\next\smartitalicx} \let\i=\smartitalic \let\var=\smartslanted \let\dfn=\smartslanted \let\emph=\smartitalic -\let\cite=\smartslanted \def\b#1{{\bf #1}} \let\strong=\b @@ -1367,15 +1729,25 @@ where each line of input produces a line of output.} \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} \def\restorehyphenation{\hyphenchar\font = `- } +% Set sfcode to normal for the chars that usually have another value. +% Can't use plain's \frenchspacing because it uses the `\x notation, and +% sometimes \x has an active definition that messes things up. +% +\catcode`@=11 + \def\frenchspacing{% + \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m + \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m + } +\catcode`@=\other + \def\t#1{% {\tt \rawbackslash \frenchspacing #1}% \null } -\let\ttfont=\t \def\samp#1{`\tclose{#1}'\null} -\setfont\smallrm\rmshape{8}{1000} -\font\smallsy=cmsy9 -\def\key#1{{\smallrm\textfont2=\smallsy \leavevmode\hbox{% +\setfont\keyrm\rmshape{8}{1000} +\font\keysy=cmsy9 +\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% \vbox{\hrule\kern-0.4pt \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% @@ -1412,7 +1784,7 @@ where each line of input produces a line of output.} \null } -% We *must* turn on hyphenation at `-' and `_' in \code. +% We *must* turn on hyphenation at `-' and `_' in @code. % Otherwise, it is too hard to avoid overfull hboxes % in the Emacs manual, the Library manual, etc. @@ -1430,27 +1802,30 @@ where each line of input produces a line of output.} \catcode`\_=\active \let_\codeunder \codex } - % - % If we end up with any active - characters when handling the index, - % just treat them as a normal -. - \global\def\indexbreaks{\catcode`\-=\active \let-\realdash} } \def\realdash{-} \def\codedash{-\discretionary{}{}{}} -\def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}} +\def\codeunder{% + % this is all so @math{@code{var_name}+1} can work. In math mode, _ + % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) + % will therefore expand the active definition of _, which is us + % (inside @code that is), therefore an endless loop. + \ifusingtt{\ifmmode + \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. + \else\normalunderscore \fi + \discretionary{}{}{}}% + {\_}% +} \def\codex #1{\tclose{#1}\endgroup} -%\let\exp=\tclose %Was temporary - % @kbd is like @code, except that if the argument is just one @key command, % then @kbd has no effect. % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), % `example' (@kbd uses ttsl only inside of @example and friends), % or `code' (@kbd uses normal tty font always). -\def\kbdinputstyle{\parsearg\kbdinputstylexxx} -\def\kbdinputstylexxx#1{% +\parseargdef\kbdinputstyle{% \def\arg{#1}% \ifx\arg\worddistinct \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% @@ -1458,15 +1833,17 @@ where each line of input produces a line of output.} \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% \else\ifx\arg\wordcode \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% + \else + \errhelp = \EMsimple + \errmessage{Unknown @kbdinputstyle option `\arg'}% \fi\fi\fi } \def\worddistinct{distinct} \def\wordexample{example} \def\wordcode{code} -% Default is kbdinputdistinct. (Too much of a hassle to call the macro, -% the catcodes are wrong for parsearg to work.) -\gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl} +% Default is `distinct.' +\kbdinputstyle distinct \def\xkey{\key} \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% @@ -1474,29 +1851,59 @@ where each line of input produces a line of output.} \else{\tclose{\kbdfont\look}}\fi \else{\tclose{\kbdfont\look}}\fi} -% For @url, @env, @command quotes seem unnecessary, so use \code. -\let\url=\code +% For @indicateurl, @env, @command quotes seem unnecessary, so use \code. +\let\indicateurl=\code \let\env=\code \let\command=\code -% @uref (abbreviation for `urlref') takes an optional second argument -% specifying the text to display. First (mandatory) arg is the url. -% Perhaps eventually put in a hypertex \special here. -% -\def\uref#1{\urefxxx #1,,\finish} -\def\urefxxx#1,#2,#3\finish{% - \setbox0 = \hbox{\ignorespaces #2}% +% @uref (abbreviation for `urlref') takes an optional (comma-separated) +% second argument specifying the text to display and an optional third +% arg as text to display instead of (rather than in addition to) the url +% itself. First (mandatory) arg is the url. Perhaps eventually put in +% a hypertex \special here. +% +\def\uref#1{\douref #1,,,\finish} +\def\douref#1,#2,#3,#4\finish{\begingroup + \unsepspaces + \pdfurl{#1}% + \setbox0 = \hbox{\ignorespaces #3}% \ifdim\wd0 > 0pt - \unhbox0\ (\code{#1})% + \unhbox0 % third arg given, show only that \else - \code{#1}% + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \ifpdf + \unhbox0 % PDF: 2nd arg given, show only it + \else + \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url + \fi + \else + \code{#1}% only url given, so show it + \fi \fi -} + \endlink +\endgroup} -% rms does not like the angle brackets --karl, 17may97. -% So now @email is just like @uref. +% @url synonym for @uref, since that's how everyone uses it. +% +\let\url=\uref + +% rms does not like angle brackets --karl, 17may97. +% So now @email is just like @uref, unless we are pdf. +% %\def\email#1{\angleleft{\tt #1}\angleright} -\let\email=\uref +\ifpdf + \def\email#1{\doemail#1,,\finish} + \def\doemail#1,#2,#3\finish{\begingroup + \unsepspaces + \pdfurl{mailto:#1}% + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi + \endlink + \endgroup} +\else + \let\email=\uref +\fi % Check if we are currently using a typewriter font. Since all the % Computer Modern typewriter fonts have zero interword stretch (and @@ -1522,12 +1929,37 @@ where each line of input produces a line of output.} \def\sc#1{{\smallcaps#1}} % smallcaps font \def\ii#1{{\it #1}} % italic font -% @acronym downcases the argument and prints in smallcaps. -\def\acronym#1{{\smallcaps \lowercase{#1}}} +\def\acronym#1{\doacronym #1,,\finish} +\def\doacronym#1,#2,#3\finish{% + {\selectfonts\lsize #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi +} -% @pounds{} is a sterling sign. +% @pounds{} is a sterling sign, which is in the CM italic font. +% \def\pounds{{\it\$}} +% @registeredsymbol - R in a circle. The font for the R should really +% be smaller yet, but lllsize is the best we can do for now. +% Adapted from the plain.tex definition of \copyright. +% +\def\registeredsymbol{% + $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% + \hfil\crcr\Orb}}% + }$% +} + +% Laurent Siebenmann reports \Orb undefined with: +% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 +% so we'll define it if necessary. +% +\ifx\Orb\undefined +\def\Orb{\mathhexbox20D} +\fi + \message{page headings,} @@ -1540,90 +1972,109 @@ where each line of input produces a line of output.} % Do an implicit @contents or @shortcontents after @end titlepage if the % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. -% +% \newif\ifsetcontentsaftertitlepage \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue \newif\ifsetshortcontentsaftertitlepage \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue -\def\shorttitlepage{\parsearg\shorttitlepagezzz} -\def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% +\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% \endgroup\page\hbox{}\page} -\def\titlepage{\begingroup \parindent=0pt \textfonts - \let\subtitlerm=\tenrm - \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}% - % - \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}% - % - % Leave some space at the very top of the page. - \vglue\titlepagetopglue - % - % Now you can print the title using @title. - \def\title{\parsearg\titlezzz}% - \def\titlezzz##1{\leftline{\titlefonts\rm ##1} - % print a rule at the page bottom also. - \finishedtitlepagefalse - \vskip4pt \hrule height 4pt width \hsize \vskip4pt}% - % No rule at page bottom unless we print one at the top with @title. - \finishedtitlepagetrue - % - % Now you can put text using @subtitle. - \def\subtitle{\parsearg\subtitlezzz}% - \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}% - % - % @author should come last, but may come many times. - \def\author{\parsearg\authorzzz}% - \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi - {\authorfont \leftline{##1}}}% - % - % Most title ``pages'' are actually two pages long, with space - % at the top of the second. We don't want the ragged left on the second. - \let\oldpage = \page - \def\page{% +\envdef\titlepage{% + % Open one extra group, as we want to close it in the middle of \Etitlepage. + \begingroup + \parindent=0pt \textfonts + % Leave some space at the very top of the page. + \vglue\titlepagetopglue + % No rule at page bottom unless we print one at the top with @title. + \finishedtitlepagetrue + % + % Most title ``pages'' are actually two pages long, with space + % at the top of the second. We don't want the ragged left on the second. + \let\oldpage = \page + \def\page{% \iffinishedtitlepage\else - \finishtitlepage + \finishtitlepage \fi - \oldpage \let\page = \oldpage - \hbox{}}% -% \def\page{\oldpage \hbox{}} + \page + \null + }% } \def\Etitlepage{% - \iffinishedtitlepage\else - \finishtitlepage - \fi - % It is important to do the page break before ending the group, - % because the headline and footline are only empty inside the group. - % If we use the new definition of \page, we always get a blank page - % after the title page, which we certainly don't want. - \oldpage - \endgroup - % - % If they want short, they certainly want long too. - \ifsetshortcontentsaftertitlepage - \shortcontents - \contents - \global\let\shortcontents = \relax - \global\let\contents = \relax - \fi - % - \ifsetcontentsaftertitlepage - \contents - \global\let\contents = \relax - \global\let\shortcontents = \relax - \fi - % - \HEADINGSon + \iffinishedtitlepage\else + \finishtitlepage + \fi + % It is important to do the page break before ending the group, + % because the headline and footline are only empty inside the group. + % If we use the new definition of \page, we always get a blank page + % after the title page, which we certainly don't want. + \oldpage + \endgroup + % + % Need this before the \...aftertitlepage checks so that if they are + % in effect the toc pages will come out with page numbers. + \HEADINGSon + % + % If they want short, they certainly want long too. + \ifsetshortcontentsaftertitlepage + \shortcontents + \contents + \global\let\shortcontents = \relax + \global\let\contents = \relax + \fi + % + \ifsetcontentsaftertitlepage + \contents + \global\let\contents = \relax + \global\let\shortcontents = \relax + \fi } \def\finishtitlepage{% - \vskip4pt \hrule height 2pt width \hsize - \vskip\titlepagebottomglue - \finishedtitlepagetrue + \vskip4pt \hrule height 2pt width \hsize + \vskip\titlepagebottomglue + \finishedtitlepagetrue } +%%% Macros to be used within @titlepage: + +\let\subtitlerm=\tenrm +\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} + +\def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines + \let\tt=\authortt} + +\parseargdef\title{% + \checkenv\titlepage + \leftline{\titlefonts\rm #1} + % print a rule at the page bottom also. + \finishedtitlepagefalse + \vskip4pt \hrule height 4pt width \hsize \vskip4pt +} + +\parseargdef\subtitle{% + \checkenv\titlepage + {\subtitlefont \rightline{#1}}% +} + +% @author should come last, but may come many times. +% It can also be used inside @quotation. +% +\parseargdef\author{% + \def\temp{\quotation}% + \ifx\thisenv\temp + \def\quotationauthor{#1}% printed in \Equotation. + \else + \checkenv\titlepage + \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi + {\authorfont \leftline{#1}}% + \fi +} + + %%% Set up page headings and footings. \let\thispage=\folio @@ -1633,7 +2084,7 @@ where each line of input produces a line of output.} \newtoks\evenfootline % footline on even pages \newtoks\oddfootline % footline on odd pages -% Now make Tex use those variables +% Now make TeX use those variables \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline \else \the\evenheadline \fi}} \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline @@ -1647,32 +2098,27 @@ where each line of input produces a line of output.} % @evenfooting @thisfile|| % @oddfooting ||@thisfile + \def\evenheading{\parsearg\evenheadingxxx} -\def\oddheading{\parsearg\oddheadingxxx} -\def\everyheading{\parsearg\everyheadingxxx} - -\def\evenfooting{\parsearg\evenfootingxxx} -\def\oddfooting{\parsearg\oddfootingxxx} -\def\everyfooting{\parsearg\everyfootingxxx} - -{\catcode`\@=0 % - -\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish} -\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{% +\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} +\def\evenheadingyyy #1\|#2\|#3\|#4\finish{% \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} -\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish} -\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{% +\def\oddheading{\parsearg\oddheadingxxx} +\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} +\def\oddheadingyyy #1\|#2\|#3\|#4\finish{% \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} -\gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}% +\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% -\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish} -\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{% +\def\evenfooting{\parsearg\evenfootingxxx} +\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} +\def\evenfootingyyy #1\|#2\|#3\|#4\finish{% \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} -\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish} -\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{% +\def\oddfooting{\parsearg\oddfootingxxx} +\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} +\def\oddfootingyyy #1\|#2\|#3\|#4\finish{% \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% % % Leave some space for the footline. Hopefully ok to assume @@ -1681,9 +2127,8 @@ where each line of input produces a line of output.} \global\advance\vsize by -\baselineskip } -\gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}} -% -}% unbind the catcode of @. +\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} + % @headings double turns headings on for double-sided printing. % @headings single turns headings on for single-sided printing. @@ -1697,7 +2142,7 @@ where each line of input produces a line of output.} \def\headings #1 {\csname HEADINGS#1\endcsname} -\def\HEADINGSoff{ +\def\HEADINGSoff{% \global\evenheadline={\hfil} \global\evenfootline={\hfil} \global\oddheadline={\hfil} \global\oddfootline={\hfil}} \HEADINGSoff @@ -1706,7 +2151,7 @@ where each line of input produces a line of output.} % chapter name on inside top of right hand pages, document % title on inside top of left hand pages, and page numbers on outside top % edge of all pages. -\def\HEADINGSdouble{ +\def\HEADINGSdouble{% \global\pageno=1 \global\evenfootline={\hfil} \global\oddfootline={\hfil} @@ -1718,7 +2163,7 @@ where each line of input produces a line of output.} % For single-sided printing, chapter title goes across top left of page, % page number on top right. -\def\HEADINGSsingle{ +\def\HEADINGSsingle{% \global\pageno=1 \global\evenfootline={\hfil} \global\oddfootline={\hfil} @@ -1748,29 +2193,28 @@ where each line of input produces a line of output.} } % Subroutines used in generating headings -% Produces Day Month Year style of output. -\def\today{\number\day\space -\ifcase\month\or -January\or February\or March\or April\or May\or June\or -July\or August\or September\or October\or November\or December\fi -\space\number\year} +% This produces Day Month Year style of output. +% Only define if not already defined, in case a txi-??.tex file has set +% up a different format (e.g., txi-cs.tex does this). +\ifx\today\undefined +\def\today{% + \number\day\space + \ifcase\month + \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr + \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug + \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec + \fi + \space\number\year} +\fi -% Use this if you want the Month Day, Year style of output. -%\def\today{\ifcase\month\or -%January\or February\or March\or April\or May\or June\or -%July\or August\or September\or October\or November\or December\fi -%\space\number\day, \number\year} - -% @settitle line... specifies the title of the document, for headings -% It generates no output of its own - -\def\thistitle{No Title} -\def\settitle{\parsearg\settitlezzz} -\def\settitlezzz #1{\gdef\thistitle{#1}} +% @settitle line... specifies the title of the document, for headings. +% It generates no output of its own. +\def\thistitle{\putwordNoTitle} +\def\settitle{\parsearg{\gdef\thistitle}} \message{tables,} -% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x). +% Tables -- @table, @ftable, @vtable, @item(x). % default indentation of table text \newdimen\tableindent \tableindent=.8in @@ -1782,7 +2226,7 @@ July\or August\or September\or October\or November\or December\fi % used internally for \itemindent minus \itemmargin \newdimen\itemmax -% Note @table, @vtable, and @vtable define @item, @itemx, etc., with +% Note @table, @ftable, and @vtable define @item, @itemx, etc., with % these defs. % They also define \itemindex % to index the item name in whatever manner is desired (perhaps none). @@ -1794,22 +2238,10 @@ July\or August\or September\or October\or November\or December\fi \def\internalBitem{\smallbreak \parsearg\itemzzz} \def\internalBitemx{\itemxpar \parsearg\itemzzz} -\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz} -\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz} - -\def\internalBkitem{\smallbreak \parsearg\kitemzzz} -\def\internalBkitemx{\itemxpar \parsearg\kitemzzz} - -\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}% - \itemzzz {#1}} - -\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}% - \itemzzz {#1}} - \def\itemzzz #1{\begingroup % \advance\hsize by -\rightskip \advance\hsize by -\tableindent - \setbox0=\hbox{\itemfont{#1}}% + \setbox0=\hbox{\itemindicate{#1}}% \itemindex{#1}% \nobreak % This prevents a break before @itemx. % @@ -1833,15 +2265,23 @@ July\or August\or September\or October\or November\or December\fi % \parskip glue -- logically it's part of the @item we just started. \nobreak \vskip-\parskip % - % Stop a page break at the \parskip glue coming up. Unfortunately + % Stop a page break at the \parskip glue coming up. (Unfortunately % we can't prevent a possible page break at the following - % \baselineskip glue. - \nobreak + % \baselineskip glue.) However, if what follows is an environment + % such as @example, there will be no \parskip glue; then + % the negative vskip we just would cause the example and the item to + % crash together. So we use this bizarre value of 10001 as a signal + % to \aboveenvbreak to insert \parskip glue after all. + % (Possibly there are other commands that could be followed by + % @example which need the same treatment, but not section titles; or + % maybe section titles are the only special case and they should be + % penalty 10001...) + \penalty 10001 \endgroup \itemxneedsnegativevskipfalse \else % The item text fits into the space. Start a paragraph, so that the - % following text (if any) will end up on the same line. + % following text (if any) will end up on the same line. \noindent % Do this with kerns and \unhbox so that if there is a footnote in % the item text, it can migrate to the main vertical list and @@ -1855,97 +2295,95 @@ July\or August\or September\or October\or November\or December\fi \fi } -\def\item{\errmessage{@item while not in a table}} -\def\itemx{\errmessage{@itemx while not in a table}} -\def\kitem{\errmessage{@kitem while not in a table}} -\def\kitemx{\errmessage{@kitemx while not in a table}} -\def\xitem{\errmessage{@xitem while not in a table}} -\def\xitemx{\errmessage{@xitemx while not in a table}} - -% Contains a kludge to get @end[description] to work. -\def\description{\tablez{\dontindex}{1}{}{}{}{}} +\def\item{\errmessage{@item while not in a list environment}} +\def\itemx{\errmessage{@itemx while not in a list environment}} % @table, @ftable, @vtable. -\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex} -{\obeylines\obeyspaces% -\gdef\tablex #1^^M{% -\tabley\dontindex#1 \endtabley}} - -\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex} -{\obeylines\obeyspaces% -\gdef\ftablex #1^^M{% -\tabley\fnitemindex#1 \endtabley -\def\Eftable{\endgraf\afterenvbreak\endgroup}% -\let\Etable=\relax}} - -\def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex} -{\obeylines\obeyspaces% -\gdef\vtablex #1^^M{% -\tabley\vritemindex#1 \endtabley -\def\Evtable{\endgraf\afterenvbreak\endgroup}% -\let\Etable=\relax}} - -\def\dontindex #1{} -\def\fnitemindex #1{\doind {fn}{\code{#1}}}% -\def\vritemindex #1{\doind {vr}{\code{#1}}}% - -{\obeyspaces % -\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup% -\tablez{#1}{#2}{#3}{#4}{#5}{#6}}} - -\def\tablez #1#2#3#4#5#6{% -\aboveenvbreak % -\begingroup % -\def\Edescription{\Etable}% Necessary kludge. -\let\itemindex=#1% -\ifnum 0#3>0 \advance \leftskip by #3\mil \fi % -\ifnum 0#4>0 \tableindent=#4\mil \fi % -\ifnum 0#5>0 \advance \rightskip by #5\mil \fi % -\def\itemfont{#2}% -\itemmax=\tableindent % -\advance \itemmax by -\itemmargin % -\advance \leftskip by \tableindent % -\exdentamount=\tableindent -\parindent = 0pt -\parskip = \smallskipamount -\ifdim \parskip=0pt \parskip=2pt \fi% -\def\Etable{\endgraf\afterenvbreak\endgroup}% -\let\item = \internalBitem % -\let\itemx = \internalBitemx % -\let\kitem = \internalBkitem % -\let\kitemx = \internalBkitemx % -\let\xitem = \internalBxitem % -\let\xitemx = \internalBxitemx % +\envdef\table{% + \let\itemindex\gobble + \tablex } +\envdef\ftable{% + \def\itemindex ##1{\doind {fn}{\code{##1}}}% + \tablex +} +\envdef\vtable{% + \def\itemindex ##1{\doind {vr}{\code{##1}}}% + \tablex +} +\def\tablex#1{% + \def\itemindicate{#1}% + \parsearg\tabley +} +\def\tabley#1{% + {% + \makevalueexpandable + \edef\temp{\noexpand\tablez #1\space\space\space}% + \expandafter + }\temp \endtablez +} +\def\tablez #1 #2 #3 #4\endtablez{% + \aboveenvbreak + \ifnum 0#1>0 \advance \leftskip by #1\mil \fi + \ifnum 0#2>0 \tableindent=#2\mil \fi + \ifnum 0#3>0 \advance \rightskip by #3\mil \fi + \itemmax=\tableindent + \advance \itemmax by -\itemmargin + \advance \leftskip by \tableindent + \exdentamount=\tableindent + \parindent = 0pt + \parskip = \smallskipamount + \ifdim \parskip=0pt \parskip=2pt \fi + \let\item = \internalBitem + \let\itemx = \internalBitemx +} +\def\Etable{\endgraf\afterenvbreak} +\let\Eftable\Etable +\let\Evtable\Etable +\let\Eitemize\Etable +\let\Eenumerate\Etable % This is the counter used by @enumerate, which is really @itemize \newcount \itemno -\def\itemize{\parsearg\itemizezzz} +\envdef\itemize{\parsearg\doitemize} -\def\itemizezzz #1{% - \begingroup % ended by the @end itemize - \itemizey {#1}{\Eitemize} +\def\doitemize#1{% + \aboveenvbreak + \itemmax=\itemindent + \advance\itemmax by -\itemmargin + \advance\leftskip by \itemindent + \exdentamount=\itemindent + \parindent=0pt + \parskip=\smallskipamount + \ifdim\parskip=0pt \parskip=2pt \fi + \def\itemcontents{#1}% + % @itemize with no arg is equivalent to @itemize @bullet. + \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi + \let\item=\itemizeitem } -\def\itemizey #1#2{% -\aboveenvbreak % -\itemmax=\itemindent % -\advance \itemmax by -\itemmargin % -\advance \leftskip by \itemindent % -\exdentamount=\itemindent -\parindent = 0pt % -\parskip = \smallskipamount % -\ifdim \parskip=0pt \parskip=2pt \fi% -\def#2{\endgraf\afterenvbreak\endgroup}% -\def\itemcontents{#1}% -\let\item=\itemizeitem} - -% Set sfcode to normal for the chars that usually have another value. -% These are `.?!:;,' -\def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000 - \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 } +% Definition of @item while inside @itemize and @enumerate. +% +\def\itemizeitem{% + \advance\itemno by 1 % for enumerations + {\let\par=\endgraf \smallbreak}% reasonable place to break + {% + % If the document has an @itemize directly after a section title, a + % \nobreak will be last on the list, and \sectionheading will have + % done a \vskip-\parskip. In that case, we don't want to zero + % parskip, or the item text will crash with the heading. On the + % other hand, when there is normal text preceding the item (as there + % usually is), we do want to zero parskip, or there would be too much + % space. In that case, we won't have a \nobreak before. At least + % that's the theory. + \ifnum\lastpenalty<10000 \parskip=0in \fi + \noindent + \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% + \vadjust{\penalty 1200}}% not good to break after first line of item. + \flushcr +} % \splitoff TOKENS\endmark defines \first to be the first token in % TOKENS, and \rest to be the remainder. @@ -1956,11 +2394,8 @@ July\or August\or September\or October\or November\or December\fi % or number, to specify the first label in the enumerated list. No % argument is the same as `1'. % -\def\enumerate{\parsearg\enumeratezzz} -\def\enumeratezzz #1{\enumeratey #1 \endenumeratey} +\envparseargdef\enumerate{\enumeratey #1 \endenumeratey} \def\enumeratey #1 #2\endenumeratey{% - \begingroup % ended by the @end enumerate - % % If we were given no argument, pretend we were given `1'. \def\thearg{#1}% \ifx\thearg\empty \def\thearg{1}\fi @@ -2031,13 +2466,13 @@ July\or August\or September\or October\or November\or December\fi }% } -% Call itemizey, adding a period to the first argument and supplying the +% Call \doitemize, adding a period to the first argument and supplying the % common last two arguments. Also subtract one from the initial value in % \itemno, since @item increments \itemno. % \def\startenumeration#1{% \advance\itemno by -1 - \itemizey{#1.}\Eenumerate\flushcr + \doitemize{#1.}\flushcr } % @alphaenumerate and @capsenumerate are abbreviations for giving an arg @@ -2048,16 +2483,6 @@ July\or August\or September\or October\or November\or December\fi \def\Ealphaenumerate{\Eenumerate} \def\Ecapsenumerate{\Eenumerate} -% Definition of @item while inside @itemize. - -\def\itemizeitem{% -\advance\itemno by 1 -{\let\par=\endgraf \smallbreak}% -\ifhmode \errmessage{In hmode at itemizeitem}\fi -{\parskip=0in \hskip 0pt -\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}% -\vadjust{\penalty 1200}}% -\flushcr} % @multitable macros % Amy Hendrickson, 8/18/94, 3/6/96 @@ -2084,24 +2509,14 @@ July\or August\or September\or October\or November\or December\fi % @multitable {Column 1 template} {Column 2 template} {Column 3 template} % @item ... % using the widest term desired in each column. -% -% For those who want to use more than one line's worth of words in -% the preamble, break the line within one argument and it -% will parse correctly, i.e., -% -% @multitable {Column 1 template} {Column 2 template} {Column 3 -% template} -% Not: -% @multitable {Column 1 template} {Column 2 template} -% {Column 3 template} % Each new table line starts with @item, each subsequent new column % starts with @tab. Empty columns may be produced by supplying @tab's % with nothing between them for as many times as empty columns are needed, % ie, @tab@tab@tab will produce two empty columns. -% @item, @tab, @multitable or @end multitable do not need to be on their -% own lines, but it will not hurt if they are. +% @item, @tab do not need to be on their own lines, but it will not hurt +% if they are. % Sample multitable: @@ -2138,20 +2553,19 @@ July\or August\or September\or October\or November\or December\fi \multitablelinespace=0pt % Macros used to set up halign preamble: -% +% \let\endsetuptable\relax \def\xendsetuptable{\endsetuptable} \let\columnfractions\relax \def\xcolumnfractions{\columnfractions} \newif\ifsetpercent -% #1 is the part of the @columnfraction before the decimal point, which -% is presumably either 0 or the empty string (but we don't check, we -% just throw it away). #2 is the decimal part, which we use as the -% percent of \hsize for this column. -\def\pickupwholefraction#1.#2 {% +% #1 is the @columnfraction, usually a decimal number like .5, but might +% be just 1. We just use it, whatever it is. +% +\def\pickupwholefraction#1 {% \global\advance\colcount by 1 - \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}% + \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% \setuptable } @@ -2168,8 +2582,8 @@ July\or August\or September\or October\or November\or December\fi \let\go\pickupwholefraction \else \global\advance\colcount by 1 - \setbox0=\hbox{#1\unskip }% Add a normal word space as a separator; - % typically that is always in the input, anyway. + \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a + % separator; typically that is always in the input, anyway. \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% \fi \fi @@ -2184,17 +2598,30 @@ July\or August\or September\or October\or November\or December\fi \go } -% multitable syntax -\def\tab{&\hskip1sp\relax} % 2/2/96 - % tiny skip here makes sure this column space is - % maintained, even if it is never used. +% multitable-only commands. +% +% @headitem starts a heading row, which we typeset in bold. +% Assignments have to be global since we are inside the implicit group +% of an alignment entry. Note that \everycr resets \everytab. +\def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}% +% +% A \tab used to include \hskip1sp. But then the space in a template +% line is not enough. That is bad. So let's go back to just `&' until +% we encounter the problem it was intended to solve again. +% --karl, nathan@acm.org, 20apr99. +\def\tab{\checkenv\multitable &\the\everytab}% % @multitable ... @end multitable definitions: % -\def\multitable{\parsearg\dotable} -\def\dotable#1{\bgroup +\newtoks\everytab % insert after every tab. +% +\envdef\multitable{% \vskip\parskip + \startsavinginserts + % + % @item within a multitable starts a normal row. \let\item\crcr + % \tolerance=9500 \hbadness=9500 \setmultitablespacing @@ -2202,81 +2629,98 @@ July\or August\or September\or October\or November\or December\fi \parindent=\multitableparindent \overfullrule=0pt \global\colcount=0 - \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}% % + \everycr = {% + \noalign{% + \global\everytab={}% + \global\colcount=0 % Reset the column counter. + % Check for saved footnotes, etc. + \checkinserts + % Keeps underfull box messages off when table breaks over pages. + %\filbreak + % Maybe so, but it also creates really weird page breaks when the + % table breaks over pages. Wouldn't \vfil be better? Wait until the + % problem manifests itself, so it can be fixed for real --karl. + }% + }% + % + \parsearg\domultitable +} +\def\domultitable#1{% % To parse everything between @multitable and @item: \setuptable#1 \endsetuptable % - % \everycr will reset column counter, \colcount, at the end of - % each line. Every column entry will cause \colcount to advance by one. - % The table preamble - % looks at the current \colcount to find the correct column width. - \everycr{\noalign{% - % - % \filbreak%% keeps underfull box messages off when table breaks over pages. - % Maybe so, but it also creates really weird page breaks when the table - % breaks over pages. Wouldn't \vfil be better? Wait until the problem - % manifests itself, so it can be fixed for real --karl. - \global\colcount=0\relax}}% - % % This preamble sets up a generic column definition, which will % be used as many times as user calls for columns. % \vtop will set a single line and will also let text wrap and % continue for many paragraphs if desired. - \halign\bgroup&\global\advance\colcount by 1\relax - \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname - % - % In order to keep entries from bumping into each other - % we will add a \leftskip of \multitablecolspace to all columns after - % the first one. - % - % If a template has been used, we will add \multitablecolspace - % to the width of each template entry. - % - % If the user has set preamble in terms of percent of \hsize we will - % use that dimension as the width of the column, and the \leftskip - % will keep entries from bumping into each other. Table will start at - % left margin and final column will justify at right margin. - % - % Make sure we don't inherit \rightskip from the outer environment. - \rightskip=0pt - \ifnum\colcount=1 - % The first column will be indented with the surrounding text. - \advance\hsize by\leftskip - \else - \ifsetpercent \else - % If user has not set preamble in terms of percent of \hsize - % we will advance \hsize by \multitablecolspace. - \advance\hsize by \multitablecolspace - \fi - % In either case we will make \leftskip=\multitablecolspace: - \leftskip=\multitablecolspace - \fi - % Ignoring space at the beginning and end avoids an occasional spurious - % blank line, when TeX decides to break the line at the space before the - % box from the multistrut, so the strut ends up on a line by itself. - % For example: - % @multitable @columnfractions .11 .89 - % @item @code{#} - % @tab Legal holiday which is valid in major parts of the whole country. - % Is automatically provided with highlighting sequences respectively marking - % characters. - \noindent\ignorespaces##\unskip\multistrut}\cr + \halign\bgroup &% + \global\advance\colcount by 1 + \multistrut + \vtop{% + % Use the current \colcount to find the correct column width: + \hsize=\expandafter\csname col\the\colcount\endcsname + % + % In order to keep entries from bumping into each other + % we will add a \leftskip of \multitablecolspace to all columns after + % the first one. + % + % If a template has been used, we will add \multitablecolspace + % to the width of each template entry. + % + % If the user has set preamble in terms of percent of \hsize we will + % use that dimension as the width of the column, and the \leftskip + % will keep entries from bumping into each other. Table will start at + % left margin and final column will justify at right margin. + % + % Make sure we don't inherit \rightskip from the outer environment. + \rightskip=0pt + \ifnum\colcount=1 + % The first column will be indented with the surrounding text. + \advance\hsize by\leftskip + \else + \ifsetpercent \else + % If user has not set preamble in terms of percent of \hsize + % we will advance \hsize by \multitablecolspace. + \advance\hsize by \multitablecolspace + \fi + % In either case we will make \leftskip=\multitablecolspace: + \leftskip=\multitablecolspace + \fi + % Ignoring space at the beginning and end avoids an occasional spurious + % blank line, when TeX decides to break the line at the space before the + % box from the multistrut, so the strut ends up on a line by itself. + % For example: + % @multitable @columnfractions .11 .89 + % @item @code{#} + % @tab Legal holiday which is valid in major parts of the whole country. + % Is automatically provided with highlighting sequences respectively + % marking characters. + \noindent\ignorespaces##\unskip\multistrut + }\cr +} +\def\Emultitable{% + \crcr + \egroup % end the \halign + \global\setpercentfalse } \def\setmultitablespacing{% test to see if user has set \multitablelinespace. % If so, do nothing. If not, give it an appropriate dimension based on % current baselineskip. \ifdim\multitablelinespace=0pt +\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip +\global\advance\multitablelinespace by-\ht0 %% strut to put in table in case some entry doesn't have descenders, %% to keep lines equally spaced \let\multistrut = \strut +\else +%% FIXME: what is \box0 supposed to be? +\gdef\multistrut{\vrule height\multitablelinespace depth\dp0 +width0pt\relax} \fi %% Test to see if parskip is larger than space between lines of %% table. If not, do nothing. %% If so, set to same dimension as multitablelinespace. -\else -\gdef\multistrut{\vrule height\multitablelinespace depth\dp0 -width0pt\relax} \fi \ifdim\multitableparskip>\multitablelinespace \global\multitableparskip=\multitablelinespace \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller @@ -2289,6 +2733,216 @@ width0pt\relax} \fi \fi} +\message{conditionals,} + +% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, +% @ifnotxml always succeed. They currently do nothing; we don't +% attempt to check whether the conditionals are properly nested. But we +% have to remember that they are conditionals, so that @end doesn't +% attempt to close an environment group. +% +\def\makecond#1{% + \expandafter\let\csname #1\endcsname = \relax + \expandafter\let\csname iscond.#1\endcsname = 1 +} +\makecond{iftex} +\makecond{ifnotdocbook} +\makecond{ifnothtml} +\makecond{ifnotinfo} +\makecond{ifnotplaintext} +\makecond{ifnotxml} + +% Ignore @ignore, @ifhtml, @ifinfo, and the like. +% +\def\direntry{\doignore{direntry}} +\def\documentdescription{\doignore{documentdescription}} +\def\docbook{\doignore{docbook}} +\def\html{\doignore{html}} +\def\ifdocbook{\doignore{ifdocbook}} +\def\ifhtml{\doignore{ifhtml}} +\def\ifinfo{\doignore{ifinfo}} +\def\ifnottex{\doignore{ifnottex}} +\def\ifplaintext{\doignore{ifplaintext}} +\def\ifxml{\doignore{ifxml}} +\def\ignore{\doignore{ignore}} +\def\menu{\doignore{menu}} +\def\xml{\doignore{xml}} + +% Ignore text until a line `@end #1', keeping track of nested conditionals. +% +% A count to remember the depth of nesting. +\newcount\doignorecount + +\def\doignore#1{\begingroup + % Scan in ``verbatim'' mode: + \catcode`\@ = \other + \catcode`\{ = \other + \catcode`\} = \other + % + % Make sure that spaces turn into tokens that match what \doignoretext wants. + \spaceisspace + % + % Count number of #1's that we've seen. + \doignorecount = 0 + % + % Swallow text until we reach the matching `@end #1'. + \dodoignore {#1}% +} + +{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. + \obeylines % + % + \gdef\dodoignore#1{% + % #1 contains the string `ifinfo'. + % + % Define a command to find the next `@end #1', which must be on a line + % by itself. + \long\def\doignoretext##1^^M@end #1{\doignoretextyyy##1^^M@#1\_STOP_}% + % And this command to find another #1 command, at the beginning of a + % line. (Otherwise, we would consider a line `@c @ifset', for + % example, to count as an @ifset for nesting.) + \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% + % + % And now expand that command. + \obeylines % + \doignoretext ^^M% + }% +} + +\def\doignoreyyy#1{% + \def\temp{#1}% + \ifx\temp\empty % Nothing found. + \let\next\doignoretextzzz + \else % Found a nested condition, ... + \advance\doignorecount by 1 + \let\next\doignoretextyyy % ..., look for another. + % If we're here, #1 ends with ^^M\ifinfo (for example). + \fi + \next #1% the token \_STOP_ is present just after this macro. +} + +% We have to swallow the remaining "\_STOP_". +% +\def\doignoretextzzz#1{% + \ifnum\doignorecount = 0 % We have just found the outermost @end. + \let\next\enddoignore + \else % Still inside a nested condition. + \advance\doignorecount by -1 + \let\next\doignoretext % Look for the next @end. + \fi + \next +} + +% Finish off ignored text. +\def\enddoignore{\endgroup\ignorespaces} + + +% @set VAR sets the variable VAR to an empty value. +% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. +% +% Since we want to separate VAR from REST-OF-LINE (which might be +% empty), we can't just use \parsearg; we have to insert a space of our +% own to delimit the rest of the line, and then take it out again if we +% didn't need it. +% We rely on the fact that \parsearg sets \catcode`\ =10. +% +\parseargdef\set{\setyyy#1 \endsetyyy} +\def\setyyy#1 #2\endsetyyy{% + {% + \makevalueexpandable + \def\temp{#2}% + \edef\next{\gdef\makecsname{SET#1}}% + \ifx\temp\empty + \next{}% + \else + \setzzz#2\endsetzzz + \fi + }% +} +% Remove the trailing space \setxxx inserted. +\def\setzzz#1 \endsetzzz{\next{#1}} + +% @clear VAR clears (i.e., unsets) the variable VAR. +% +\parseargdef\clear{% + {% + \makevalueexpandable + \global\expandafter\let\csname SET#1\endcsname=\relax + }% +} + +% @value{foo} gets the text saved in variable foo. +\def\value{\begingroup\makevalueexpandable\valuexxx} +\def\valuexxx#1{\expandablevalue{#1}\endgroup} +{ + \catcode`\- = \active \catcode`\_ = \active + % + \gdef\makevalueexpandable{% + \let\value = \expandablevalue + % We don't want these characters active, ... + \catcode`\-=\other \catcode`\_=\other + % ..., but we might end up with active ones in the argument if + % we're called from @code, as @code{@value{foo-bar_}}, though. + % So \let them to their normal equivalents. + \let-\realdash \let_\normalunderscore + } +} + +% We have this subroutine so that we can handle at least some @value's +% properly in indexes (we call \makevalueexpandable in \indexdummies). +% The command has to be fully expandable (if the variable is set), since +% the result winds up in the index file. This means that if the +% variable's value contains other Texinfo commands, it's almost certain +% it will fail (although perhaps we could fix that with sufficient work +% to do a one-level expansion on the result, instead of complete). +% +\def\expandablevalue#1{% + \expandafter\ifx\csname SET#1\endcsname\relax + {[No value for ``#1'']}% + \message{Variable `#1', used in @value, is not set.}% + \else + \csname SET#1\endcsname + \fi +} + +% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined +% with @set. +% +% To get special treatment of `@end ifset,' call \makeond and the redefine. +% +\makecond{ifset} +\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} +\def\doifset#1#2{% + {% + \makevalueexpandable + \let\next=\empty + \expandafter\ifx\csname SET#2\endcsname\relax + #1% If not set, redefine \next. + \fi + \expandafter + }\next +} +\def\ifsetfail{\doignore{ifset}} + +% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been +% defined with @set, or has been undefined with @clear. +% +% The `\else' inside the `\doifset' parameter is a trick to reuse the +% above code: if the variable is not set, do nothing, if it is set, +% then redefine \next to \ifclearfail. +% +\makecond{ifclear} +\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} +\def\ifclearfail{\doignore{ifclear}} + +% @dircategory CATEGORY -- specify a category of the dir file +% which this file should belong to. Ignore this in TeX. +\let\dircategory=\comment + +% @defininfoenclose. +\let\definfoenclose=\comment + + \message{indexing,} % Index generation facilities @@ -2315,42 +2969,48 @@ width0pt\relax} \fi } % @defindex foo == \newindex{foo} - +% \def\defindex{\parsearg\newindex} % Define @defcodeindex, like @defindex except put all entries in @code. - +% +\def\defcodeindex{\parsearg\newcodeindex} +% \def\newcodeindex#1{% \iflinks \expandafter\newwrite \csname#1indfile\endcsname \openout \csname#1indfile\endcsname \jobname.#1 \fi \expandafter\xdef\csname#1index\endcsname{% - \noexpand\docodeindex{#1}} + \noexpand\docodeindex{#1}}% } -\def\defcodeindex{\parsearg\newcodeindex} % @synindex foo bar makes index foo feed into index bar. % Do this instead of @defindex foo if you don't want it as a separate index. -% The \closeout helps reduce unnecessary open files; the limit on the -% Acorn RISC OS is a mere 16 files. -\def\synindex#1 #2 {% - \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname - \expandafter\closeout\csname#1indfile\endcsname - \expandafter\let\csname#1indfile\endcsname=\synindexfoo - \expandafter\xdef\csname#1index\endcsname{% define \xxxindex - \noexpand\doindex{#2}}% -} - +% % @syncodeindex foo bar similar, but put all entries made for index foo % inside @code. -\def\syncodeindex#1 #2 {% - \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname - \expandafter\closeout\csname#1indfile\endcsname - \expandafter\let\csname#1indfile\endcsname=\synindexfoo - \expandafter\xdef\csname#1index\endcsname{% define \xxxindex - \noexpand\docodeindex{#2}}% +% +\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} +\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} + +% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), +% #3 the target index (bar). +\def\dosynindex#1#2#3{% + % Only do \closeout if we haven't already done it, else we'll end up + % closing the target index. + \expandafter \ifx\csname donesynindex#2\endcsname \undefined + % The \closeout helps reduce unnecessary open files; the limit on the + % Acorn RISC OS is a mere 16 files. + \expandafter\closeout\csname#2indfile\endcsname + \expandafter\let\csname\donesynindex#2\endcsname = 1 + \fi + % redefine \fooindfile: + \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname + \expandafter\let\csname#2indfile\endcsname=\temp + % redefine \fooindex: + \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% } % Define \doindex, the driver for all \fooindex macros. @@ -2370,258 +3030,399 @@ width0pt\relax} \fi \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} +% Take care of Texinfo commands that can appear in an index entry. +% Since there are some commands we want to expand, and others we don't, +% we have to laboriously prevent expansion for those that we don't. +% \def\indexdummies{% -\def\ { }% -% Take care of the plain tex accent commands. -\def\"{\realbackslash "}% -\def\`{\realbackslash `}% -\def\'{\realbackslash '}% -\def\^{\realbackslash ^}% -\def\~{\realbackslash ~}% -\def\={\realbackslash =}% -\def\b{\realbackslash b}% -\def\c{\realbackslash c}% -\def\d{\realbackslash d}% -\def\u{\realbackslash u}% -\def\v{\realbackslash v}% -\def\H{\realbackslash H}% -% Take care of the plain tex special European modified letters. -\def\oe{\realbackslash oe}% -\def\ae{\realbackslash ae}% -\def\aa{\realbackslash aa}% -\def\OE{\realbackslash OE}% -\def\AE{\realbackslash AE}% -\def\AA{\realbackslash AA}% -\def\o{\realbackslash o}% -\def\O{\realbackslash O}% -\def\l{\realbackslash l}% -\def\L{\realbackslash L}% -\def\ss{\realbackslash ss}% -% Take care of texinfo commands likely to appear in an index entry. -% (Must be a way to avoid doing expansion at all, and thus not have to -% laboriously list every single command here.) -\def\@{@}% will be @@ when we switch to @ as escape char. -% Need these in case \tex is in effect and \{ is a \delimiter again. -% But can't use \lbracecmd and \rbracecmd because texindex assumes -% braces and backslashes are used only as delimiters. -\let\{ = \mylbrace -\let\} = \myrbrace -\def\_{{\realbackslash _}}% -\def\w{\realbackslash w }% -\def\bf{\realbackslash bf }% -%\def\rm{\realbackslash rm }% -\def\sl{\realbackslash sl }% -\def\sf{\realbackslash sf}% -\def\tt{\realbackslash tt}% -\def\gtr{\realbackslash gtr}% -\def\less{\realbackslash less}% -\def\hat{\realbackslash hat}% -\def\TeX{\realbackslash TeX}% -\def\dots{\realbackslash dots }% -\def\result{\realbackslash result}% -\def\equiv{\realbackslash equiv}% -\def\expansion{\realbackslash expansion}% -\def\print{\realbackslash print}% -\def\error{\realbackslash error}% -\def\point{\realbackslash point}% -\def\copyright{\realbackslash copyright}% -\def\tclose##1{\realbackslash tclose {##1}}% -\def\code##1{\realbackslash code {##1}}% -\def\uref##1{\realbackslash uref {##1}}% -\def\url##1{\realbackslash url {##1}}% -\def\env##1{\realbackslash env {##1}}% -\def\command##1{\realbackslash command {##1}}% -\def\option##1{\realbackslash option {##1}}% -\def\dotless##1{\realbackslash dotless {##1}}% -\def\samp##1{\realbackslash samp {##1}}% -\def\,##1{\realbackslash ,{##1}}% -\def\t##1{\realbackslash t {##1}}% -\def\r##1{\realbackslash r {##1}}% -\def\i##1{\realbackslash i {##1}}% -\def\b##1{\realbackslash b {##1}}% -\def\sc##1{\realbackslash sc {##1}}% -\def\cite##1{\realbackslash cite {##1}}% -\def\key##1{\realbackslash key {##1}}% -\def\file##1{\realbackslash file {##1}}% -\def\var##1{\realbackslash var {##1}}% -\def\kbd##1{\realbackslash kbd {##1}}% -\def\dfn##1{\realbackslash dfn {##1}}% -\def\emph##1{\realbackslash emph {##1}}% -\def\acronym##1{\realbackslash acronym {##1}}% -% -% Handle some cases of @value -- where the variable name does not -% contain - or _, and the value does not contain any -% (non-fully-expandable) commands. -\let\value = \expandablevalue -% -\unsepspaces + \def\@{@}% change to @@ when we switch to @ as escape char in index files. + \def\ {\realbackslash\space }% + % Need these in case \tex is in effect and \{ is a \delimiter again. + % But can't use \lbracecmd and \rbracecmd because texindex assumes + % braces and backslashes are used only as delimiters. + \let\{ = \mylbrace + \let\} = \myrbrace + % + % \definedummyword defines \#1 as \realbackslash #1\space, thus + % effectively preventing its expansion. This is used only for control + % words, not control letters, because the \space would be incorrect + % for control characters, but is needed to separate the control word + % from whatever follows. + % + % For control letters, we have \definedummyletter, which omits the + % space. + % + % These can be used both for control words that take an argument and + % those that do not. If it is followed by {arg} in the input, then + % that will dutifully get written to the index (or wherever). + % + \def\definedummyword##1{% + \expandafter\def\csname ##1\endcsname{\realbackslash ##1\space}% + }% + \def\definedummyletter##1{% + \expandafter\def\csname ##1\endcsname{\realbackslash ##1}% + }% + \let\definedummyaccent\definedummyletter + % + % Do the redefinitions. + \commondummies } -% If an index command is used in an @example environment, any spaces -% therein should become regular spaces in the raw index file, not the -% expansion of \tie (\\leavevmode \penalty \@M \ ). -{\obeyspaces - \gdef\unsepspaces{\obeyspaces\let =\space}} +% For the aux file, @ is the escape character. So we want to redefine +% everything using @ instead of \realbackslash. When everything uses +% @, this will be simpler. +% +\def\atdummies{% + \def\@{@@}% + \def\ {@ }% + \let\{ = \lbraceatcmd + \let\} = \rbraceatcmd + % + % (See comments in \indexdummies.) + \def\definedummyword##1{% + \expandafter\def\csname ##1\endcsname{@##1\space}% + }% + \def\definedummyletter##1{% + \expandafter\def\csname ##1\endcsname{@##1}% + }% + \let\definedummyaccent\definedummyletter + % + % Do the redefinitions. + \commondummies +} -% \indexnofonts no-ops all font-change commands. -% This is used when outputting the strings to sort the index by. -\def\indexdummyfont#1{#1} -\def\indexdummytex{TeX} -\def\indexdummydots{...} +% Called from \indexdummies and \atdummies. \definedummyword and +% \definedummyletter must be defined first. +% +\def\commondummies{% + % + \normalturnoffactive + % + \commondummiesnofonts + % + \definedummyletter{_}% + % + % Non-English letters. + \definedummyword{AA}% + \definedummyword{AE}% + \definedummyword{L}% + \definedummyword{OE}% + \definedummyword{O}% + \definedummyword{aa}% + \definedummyword{ae}% + \definedummyword{l}% + \definedummyword{oe}% + \definedummyword{o}% + \definedummyword{ss}% + \definedummyword{exclamdown}% + \definedummyword{questiondown}% + \definedummyword{ordf}% + \definedummyword{ordm}% + % + % Although these internal commands shouldn't show up, sometimes they do. + \definedummyword{bf}% + \definedummyword{gtr}% + \definedummyword{hat}% + \definedummyword{less}% + \definedummyword{sf}% + \definedummyword{sl}% + \definedummyword{tclose}% + \definedummyword{tt}% + % + \definedummyword{LaTeX}% + \definedummyword{TeX}% + % + % Assorted special characters. + \definedummyword{bullet}% + \definedummyword{copyright}% + \definedummyword{registeredsymbol}% + \definedummyword{dots}% + \definedummyword{enddots}% + \definedummyword{equiv}% + \definedummyword{error}% + \definedummyword{expansion}% + \definedummyword{minus}% + \definedummyword{pounds}% + \definedummyword{point}% + \definedummyword{print}% + \definedummyword{result}% + % + % Handle some cases of @value -- where it does not contain any + % (non-fully-expandable) commands. + \makevalueexpandable + % + % Normal spaces, not active ones. + \unsepspaces + % + % No macro expansion. + \turnoffmacros +} +% \commondummiesnofonts: common to \commondummies and \indexnofonts. +% +% Better have this without active chars. +{ + \catcode`\~=\other + \gdef\commondummiesnofonts{% + % Control letters and accents. + \definedummyletter{!}% + \definedummyaccent{"}% + \definedummyaccent{'}% + \definedummyletter{*}% + \definedummyaccent{,}% + \definedummyletter{.}% + \definedummyletter{/}% + \definedummyletter{:}% + \definedummyaccent{=}% + \definedummyletter{?}% + \definedummyaccent{^}% + \definedummyaccent{`}% + \definedummyaccent{~}% + \definedummyword{u}% + \definedummyword{v}% + \definedummyword{H}% + \definedummyword{dotaccent}% + \definedummyword{ringaccent}% + \definedummyword{tieaccent}% + \definedummyword{ubaraccent}% + \definedummyword{udotaccent}% + \definedummyword{dotless}% + % + % Texinfo font commands. + \definedummyword{b}% + \definedummyword{i}% + \definedummyword{r}% + \definedummyword{sc}% + \definedummyword{t}% + % + % Commands that take arguments. + \definedummyword{acronym}% + \definedummyword{cite}% + \definedummyword{code}% + \definedummyword{command}% + \definedummyword{dfn}% + \definedummyword{emph}% + \definedummyword{env}% + \definedummyword{file}% + \definedummyword{kbd}% + \definedummyword{key}% + \definedummyword{math}% + \definedummyword{option}% + \definedummyword{samp}% + \definedummyword{strong}% + \definedummyword{tie}% + \definedummyword{uref}% + \definedummyword{url}% + \definedummyword{var}% + \definedummyword{verb}% + \definedummyword{w}% + } +} + +% \indexnofonts is used when outputting the strings to sort the index +% by, and when constructing control sequence names. It eliminates all +% control sequences and just writes whatever the best ASCII sort string +% would be for a given command (usually its argument). +% \def\indexnofonts{% -% Just ignore accents. -\let\,=\indexdummyfont -\let\"=\indexdummyfont -\let\`=\indexdummyfont -\let\'=\indexdummyfont -\let\^=\indexdummyfont -\let\~=\indexdummyfont -\let\==\indexdummyfont -\let\b=\indexdummyfont -\let\c=\indexdummyfont -\let\d=\indexdummyfont -\let\u=\indexdummyfont -\let\v=\indexdummyfont -\let\H=\indexdummyfont -\let\dotless=\indexdummyfont -% Take care of the plain tex special European modified letters. -\def\oe{oe}% -\def\ae{ae}% -\def\aa{aa}% -\def\OE{OE}% -\def\AE{AE}% -\def\AA{AA}% -\def\o{o}% -\def\O{O}% -\def\l{l}% -\def\L{L}% -\def\ss{ss}% -\let\w=\indexdummyfont -\let\t=\indexdummyfont -\let\r=\indexdummyfont -\let\i=\indexdummyfont -\let\b=\indexdummyfont -\let\emph=\indexdummyfont -\let\strong=\indexdummyfont -\let\cite=\indexdummyfont -\let\sc=\indexdummyfont -%Don't no-op \tt, since it isn't a user-level command -% and is used in the definitions of the active chars like <, >, |... -%\let\tt=\indexdummyfont -\let\tclose=\indexdummyfont -\let\code=\indexdummyfont -\let\url=\indexdummyfont -\let\uref=\indexdummyfont -\let\env=\indexdummyfont -\let\command=\indexdummyfont -\let\option=\indexdummyfont -\let\file=\indexdummyfont -\let\samp=\indexdummyfont -\let\kbd=\indexdummyfont -\let\key=\indexdummyfont -\let\var=\indexdummyfont -\let\TeX=\indexdummytex -\let\dots=\indexdummydots -\def\@{@}% + % Accent commands should become @asis. + \def\definedummyaccent##1{% + \expandafter\let\csname ##1\endcsname\asis + }% + % We can just ignore other control letters. + \def\definedummyletter##1{% + \expandafter\def\csname ##1\endcsname{}% + }% + % Hopefully, all control words can become @asis. + \let\definedummyword\definedummyaccent + % + \commondummiesnofonts + % + % Don't no-op \tt, since it isn't a user-level command + % and is used in the definitions of the active chars like <, >, |, etc. + % Likewise with the other plain tex font commands. + %\let\tt=\asis + % + \def\ { }% + \def\@{@}% + % how to handle braces? + \def\_{\normalunderscore}% + % + % Non-English letters. + \def\AA{AA}% + \def\AE{AE}% + \def\L{L}% + \def\OE{OE}% + \def\O{O}% + \def\aa{aa}% + \def\ae{ae}% + \def\l{l}% + \def\oe{oe}% + \def\o{o}% + \def\ss{ss}% + \def\exclamdown{!}% + \def\questiondown{?}% + \def\ordf{a}% + \def\ordm{o}% + % + \def\LaTeX{LaTeX}% + \def\TeX{TeX}% + % + % Assorted special characters. + % (The following {} will end up in the sort string, but that's ok.) + \def\bullet{bullet}% + \def\copyright{copyright}% + \def\registeredsymbol{R}% + \def\dots{...}% + \def\enddots{...}% + \def\equiv{==}% + \def\error{error}% + \def\expansion{==>}% + \def\minus{-}% + \def\pounds{pounds}% + \def\point{.}% + \def\print{-|}% + \def\result{=>}% + % + % Don't write macro names. + \emptyusermacros } -% To define \realbackslash, we must make \ not be an escape. -% We must first make another character (@) an escape -% so we do not become unable to do a definition. - -{\catcode`\@=0 \catcode`\\=\other - @gdef@realbackslash{\}} - \let\indexbackslash=0 %overridden during \printindex. \let\SETmarginindex=\relax % put index entries in margin (undocumented)? -% For \ifx comparisons. -\def\emptymacro{\empty} - % Most index entries go through here, but \dosubind is the general case. -% -\def\doind#1#2{\dosubind{#1}{#2}\empty} +% #1 is the index name, #2 is the entry text. +\def\doind#1#2{\dosubind{#1}{#2}{}} % Workhorse for all \fooindexes. % #1 is name of index, #2 is stuff to put there, #3 is subentry -- -% \empty if called from \doind, as we usually are. The main exception -% is with defuns, which call us directly. -% +% empty if called from \doind, as we usually are (the main exception +% is with most defuns, which call us directly). +% \def\dosubind#1#2#3{% + \iflinks + {% + % Store the main index entry text (including the third arg). + \toks0 = {#2}% + % If third arg is present, precede it with a space. + \def\thirdarg{#3}% + \ifx\thirdarg\empty \else + \toks0 = \expandafter{\the\toks0 \space #3}% + \fi + % + \edef\writeto{\csname#1indfile\endcsname}% + % + \ifvmode + \dosubindsanitize + \else + \dosubindwrite + \fi + }% + \fi +} + +% Write the entry in \toks0 to the index file: +% +\def\dosubindwrite{% % Put the index entry in the margin if desired. \ifx\SETmarginindex\relax\else - \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}% + \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% \fi - {% - \count255=\lastpenalty - {% - \indexdummies % Must do this here, since \bf, etc expand at this stage - \escapechar=`\\ - {% - \let\folio = 0% We will expand all macros now EXCEPT \folio. - \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now - % so it will be output as is; and it will print as backslash. - % - \def\thirdarg{#3}% - % - % If third arg is present, precede it with space in sort key. - \ifx\thirdarg\emptymacro - \let\subentry = \empty - \else - \def\subentry{ #3}% - \fi - % - % First process the index-string with all font commands turned off - % to get the string to sort by. - {\indexnofonts \xdef\indexsorttmp{#2\subentry}}% - % - % Now produce the complete index entry, with both the sort key and the - % original text, including any font commands. - \toks0 = {#2}% - \edef\temp{% - \write\csname#1indfile\endcsname{% - \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}% - }% - % - % If third (subentry) arg is present, add it to the index string. - \ifx\thirdarg\emptymacro \else - \toks0 = {#3}% - \edef\temp{\temp{\the\toks0}}% - \fi - % - % If a skip is the last thing on the list now, preserve it - % by backing up by \lastskip, doing the \write, then inserting - % the skip again. Otherwise, the whatsit generated by the - % \write will make \lastskip zero. The result is that sequences - % like this: - % @end defun - % @tindex whatever - % @defun ... - % will have extra space inserted, because the \medbreak in the - % start of the @defun won't see the skip inserted by the @end of - % the previous defun. - % - % But don't do any of this if we're not in vertical mode. We - % don't want to do a \vskip and prematurely end a paragraph. - % - % Avoid page breaks due to these extra skips, too. - % - \iflinks - \ifvmode - \skip0 = \lastskip - \ifdim\lastskip = 0pt \else \nobreak\vskip-\lastskip \fi - \fi - % - \temp % do the write - % - % - \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi - \fi - }% - }% - \penalty\count255 + % + % Remember, we are within a group. + \indexdummies % Must do this here, since \bf, etc expand at this stage + \escapechar=`\\ + \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now + % so it will be output as is; and it will print as backslash. + % + % Process the index entry with all font commands turned off, to + % get the string to sort by. + {\indexnofonts + \edef\temp{\the\toks0}% need full expansion + \xdef\indexsorttmp{\temp}% }% + % + % Set up the complete index entry, with both the sort key and + % the original text, including any font commands. We write + % three arguments to \entry to the .?? file (four in the + % subentry case), texindex reduces to two when writing the .??s + % sorted result. + \edef\temp{% + \write\writeto{% + \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% + }% + \temp +} + +% Take care of unwanted page breaks: +% +% If a skip is the last thing on the list now, preserve it +% by backing up by \lastskip, doing the \write, then inserting +% the skip again. Otherwise, the whatsit generated by the +% \write will make \lastskip zero. The result is that sequences +% like this: +% @end defun +% @tindex whatever +% @defun ... +% will have extra space inserted, because the \medbreak in the +% start of the @defun won't see the skip inserted by the @end of +% the previous defun. +% +% But don't do any of this if we're not in vertical mode. We +% don't want to do a \vskip and prematurely end a paragraph. +% +% Avoid page breaks due to these extra skips, too. +% +% But wait, there is a catch there: +% We'll have to check whether \lastskip is zero skip. \ifdim is not +% sufficient for this purpose, as it ignores stretch and shrink parts +% of the skip. The only way seems to be to check the textual +% representation of the skip. +% +% The following is almost like \def\zeroskipmacro{0.0pt} except that +% the ``p'' and ``t'' characters have catcode \other, not 11 (letter). +% +\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} +% +% ..., ready, GO: +% +\def\dosubindsanitize{% + % \lastskip and \lastpenalty cannot both be nonzero simultaneously. + \skip0 = \lastskip + \edef\lastskipmacro{\the\lastskip}% + \count255 = \lastpenalty + % + % If \lastskip is nonzero, that means the last item was a + % skip. And since a skip is discardable, that means this + % -\skip0 glue we're inserting is preceded by a + % non-discardable item, therefore it is not a potential + % breakpoint, therefore no \nobreak needed. + \ifx\lastskipmacro\zeroskipmacro + \else + \vskip-\skip0 + \fi + % + \dosubindwrite + % + \ifx\lastskipmacro\zeroskipmacro + % if \lastskip was zero, perhaps the last item was a + % penalty, and perhaps it was >=10000, e.g., a \nobreak. + % In that case, we want to re-insert the penalty; since we + % just inserted a non-discardable item, any following glue + % (such as a \parskip) would be a breakpoint. For example: + % @deffn deffn-whatever + % @vindex index-whatever + % Description. + % would allow a break between the index-whatever whatsit + % and the "Description." paragraph. + \ifnum\count255>9999 \nobreak \fi + \else + % On the other hand, if we had a nonzero \lastskip, + % this make-up glue would be preceded by a non-discardable item + % (the whatsit from the \write), so we must insert a \nobreak. + \nobreak\vskip\skip0 + \fi } % The index entry written in the file actually looks like @@ -2659,13 +3460,12 @@ width0pt\relax} \fi % @printindex causes a particular index (the ??s file) to get printed. % It does not print any chapter heading (usually an @unnumbered). % -\def\printindex{\parsearg\doprintindex} -\def\doprintindex#1{\begingroup +\parseargdef\printindex{\begingroup \dobreak \chapheadingskip{10000}% % - \indexfonts \rm + \smallfonts \rm \tolerance = 9500 - \indexbreaks + \everypar = {}% don't want the \kern\-parindent from indentation suppression. % % See if the index file exists and is nonempty. % Change catcode of @ here so that if the index file contains @@ -2679,7 +3479,7 @@ width0pt\relax} \fi % and it loses the chapter title and the aux file entries for the % index. The easiest way to prevent this problem is to make sure % there is some text. - (Index is nonexistent) + \putwordIndexNonexistent \else % % If the index file exists but is empty, then \openin leaves \ifeof @@ -2687,12 +3487,12 @@ width0pt\relax} \fi % it can discover if there is anything in it. \read 1 to \temp \ifeof 1 - (Index is empty) + \putwordIndexIsEmpty \else % Index files are almost Texinfo source, but we use \ as the escape % character. It would be better to use @, but that's too big a change % to make right now. - \def\indexbackslash{\rawbackslashxx}% + \def\indexbackslash{\backslashcurfont}% \catcode`\\ = 0 \escapechar = `\\ \begindoublecolumns @@ -2712,7 +3512,7 @@ width0pt\relax} \fi % % Remove any glue we may have, we'll be inserting our own. \removelastskip - % + % % We like breaks before the index initials, so insert a bonus. \penalty -300 % @@ -2720,7 +3520,7 @@ width0pt\relax} \fi % baselineskips increases the chance of the dots lining up from column % to column. It still won't often be perfect, because of the stretch % we need before each entry, but it's better. - % + % % No shrink because it confuses \balancecolumns. \vskip 1.67\baselineskip plus .5\baselineskip \leftline{\secbf #1}% @@ -2730,70 +3530,95 @@ width0pt\relax} \fi \nobreak }} -% This typesets a paragraph consisting of #1, dot leaders, and then #2 -% flush to the right margin. It is used for index and table of contents -% entries. The paragraph is indented by \leftskip. +% \entry typesets a paragraph consisting of the text (#1), dot leaders, and +% then page number (#2) flushed to the right margin. It is used for index +% and table of contents entries. The paragraph is indented by \leftskip. % -\def\entry#1#2{\begingroup - % - % Start a new paragraph if necessary, so our assignments below can't - % affect previous text. - \par - % - % Do not fill out the last line with white space. - \parfillskip = 0in - % - % No extra space above this paragraph. - \parskip = 0in - % - % Do not prefer a separate line ending with a hyphen to fewer lines. - \finalhyphendemerits = 0 - % - % \hangindent is only relevant when the entry text and page number - % don't both fit on one line. In that case, bob suggests starting the - % dots pretty far over on the line. Unfortunately, a large - % indentation looks wrong when the entry text itself is broken across - % lines. So we use a small indentation and put up with long leaders. - % - % \hangafter is reset to 1 (which is the value we want) at the start - % of each paragraph, so we need not do anything with that. - \hangindent = 2em - % - % When the entry text needs to be broken, just fill out the first line - % with blank space. - \rightskip = 0pt plus1fil - % - % A bit of stretch before each entry for the benefit of balancing columns. - \vskip 0pt plus1pt - % - % Start a ``paragraph'' for the index entry so the line breaking - % parameters we've set above will have an effect. - \noindent - % - % Insert the text of the index entry. TeX will do line-breaking on it. - #1% - % The following is kludged to not output a line of dots in the index if - % there are no page numbers. The next person who breaks this will be - % cursed by a Unix daemon. - \def\tempa{{\rm }}% - \def\tempb{#2}% - \edef\tempc{\tempa}% - \edef\tempd{\tempb}% - \ifx\tempc\tempd\ \else% +% A straightforward implementation would start like this: +% \def\entry#1#2{... +% But this frozes the catcodes in the argument, and can cause problems to +% @code, which sets - active. This problem was fixed by a kludge--- +% ``-'' was active throughout whole index, but this isn't really right. +% +% The right solution is to prevent \entry from swallowing the whole text. +% --kasal, 21nov03 +\def\entry{% + \begingroup % - % If we must, put the page number on a line of its own, and fill out - % this line with blank space. (The \hfil is overwhelmed with the - % fill leaders glue in \indexdotfill if the page number does fit.) - \hfil\penalty50 - \null\nobreak\indexdotfill % Have leaders before the page number. + % Start a new paragraph if necessary, so our assignments below can't + % affect previous text. + \par % - % The `\ ' here is removed by the implicit \unskip that TeX does as - % part of (the primitive) \par. Without it, a spurious underfull - % \hbox ensues. - \ #2% The page number ends the paragraph. - \fi% - \par -\endgroup} + % Do not fill out the last line with white space. + \parfillskip = 0in + % + % No extra space above this paragraph. + \parskip = 0in + % + % Do not prefer a separate line ending with a hyphen to fewer lines. + \finalhyphendemerits = 0 + % + % \hangindent is only relevant when the entry text and page number + % don't both fit on one line. In that case, bob suggests starting the + % dots pretty far over on the line. Unfortunately, a large + % indentation looks wrong when the entry text itself is broken across + % lines. So we use a small indentation and put up with long leaders. + % + % \hangafter is reset to 1 (which is the value we want) at the start + % of each paragraph, so we need not do anything with that. + \hangindent = 2em + % + % When the entry text needs to be broken, just fill out the first line + % with blank space. + \rightskip = 0pt plus1fil + % + % A bit of stretch before each entry for the benefit of balancing + % columns. + \vskip 0pt plus1pt + % + % Swallow the left brace of the text (first parameter): + \afterassignment\doentry + \let\temp = +} +\def\doentry{% + \bgroup % Instead of the swallowed brace. + \noindent + \aftergroup\finishentry + % And now comes the text of the entry. +} +\def\finishentry#1{% + % #1 is the page number. + % + % The following is kludged to not output a line of dots in the index if + % there are no page numbers. The next person who breaks this will be + % cursed by a Unix daemon. + \def\tempa{{\rm }}% + \def\tempb{#1}% + \edef\tempc{\tempa}% + \edef\tempd{\tempb}% + \ifx\tempc\tempd + \ % + \else + % + % If we must, put the page number on a line of its own, and fill out + % this line with blank space. (The \hfil is overwhelmed with the + % fill leaders glue in \indexdotfill if the page number does fit.) + \hfil\penalty50 + \null\nobreak\indexdotfill % Have leaders before the page number. + % + % The `\ ' here is removed by the implicit \unskip that TeX does as + % part of (the primitive) \par. Without it, a spurious underfull + % \hbox ensues. + \ifpdf + \pdfgettoks#1.% + \ \the\toksA + \else + \ #1% + \fi + \fi + \par + \endgroup +} % Like \dotfill except takes at least 1 em. \def\indexdotfill{\cleaders @@ -2802,11 +3627,18 @@ width0pt\relax} \fi \def\primary #1{\line{#1\hfil}} \newskip\secondaryindent \secondaryindent=0.5cm - -\def\secondary #1#2{ -{\parfillskip=0in \parskip=0in -\hangindent =1in \hangafter=1 -\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par +\def\secondary#1#2{{% + \parfillskip=0in + \parskip=0in + \hangindent=1in + \hangafter=1 + \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill + \ifpdf + \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. + \else + #2 + \fi + \par }} % Define two-column mode, which we use to typeset indexes. @@ -2819,23 +3651,25 @@ width0pt\relax} \fi \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns % Grab any single-column material above us. - \output = {\global\setbox\partialpage = \vbox{% - % + \output = {% + % % Here is a possibility not foreseen in manmac: if we accumulate a % whole lot of material, we might end up calling this \output % routine twice in a row (see the doublecol-lose test, which is % essentially a couple of indexes with @setchapternewpage off). In - % that case, we must prevent the second \partialpage from - % simply overwriting the first, causing us to lose the page. - % This will preserve it until a real output routine can ship it - % out. Generally, \partialpage will be empty when this runs and - % this will be a no-op. - \unvbox\partialpage + % that case we just ship out what is in \partialpage with the normal + % output routine. Generally, \partialpage will be empty when this + % runs and this will be a no-op. See the indexspread.tex test case. + \ifvoid\partialpage \else + \onepageout{\pagecontents\partialpage}% + \fi % - % Unvbox the main output page. - \unvbox255 - \kern-\topskip \kern\baselineskip - }}% + \global\setbox\partialpage = \vbox{% + % Unvbox the main output page. + \unvbox\PAGE + \kern-\topskip \kern\baselineskip + }% + }% \eject % run that output routine to set \partialpage % % Use the double-column output routine for subsequent pages. @@ -2864,13 +3698,12 @@ width0pt\relax} \fi % % Double the \vsize as well. (We don't need a separate register here, % since nobody clobbers \vsize.) - \advance\vsize by -\ht\partialpage \vsize = 2\vsize } % The double-column output routine for all double-column pages except % the last. -% +% \def\doublecolumnout{% \splittopskip=\topskip \splitmaxdepth=\maxdepth % Get the available space for the double columns -- the normal @@ -2878,6 +3711,7 @@ width0pt\relax} \fi % previous page. \dimen@ = \vsize \divide\dimen@ by 2 + \advance\dimen@ by -\ht\partialpage % % box0 will be the left-hand column, box2 the right. \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ @@ -2885,16 +3719,18 @@ width0pt\relax} \fi \unvbox255 \penalty\outputpenalty } +% +% Re-output the contents of the output page -- any previous material, +% followed by the two boxes we just split, in box0 and box2. \def\pagesofar{% - % Re-output the contents of the output page -- any previous material, - % followed by the two boxes we just split, in box0 and box2. - \advance\vsize by \ht\partialpage \unvbox\partialpage % \hsize = \doublecolumnhsize \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}% } +% +% All done with double columns. \def\enddoublecolumns{% \output = {% % Split the last of the double-column material. Leave it on the @@ -2919,8 +3755,9 @@ width0pt\relax} \fi % \endgroup where \vsize got restored). \pagegoal = \vsize } +% +% Called at the end of the double column material. \def\balancecolumns{% - % Called at the end of the double column material. \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. \dimen@ = \ht0 \advance\dimen@ by \topskip @@ -2948,8 +3785,14 @@ width0pt\relax} \fi \message{sectioning,} -% Define chapters, sections, etc. +% Chapters, sections, etc. +% \unnumberedno is an oxymoron, of course. But we count the unnumbered +% sections so that we can refer to them unambiguously in the pdf +% outlines by their "section number". We avoid collisions with chapter +% numbers by starting them at 10000. (If a document ever has 10000 +% chapters, we're in trouble anyway, I'm sure.) +\newcount\unnumberedno \unnumberedno = 10000 \newcount\chapno \newcount\secno \secno=0 \newcount\subsecno \subsecno=0 @@ -2957,15 +3800,55 @@ width0pt\relax} \fi % This counter is funny since it counts through charcodes of letters A, B, ... \newcount\appendixno \appendixno = `\@ -\def\appendixletter{\char\the\appendixno} +% +% \def\appendixletter{\char\the\appendixno} +% We do the following ugly conditional instead of the above simple +% construct for the sake of pdftex, which needs the actual +% letter in the expansion, not just typeset. +% +\def\appendixletter{% + \ifnum\appendixno=`A A% + \else\ifnum\appendixno=`B B% + \else\ifnum\appendixno=`C C% + \else\ifnum\appendixno=`D D% + \else\ifnum\appendixno=`E E% + \else\ifnum\appendixno=`F F% + \else\ifnum\appendixno=`G G% + \else\ifnum\appendixno=`H H% + \else\ifnum\appendixno=`I I% + \else\ifnum\appendixno=`J J% + \else\ifnum\appendixno=`K K% + \else\ifnum\appendixno=`L L% + \else\ifnum\appendixno=`M M% + \else\ifnum\appendixno=`N N% + \else\ifnum\appendixno=`O O% + \else\ifnum\appendixno=`P P% + \else\ifnum\appendixno=`Q Q% + \else\ifnum\appendixno=`R R% + \else\ifnum\appendixno=`S S% + \else\ifnum\appendixno=`T T% + \else\ifnum\appendixno=`U U% + \else\ifnum\appendixno=`V V% + \else\ifnum\appendixno=`W W% + \else\ifnum\appendixno=`X X% + \else\ifnum\appendixno=`Y Y% + \else\ifnum\appendixno=`Z Z% + % The \the is necessary, despite appearances, because \appendixletter is + % expanded while writing the .toc file. \char\appendixno is not + % expandable, thus it is written literally, thus all appendixes come out + % with the same letter (or @) in the toc without it. + \else\char\the\appendixno + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} % Each @chapter defines this as the name of the chapter. % page headings and footings can use it. @section does likewise. +% However, they are not reliable, because we don't use marks. \def\thischapter{} \def\thissection{} \newcount\absseclevel % used to calculate proper heading level -\newcount\secbase\secbase=0 % @raise/lowersections modify this count +\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count % @raisesections: treat @section as chapter, @subsection as section, etc. \def\raisesections{\global\advance\secbase by -1} @@ -2975,287 +3858,246 @@ width0pt\relax} \fi \def\lowersections{\global\advance\secbase by 1} \let\down=\lowersections % original BFox name -% Choose a numbered-heading macro -% #1 is heading level if unmodified by @raisesections or @lowersections -% #2 is text for heading -\def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \chapterzzz{#2} -\or - \seczzz{#2} -\or - \numberedsubseczzz{#2} -\or - \numberedsubsubseczzz{#2} -\else - \ifnum \absseclevel<0 - \chapterzzz{#2} +% we only have subsub. +\chardef\maxseclevel = 3 +% +% A numbered section within an unnumbered changes to unnumbered too. +% To achive this, remember the "biggest" unnum. sec. we are currently in: +\chardef\unmlevel = \maxseclevel +% +% Trace whether the current chapter is an appendix or not: +% \chapheadtype is "N" or "A", unnumbered chapters are ignored. +\def\chapheadtype{N} + +% Choose a heading macro +% #1 is heading type +% #2 is heading level +% #3 is text for heading +\def\genhead#1#2#3{% + % Compute the abs. sec. level: + \absseclevel=#2 + \advance\absseclevel by \secbase + % Make sure \absseclevel doesn't fall outside the range: + \ifnum \absseclevel < 0 + \absseclevel = 0 \else - \numberedsubsubseczzz{#2} + \ifnum \absseclevel > 3 + \absseclevel = 3 + \fi \fi -\fi -} - -% like \numhead, but chooses appendix heading levels -\def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \appendixzzz{#2} -\or - \appendixsectionzzz{#2} -\or - \appendixsubseczzz{#2} -\or - \appendixsubsubseczzz{#2} -\else - \ifnum \absseclevel<0 - \appendixzzz{#2} + % The heading type: + \def\headtype{#1}% + \if \headtype U% + \ifnum \absseclevel < \unmlevel + \chardef\unmlevel = \absseclevel + \fi \else - \appendixsubsubseczzz{#2} + % Check for appendix sections: + \ifnum \absseclevel = 0 + \edef\chapheadtype{\headtype}% + \else + \if \headtype A\if \chapheadtype N% + \errmessage{@appendix... within a non-appendix chapter}% + \fi\fi + \fi + % Check for numbered within unnumbered: + \ifnum \absseclevel > \unmlevel + \def\headtype{U}% + \else + \chardef\unmlevel = 3 + \fi \fi -\fi -} - -% like \numhead, but chooses numberless heading levels -\def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \unnumberedzzz{#2} -\or - \unnumberedseczzz{#2} -\or - \unnumberedsubseczzz{#2} -\or - \unnumberedsubsubseczzz{#2} -\else - \ifnum \absseclevel<0 - \unnumberedzzz{#2} + % Now print the heading: + \if \headtype U% + \ifcase\absseclevel + \unnumberedzzz{#3}% + \or \unnumberedseczzz{#3}% + \or \unnumberedsubseczzz{#3}% + \or \unnumberedsubsubseczzz{#3}% + \fi \else - \unnumberedsubsubseczzz{#2} + \if \headtype A% + \ifcase\absseclevel + \appendixzzz{#3}% + \or \appendixsectionzzz{#3}% + \or \appendixsubseczzz{#3}% + \or \appendixsubsubseczzz{#3}% + \fi + \else + \ifcase\absseclevel + \chapterzzz{#3}% + \or \seczzz{#3}% + \or \numberedsubseczzz{#3}% + \or \numberedsubsubseczzz{#3}% + \fi + \fi \fi -\fi + \suppressfirstparagraphindent } -% @chapter, @appendix, @unnumbered. -\def\thischaptername{No Chapter Title} -\outer\def\chapter{\parsearg\chapteryyy} -\def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz -\def\chapterzzz #1{% -\secno=0 \subsecno=0 \subsubsecno=0 -\global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}% -\chapmacro {#1}{\the\chapno}% -\gdef\thissection{#1}% -\gdef\thischaptername{#1}% -% We don't substitute the actual chapter name into \thischapter -% because we don't want its macros evaluated now. -\xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}% - {\the\chapno}}}% -\temp -\donoderef -\global\let\section = \numberedsec -\global\let\subsection = \numberedsubsec -\global\let\subsubsection = \numberedsubsubsec +% an interface: +\def\numhead{\genhead N} +\def\apphead{\genhead A} +\def\unnmhead{\genhead U} + +% @chapter, @appendix, @unnumbered. Increment top-level counter, reset +% all lower-level sectioning counters to zero. +% +% Also set \chaplevelprefix, which we prepend to @float sequence numbers +% (e.g., figures), q.v. By default (before any chapter), that is empty. +\let\chaplevelprefix = \empty +% +\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz +\def\chapterzzz#1{% + % section resetting is \global in case the chapter is in a group, such + % as an @include file. + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\chapno by 1 + % + % Used for \float. + \gdef\chaplevelprefix{\the\chapno.}% + \resetallfloatnos + % + \message{\putwordChapter\space \the\chapno}% + % + % Write the actual heading. + \chapmacro{#1}{Ynumbered}{\the\chapno}% + % + % So @section and the like are numbered underneath this chapter. + \global\let\section = \numberedsec + \global\let\subsection = \numberedsubsec + \global\let\subsubsection = \numberedsubsubsec } -\outer\def\appendix{\parsearg\appendixyyy} -\def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz -\def\appendixzzz #1{% -\secno=0 \subsecno=0 \subsubsecno=0 -\global\advance \appendixno by 1 -\message{\putwordAppendix\space \appendixletter}% -\chapmacro {#1}{\putwordAppendix{} \appendixletter}% -\gdef\thissection{#1}% -\gdef\thischaptername{#1}% -\xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}% - {\putwordAppendix{} \appendixletter}}}% -\temp -\appendixnoderef -\global\let\section = \appendixsec -\global\let\subsection = \appendixsubsec -\global\let\subsubsection = \appendixsubsubsec +\outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz +\def\appendixzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\appendixno by 1 + \gdef\chaplevelprefix{\appendixletter.}% + \resetallfloatnos + % + \def\appendixnum{\putwordAppendix\space \appendixletter}% + \message{\appendixnum}% + % + \chapmacro{#1}{Yappendix}{\appendixletter}% + % + \global\let\section = \appendixsec + \global\let\subsection = \appendixsubsec + \global\let\subsubsection = \appendixsubsubsec +} + +\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz +\def\unnumberedzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\unnumberedno by 1 + % + % Since an unnumbered has no number, no prefix for figures. + \global\let\chaplevelprefix = \empty + \resetallfloatnos + % + % This used to be simply \message{#1}, but TeX fully expands the + % argument to \message. Therefore, if #1 contained @-commands, TeX + % expanded them. For example, in `@unnumbered The @cite{Book}', TeX + % expanded @cite (which turns out to cause errors because \cite is meant + % to be executed, not expanded). + % + % Anyway, we don't want the fully-expanded definition of @cite to appear + % as a result of the \message, we just want `@cite' itself. We use + % \the to achieve this: TeX expands \the only once, + % simply yielding the contents of . (We also do this for + % the toc entries.) + \toks0 = {#1}% + \message{(\the\toks0)}% + % + \chapmacro{#1}{Ynothing}{\the\unnumberedno}% + % + \global\let\section = \unnumberedsec + \global\let\subsection = \unnumberedsubsec + \global\let\subsubsection = \unnumberedsubsubsec } % @centerchap is like @unnumbered, but the heading is centered. -\outer\def\centerchap{\parsearg\centerchapyyy} -\def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}} +\outer\parseargdef\centerchap{% + % Well, we could do the following in a group, but that would break + % an assumption that \chapmacro is called at the outermost level. + % Thus we are safer this way: --kasal, 24feb04 + \let\centerparametersmaybe = \centerparameters + \unnmhead0{#1}% + \let\centerparametersmaybe = \relax +} % @top is like @unnumbered. -\outer\def\top{\parsearg\unnumberedyyy} - -\outer\def\unnumbered{\parsearg\unnumberedyyy} -\def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz -\def\unnumberedzzz #1{% -\secno=0 \subsecno=0 \subsubsecno=0 -% -% This used to be simply \message{#1}, but TeX fully expands the -% argument to \message. Therefore, if #1 contained @-commands, TeX -% expanded them. For example, in `@unnumbered The @cite{Book}', TeX -% expanded @cite (which turns out to cause errors because \cite is meant -% to be executed, not expanded). -% -% Anyway, we don't want the fully-expanded definition of @cite to appear -% as a result of the \message, we just want `@cite' itself. We use -% \the to achieve this: TeX expands \the only once, -% simply yielding the contents of . (We also do this for -% the toc entries.) -\toks0 = {#1}\message{(\the\toks0)}% -% -\unnumbchapmacro {#1}% -\gdef\thischapter{#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbchapentry{\the\toks0}}}% -\temp -\unnumbnoderef -\global\let\section = \unnumberedsec -\global\let\subsection = \unnumberedsubsec -\global\let\subsubsection = \unnumberedsubsubsec -} +\let\top\unnumbered % Sections. -\outer\def\numberedsec{\parsearg\secyyy} -\def\secyyy #1{\numhead1{#1}} % normally calls seczzz -\def\seczzz #1{% -\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % -\gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}% - {\the\chapno}{\the\secno}}}% -\temp -\donoderef -\nobreak +\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz +\def\seczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% } -\outer\def\appendixsection{\parsearg\appendixsecyyy} -\outer\def\appendixsec{\parsearg\appendixsecyyy} -\def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz -\def\appendixsectionzzz #1{% -\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % -\gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}% - {\appendixletter}{\the\secno}}}% -\temp -\appendixnoderef -\nobreak +\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz +\def\appendixsectionzzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% } +\let\appendixsec\appendixsection -\outer\def\unnumberedsec{\parsearg\unnumberedsecyyy} -\def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz -\def\unnumberedseczzz #1{% -\plainsecheading {#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsecentry{\the\toks0}}}% -\temp -\unnumbnoderef -\nobreak +\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz +\def\unnumberedseczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% } % Subsections. -\outer\def\numberedsubsec{\parsearg\numberedsubsecyyy} -\def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz -\def\numberedsubseczzz #1{% -\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % -\subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}% - {\the\chapno}{\the\secno}{\the\subsecno}}}% -\temp -\donoderef -\nobreak +\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz +\def\numberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% } -\outer\def\appendixsubsec{\parsearg\appendixsubsecyyy} -\def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz -\def\appendixsubseczzz #1{% -\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % -\subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}% - {\appendixletter}{\the\secno}{\the\subsecno}}}% -\temp -\appendixnoderef -\nobreak +\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz +\def\appendixsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno}% } -\outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy} -\def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz -\def\unnumberedsubseczzz #1{% -\plainsubsecheading {#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsecentry% - {\the\toks0}}}% -\temp -\unnumbnoderef -\nobreak +\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz +\def\unnumberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno}% } % Subsubsections. -\outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy} -\def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz -\def\numberedsubsubseczzz #1{% -\gdef\thissection{#1}\global\advance \subsubsecno by 1 % -\subsubsecheading {#1} - {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}% - {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% -\temp -\donoderef -\nobreak +\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz +\def\numberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynumbered}% + {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% } -\outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy} -\def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz -\def\appendixsubsubseczzz #1{% -\gdef\thissection{#1}\global\advance \subsubsecno by 1 % -\subsubsecheading {#1} - {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}% - {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% -\temp -\appendixnoderef -\nobreak +\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz +\def\appendixsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% } -\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy} -\def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz -\def\unnumberedsubsubseczzz #1{% -\plainsubsubsecheading {#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsubsecentry% - {\the\toks0}}}% -\temp -\unnumbnoderef -\nobreak +\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz +\def\unnumberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% } -% These are variants which are not "outer", so they can appear in @ifinfo. -% Actually, they should now be obsolete; ordinary section commands should work. -\def\infotop{\parsearg\unnumberedzzz} -\def\infounnumbered{\parsearg\unnumberedzzz} -\def\infounnumberedsec{\parsearg\unnumberedseczzz} -\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz} -\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz} - -\def\infoappendix{\parsearg\appendixzzz} -\def\infoappendixsec{\parsearg\appendixseczzz} -\def\infoappendixsubsec{\parsearg\appendixsubseczzz} -\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz} - -\def\infochapter{\parsearg\chapterzzz} -\def\infosection{\parsearg\sectionzzz} -\def\infosubsection{\parsearg\subsectionzzz} -\def\infosubsubsection{\parsearg\subsubsectionzzz} - % These macros control what the section commands do, according % to what kind of chapter we are in (ordinary, appendix, or unnumbered). % Define them by default for a numbered chapter. -\global\let\section = \numberedsec -\global\let\subsection = \numberedsubsec -\global\let\subsubsection = \numberedsubsubsec +\let\section = \numberedsec +\let\subsection = \numberedsubsec +\let\subsubsection = \numberedsubsubsec % Define @majorheading, @heading and @subheading @@ -3268,23 +4110,27 @@ width0pt\relax} \fi % if justification is not attempted. Hence \raggedright. -\def\majorheading{\parsearg\majorheadingzzz} -\def\majorheadingzzz #1{% -{\advance\chapheadingskip by 10pt \chapbreak }% -{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\penalty 200} +\def\majorheading{% + {\advance\chapheadingskip by 10pt \chapbreak }% + \parsearg\chapheadingzzz +} -\def\chapheading{\parsearg\chapheadingzzz} -\def\chapheadingzzz #1{\chapbreak % -{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\penalty 200} +\def\chapheading{\chapbreak \parsearg\chapheadingzzz} +\def\chapheadingzzz#1{% + {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rm #1\hfill}}% + \bigskip \par\penalty 200\relax + \suppressfirstparagraphindent +} % @heading, @subheading, @subsubheading. -\def\heading{\parsearg\plainsecheading} -\def\subheading{\parsearg\plainsubsecheading} -\def\subsubheading{\parsearg\plainsubsubsecheading} +\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} % These macros generate a chapter, section, etc. heading only % (including whitespace, linebreaking, etc. around it), @@ -3293,8 +4139,6 @@ width0pt\relax} \fi %%% Args are the skip and penalty (usually negative) \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} -\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} - %%% Define plain chapter starts, and page on/off switching for it % Parameter controlling skip before chapter headings (if needed) @@ -3317,7 +4161,7 @@ width0pt\relax} \fi \global\let\pagealignmacro=\chappager \global\def\HEADINGSon{\HEADINGSsingle}} -\def\CHAPPAGodd{ +\def\CHAPPAGodd{% \global\let\contentsalignmacro = \chapoddpage \global\let\pchapsepmacro=\chapoddpage \global\let\pagealignmacro=\chapoddpage @@ -3325,258 +4169,394 @@ width0pt\relax} \fi \CHAPPAGon -\def\CHAPFplain{ -\global\let\chapmacro=\chfplain -\global\let\unnumbchapmacro=\unnchfplain -\global\let\centerchapmacro=\centerchfplain} - -% Plain chapter opening. -% #1 is the text, #2 the chapter number or empty if unnumbered. -\def\chfplain#1#2{% +% Chapter opening. +% +% #1 is the text, #2 is the section type (Ynumbered, Ynothing, +% Yappendix, Yomitfromtoc), #3 the chapter number. +% +% To test against our argument. +\def\Ynothingkeyword{Ynothing} +\def\Yomitfromtockeyword{Yomitfromtoc} +\def\Yappendixkeyword{Yappendix} +% +\def\chapmacro#1#2#3{% \pchapsepmacro {% \chapfonts \rm - \def\chapnum{#2}% - \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}% + % + % Have to define \thissection before calling \donoderef, because the + % xref code eventually uses it. On the other hand, it has to be called + % after \pchapsepmacro, or the headline will change too soon. + \gdef\thissection{#1}% + \gdef\thischaptername{#1}% + % + % Only insert the separating space if we have a chapter/appendix + % number, and don't print the unnumbered ``number''. + \def\temptype{#2}% + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unnchap}% + \def\thischapter{#1}% + \else\ifx\temptype\Yomitfromtockeyword + \setbox0 = \hbox{}% contents like unnumbered, but no toc entry + \def\toctype{omit}% + \xdef\thischapter{}% + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% + \def\toctype{app}% + % We don't substitute the actual chapter name into \thischapter + % because we don't want its macros evaluated now. And we don't + % use \thissection because that changes with each section. + % + \xdef\thischapter{\putwordAppendix{} \appendixletter: + \noexpand\thischaptername}% + \else + \setbox0 = \hbox{#3\enspace}% + \def\toctype{numchap}% + \xdef\thischapter{\putwordChapter{} \the\chapno: + \noexpand\thischaptername}% + \fi\fi\fi + % + % Write the toc entry for this chapter. Must come before the + % \donoderef, because we include the current node name in the toc + % entry, and \donoderef resets it to empty. + \writetocentry{\toctype}{#1}{#3}% + % + % For pdftex, we have to write out the node definition (aka, make + % the pdfdest) after any page break, but before the actual text has + % been typeset. If the destination for the pdf outline is after the + % text, then jumping from the outline may wind up with the text not + % being visible, for instance under high magnification. + \donoderef{#2}% + % + % Typeset the actual heading. \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright - \hangindent = \wd0 \centerparametersmaybe + \hangindent=\wd0 \centerparametersmaybe \unhbox0 #1\par}% }% \nobreak\bigskip % no page break after a chapter title \nobreak } -% Plain opening for unnumbered. -\def\unnchfplain#1{\chfplain{#1}{}} - % @centerchap -- centered and unnumbered. \let\centerparametersmaybe = \relax -\def\centerchfplain#1{{% - \def\centerparametersmaybe{% - \advance\rightskip by 3\rightskip - \leftskip = \rightskip - \parfillskip = 0pt - }% - \chfplain{#1}{}% -}} +\def\centerparameters{% + \advance\rightskip by 3\rightskip + \leftskip = \rightskip + \parfillskip = 0pt +} -\CHAPFplain % The default +% I don't think this chapter style is supported any more, so I'm not +% updating it with the new noderef stuff. We'll see. --karl, 11aug03. +% +\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} +% \def\unnchfopen #1{% \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 \parindent=0pt\raggedright \rm #1\hfill}}\bigskip \par\nobreak } - \def\chfopen #1#2{\chapoddpage {\chapfonts \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% \par\penalty 5000 % } - \def\centerchfopen #1{% \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 \parindent=0pt \hfill {\rm #1}\hfill}}\bigskip \par\nobreak } - -\def\CHAPFopen{ -\global\let\chapmacro=\chfopen -\global\let\unnumbchapmacro=\unnchfopen -\global\let\centerchapmacro=\centerchfopen} +\def\CHAPFopen{% + \global\let\chapmacro=\chfopen + \global\let\centerchapmacro=\centerchfopen} -% Section titles. +% Section titles. These macros combine the section number parts and +% call the generic \sectionheading to do the printing. +% \newskip\secheadingskip -\def\secheadingbreak{\dobreak \secheadingskip {-1000}} -\def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}} -\def\plainsecheading#1{\sectionheading{sec}{}{#1}} +\def\secheadingbreak{\dobreak \secheadingskip{-1000}} % Subsection titles. -\newskip \subsecheadingskip -\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}} -\def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}} -\def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}} +\newskip\subsecheadingskip +\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} % Subsubsection titles. -\let\subsubsecheadingskip = \subsecheadingskip -\let\subsubsecheadingbreak = \subsecheadingbreak -\def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}} -\def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}} +\def\subsubsecheadingskip{\subsecheadingskip} +\def\subsubsecheadingbreak{\subsecheadingbreak} -% Print any size section title. +% Print any size, any type, section title. % -% #1 is the section type (sec/subsec/subsubsec), #2 is the section -% number (maybe empty), #3 the text. -\def\sectionheading#1#2#3{% - {% - \expandafter\advance\csname #1headingskip\endcsname by \parskip - \csname #1headingbreak\endcsname - }% +% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is +% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the +% section number. +% +\def\sectionheading#1#2#3#4{% {% % Switch to the right set of fonts. - \csname #1fonts\endcsname \rm + \csname #2fonts\endcsname \rm % - % Only insert the separating space if we have a section number. - \def\secnum{#2}% - \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}% + % Insert space above the heading. + \csname #2headingbreak\endcsname % + % Only insert the space after the number if we have a section number. + \def\sectionlevel{#2}% + \def\temptype{#3}% + % + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unn}% + \gdef\thissection{#1}% + \else\ifx\temptype\Yomitfromtockeyword + % for @headings -- no section number, don't include in toc, + % and don't redefine \thissection. + \setbox0 = \hbox{}% + \def\toctype{omit}% + \let\sectionlevel=\empty + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{#4\enspace}% + \def\toctype{app}% + \gdef\thissection{#1}% + \else + \setbox0 = \hbox{#4\enspace}% + \def\toctype{num}% + \gdef\thissection{#1}% + \fi\fi\fi + % + % Write the toc entry (before \donoderef). See comments in \chfplain. + \writetocentry{\toctype\sectionlevel}{#1}{#4}% + % + % Write the node reference (= pdf destination for pdftex). + % Again, see comments in \chfplain. + \donoderef{#3}% + % + % Output the actual section heading. \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright - \hangindent = \wd0 % zero if no section number - \unhbox0 #3}% + \hangindent=\wd0 % zero if no section number + \unhbox0 #1}% }% - \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak + % Add extra space after the heading -- half of whatever came above it. + % Don't allow stretch, though. + \kern .5 \csname #2headingskip\endcsname + % + % Do not let the kern be a potential breakpoint, as it would be if it + % was followed by glue. + \nobreak + % + % We'll almost certainly start a paragraph next, so don't let that + % glue accumulate. (Not a breakpoint because it's preceded by a + % discardable item.) + \vskip-\parskip + % + % This \nobreak is purely so the last item on the list is a \penalty + % of 10000. This is so other code, for instance \parsebodycommon, can + % check for and avoid allowing breakpoints. Otherwise, it would + % insert a valid breakpoint between: + % @section sec-whatever + % @deffn def-whatever + \nobreak } \message{toc,} +% Table of contents. \newwrite\tocfile % Write an entry to the toc file, opening it if necessary. -% Called from @chapter, etc. We supply {\folio} at the end of the -% argument, which will end up as the last argument to the \...entry macro. -% -% We open the .toc file here instead of at @setfilename or any other -% given time so that @contents can be put in the document anywhere. -% +% Called from @chapter, etc. +% +% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} +% We append the current node name (if any) and page number as additional +% arguments for the \{chap,sec,...}entry macros which will eventually +% read this. The node name is used in the pdf outlines as the +% destination to jump to. +% +% We open the .toc file for writing here instead of at @setfilename (or +% any other fixed time) so that @contents can be anywhere in the document. +% But if #1 is `omit', then we don't do anything. This is used for the +% table of contents chapter openings themselves. +% \newif\iftocfileopened -\def\writetocentry#1{% - \iftocfileopened\else - \immediate\openout\tocfile = \jobname.toc - \global\tocfileopenedtrue +\def\omitkeyword{omit}% +% +\def\writetocentry#1#2#3{% + \edef\writetoctype{#1}% + \ifx\writetoctype\omitkeyword \else + \iftocfileopened\else + \immediate\openout\tocfile = \jobname.toc + \global\tocfileopenedtrue + \fi + % + \iflinks + \toks0 = {#2}% + \toks2 = \expandafter{\lastnode}% + \edef\temp{\write\tocfile{\realbackslash #1entry{\the\toks0}{#3}% + {\the\toks2}{\noexpand\folio}}}% + \temp + \fi \fi - \iflinks \write\tocfile{#1{\folio}}\fi + % + % Tell \shipout to create a pdf destination on each page, if we're + % writing pdf. These are used in the table of contents. We can't + % just write one on every page because the title pages are numbered + % 1 and 2 (the page numbers aren't printed), and so are the first + % two pages of the document. Thus, we'd have two destinations named + % `1', and two named `2'. + \ifpdf \global\pdfmakepagedesttrue \fi } \newskip\contentsrightmargin \contentsrightmargin=1in \newcount\savepageno \newcount\lastnegativepageno \lastnegativepageno = -1 -% Finish up the main text and prepare to read what we've written -% to \tocfile. -% +% Prepare to read what we've written to \tocfile. +% \def\startcontents#1{% - % If @setchapternewpage on, and @headings double, the contents should - % start on an odd page, unlike chapters. Thus, we maintain - % \contentsalignmacro in parallel with \pagealignmacro. - % From: Torbjorn Granlund - \contentsalignmacro - \immediate\closeout\tocfile - % - % Don't need to put `Contents' or `Short Contents' in the headline. - % It is abundantly clear what they are. - \unnumbchapmacro{#1}\def\thischapter{}% - \savepageno = \pageno - \begingroup % Set up to handle contents files properly. - \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11 - % We can't do this, because then an actual ^ in a section - % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97. - %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi - \raggedbottom % Worry more about breakpoints than the bottom. - \advance\hsize by -\contentsrightmargin % Don't use the full line length. - % - % Roman numerals for page numbers. - \ifnum \pageno>0 \pageno = \lastnegativepageno \fi + % If @setchapternewpage on, and @headings double, the contents should + % start on an odd page, unlike chapters. Thus, we maintain + % \contentsalignmacro in parallel with \pagealignmacro. + % From: Torbjorn Granlund + \contentsalignmacro + \immediate\closeout\tocfile + % + % Don't need to put `Contents' or `Short Contents' in the headline. + % It is abundantly clear what they are. + \def\thischapter{}% + \chapmacro{#1}{Yomitfromtoc}{}% + % + \savepageno = \pageno + \begingroup % Set up to handle contents files properly. + \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11 + % We can't do this, because then an actual ^ in a section + % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97. + %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi + \raggedbottom % Worry more about breakpoints than the bottom. + \advance\hsize by -\contentsrightmargin % Don't use the full line length. + % + % Roman numerals for page numbers. + \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi } % Normal (long) toc. \def\contents{% - \startcontents{\putwordTableofContents}% - \openin 1 \jobname.toc - \ifeof 1 \else - \closein 1 - \input \jobname.toc - \fi - \vfill \eject - \endgroup - \lastnegativepageno = \pageno - \pageno = \savepageno + \startcontents{\putwordTOC}% + \openin 1 \jobname.toc + \ifeof 1 \else + \input \jobname.toc + \fi + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \ifeof 1 \else + \pdfmakeoutlines + \fi + \closein 1 + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno } % And just the chapters. \def\summarycontents{% - \startcontents{\putwordShortContents}% - % - \let\chapentry = \shortchapentry - \let\unnumbchapentry = \shortunnumberedentry - % We want a true roman here for the page numbers. - \secfonts - \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl - \rm - \hyphenpenalty = 10000 - \advance\baselineskip by 1pt % Open it up a little. - \def\secentry ##1##2##3##4{} - \def\unnumbsecentry ##1##2{} - \def\subsecentry ##1##2##3##4##5{} - \def\unnumbsubsecentry ##1##2{} - \def\subsubsecentry ##1##2##3##4##5##6{} - \def\unnumbsubsubsecentry ##1##2{} - \openin 1 \jobname.toc - \ifeof 1 \else - \closein 1 - \input \jobname.toc - \fi - \vfill \eject - \endgroup - \lastnegativepageno = \pageno - \pageno = \savepageno + \startcontents{\putwordShortTOC}% + % + \let\numchapentry = \shortchapentry + \let\appentry = \shortchapentry + \let\unnchapentry = \shortunnchapentry + % We want a true roman here for the page numbers. + \secfonts + \let\rm=\shortcontrm \let\bf=\shortcontbf + \let\sl=\shortcontsl \let\tt=\shortconttt + \rm + \hyphenpenalty = 10000 + \advance\baselineskip by 1pt % Open it up a little. + \def\numsecentry##1##2##3##4{} + \let\appsecentry = \numsecentry + \let\unnsecentry = \numsecentry + \let\numsubsecentry = \numsecentry + \let\appsubsecentry = \numsecentry + \let\unnsubsecentry = \numsecentry + \let\numsubsubsecentry = \numsecentry + \let\appsubsubsecentry = \numsecentry + \let\unnsubsubsecentry = \numsecentry + \openin 1 \jobname.toc + \ifeof 1 \else + \input \jobname.toc + \fi + \closein 1 + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno } \let\shortcontents = \summarycontents +% Typeset the label for a chapter or appendix for the short contents. +% The arg is, e.g., `A' for an appendix, or `3' for a chapter. +% +\def\shortchaplabel#1{% + % This space should be enough, since a single number is .5em, and the + % widest letter (M) is 1em, at least in the Computer Modern fonts. + % But use \hss just in case. + % (This space doesn't include the extra space that gets added after + % the label; that gets put in by \shortchapentry above.) + % + % We'd like to right-justify chapter numbers, but that looks strange + % with appendix letters. And right-justifying numbers and + % left-justifying letters looks strange when there is less than 10 + % chapters. Have to read the whole toc once to know how many chapters + % there are before deciding ... + \hbox to 1em{#1\hss}% +} + % These macros generate individual entries in the table of contents. % The first argument is the chapter or section name. % The last argument is the page number. % The arguments in between are the chapter number, section number, ... -% Chapter-level things, for both the long and short contents. -\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}} - -% See comments in \dochapentry re vbox and related settings -\def\shortchapentry#1#2#3{% - \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}% +% Chapters, in the main contents. +\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} +% +% Chapters, in the short toc. +% See comments in \dochapentry re vbox and related settings. +\def\shortchapentry#1#2#3#4{% + \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% } -% Typeset the label for a chapter or appendix for the short contents. -% The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter. -% We could simplify the code here by writing out an \appendixentry -% command in the toc file for appendices, instead of using \chapentry -% for both, but it doesn't seem worth it. -\setbox0 = \hbox{\shortcontrm \putwordAppendix } -\newdimen\shortappendixwidth \shortappendixwidth = \wd0 +% Appendices, in the main contents. +% Need the word Appendix, and a fixed-size box. +% +\def\appendixbox#1{% + % We use M since it's probably the widest letter. + \setbox0 = \hbox{\putwordAppendix{} M}% + \hbox to \wd0{\putwordAppendix{} #1\hss}} +% +\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} -\def\shortchaplabel#1{% - % We typeset #1 in a box of constant width, regardless of the text of - % #1, so the chapter titles will come out aligned. - \setbox0 = \hbox{#1}% - \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi - % - % This space should be plenty, since a single number is .5em, and the - % widest letter (M) is 1em, at least in the Computer Modern fonts. - % (This space doesn't include the extra space that gets added after - % the label; that gets put in by \shortchapentry above.) - \advance\dimen0 by 1.1em - \hbox to \dimen0{#1\hfil}% -} - -\def\unnumbchapentry#1#2{\dochapentry{#1}{#2}} -\def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}} +% Unnumbered chapters. +\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} +\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} % Sections. -\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}} -\def\unnumbsecentry#1#2{\dosecentry{#1}{#2}} +\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} +\let\appsecentry=\numsecentry +\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} % Subsections. -\def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}} -\def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}} +\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} +\let\appsubsecentry=\numsubsecentry +\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} % And subsubsections. -\def\subsubsecentry#1#2#3#4#5#6{% - \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}} -\def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}} +\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} +\let\appsubsubsecentry=\numsubsubsecentry +\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} % This parameter controls the indentation of the various levels. -\newdimen\tocindent \tocindent = 3pc +% Same as \defaultparindent. +\newdimen\tocindent \tocindent = 15pt % Now for the actual typesetting. In all these, #1 is the text and #2 is the % page number. @@ -3587,37 +4567,28 @@ width0pt\relax} \fi \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip \begingroup \chapentryfonts - \tocentry{#1}{\dopageno{#2}}% + \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup \nobreak\vskip .25\baselineskip plus.1\baselineskip } \def\dosecentry#1#2{\begingroup \secentryfonts \leftskip=\tocindent - \tocentry{#1}{\dopageno{#2}}% + \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} \def\dosubsecentry#1#2{\begingroup \subsecentryfonts \leftskip=2\tocindent - \tocentry{#1}{\dopageno{#2}}% + \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} \def\dosubsubsecentry#1#2{\begingroup \subsubsecentryfonts \leftskip=3\tocindent - \tocentry{#1}{\dopageno{#2}}% + \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} -% Final typesetting of a toc entry; we use the same \entry macro as for -% the index entries, but we want to suppress hyphenation here. (We -% can't do that in the \entry macro, since index entries might consist -% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.) -\def\tocentry#1#2{\begingroup - \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks - % Do not use \turnoffactive in these arguments. Since the toc is - % typeset in cmr, so characters such as _ would come out wrong; we - % have to do the usual translation tricks. - \entry{#1}{#2}% -\endgroup} +% We use the same \entry macro as for the index entries. +\let\tocentry = \entry % Space between chapter (or whatever) number and the title. \def\labelspace{\hskip1em \relax} @@ -3627,71 +4598,61 @@ width0pt\relax} \fi \def\chapentryfonts{\secfonts \rm} \def\secentryfonts{\textfonts} -\let\subsecentryfonts = \textfonts -\let\subsubsecentryfonts = \textfonts +\def\subsecentryfonts{\textfonts} +\def\subsubsecentryfonts{\textfonts} \message{environments,} - -% Since these characters are used in examples, it should be an even number of -% \tt widths. Each \tt character is 1en, so two makes it 1em. -% Furthermore, these definitions must come after we define our fonts. -\newbox\dblarrowbox \newbox\longdblarrowbox -\newbox\pushcharbox \newbox\bullbox -\newbox\equivbox \newbox\errorbox - -%{\tentt -%\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil} -%\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil} -%\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil} -%\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil} -% Adapted from the manmac format (p.420 of TeXbook) -%\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex -% depth .1ex\hfil} -%} +% @foo ... @end foo. % @point{}, @result{}, @expansion{}, @print{}, @equiv{}. +% +% Since these characters are used in examples, it should be an even number of +% \tt widths. Each \tt character is 1en, so two makes it 1em. +% \def\point{$\star$} \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} +% The @error{} command. % Adapted from the TeXbook's \boxit. +% +\newbox\errorbox +% {\tentt \global\dimen0 = 3em}% Width of the box. \dimen2 = .55pt % Thickness of rules % The text. (`r' is open on the right, `e' somewhat less so on the left.) \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} - -\global\setbox\errorbox=\hbox to \dimen0{\hfil +% +\setbox\errorbox=\hbox to \dimen0{\hfil \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. \advance\hsize by -2\dimen2 % Rules. - \vbox{ + \vbox{% \hrule height\dimen2 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. \kern3pt\vrule width\dimen2}% Space to right. \hrule height\dimen2} \hfil} - -% The @error{} command. +% \def\error{\leavevmode\lower.7ex\copy\errorbox} % @tex ... @end tex escapes into raw Tex temporarily. % One exception: @ is still an escape character, so that @end tex works. % But \@ or @@ will get a plain tex @ character. -\def\tex{\begingroup +\envdef\tex{% \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 - \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie + \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie \catcode `\%=14 - \catcode 43=12 % plus - \catcode`\"=12 - \catcode`\==12 - \catcode`\|=12 - \catcode`\<=12 - \catcode`\>=12 + \catcode `\+=\other + \catcode `\"=\other + \catcode `\|=\other + \catcode `\<=\other + \catcode `\>=\other \escapechar=`\\ % \let\b=\ptexb @@ -3703,20 +4664,24 @@ width0pt\relax} \fi \let\equiv=\ptexequiv \let\!=\ptexexclam \let\i=\ptexi + \let\indent=\ptexindent + \let\noindent=\ptexnoindent \let\{=\ptexlbrace \let\+=\tabalign \let\}=\ptexrbrace + \let\/=\ptexslash \let\*=\ptexstar \let\t=\ptext % \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% \def\@{@}% -\let\Etex=\endgroup} +} +% There is no need to define \Etex. -% Define @lisp ... @endlisp. -% @lisp does a \begingroup so it can rebind things, -% including the definition of @endlisp (which normally is erroneous). +% Define @lisp ... @end lisp. +% @lisp environment forms a group so it can rebind things, +% including the definition of @end lisp (which normally is erroneous). % Amount to narrow the margins by for @lisp. \newskip\lispnarrowing \lispnarrowing=0.4in @@ -3726,30 +4691,28 @@ width0pt\relax} \fi % have any width. \def\lisppar{\null\endgraf} -% Make each space character in the input produce a normal interword -% space in the output. Don't allow a line break at this space, as this -% is used only in environments like @example, where each line of input -% should produce a line of output anyway. -% -{\obeyspaces % -\gdef\sepspaces{\obeyspaces\let =\tie}} - -% Define \obeyedspace to be our active space, whatever it is. This is -% for use in \parsearg. -{\sepspaces% -\global\let\obeyedspace= } - % This space is always present above and below environments. \newskip\envskipamount \envskipamount = 0pt % Make spacing and below environment symmetrical. We use \parskip here % to help in doing that, since in @example-like environments \parskip % is reset to zero; thus the \afterenvbreak inserts no space -- but the -% start of the next paragraph will insert \parskip +% start of the next paragraph will insert \parskip. % -\def\aboveenvbreak{{\advance\envskipamount by \parskip -\endgraf \ifdim\lastskip<\envskipamount -\removelastskip \penalty-50 \vskip\envskipamount \fi}} +\def\aboveenvbreak{{% + % =10000 instead of <10000 because of a special case in \itemzzz, q.v. + \ifnum \lastpenalty=10000 \else + \advance\envskipamount by \parskip + \endgraf + \ifdim\lastskip<\envskipamount + \removelastskip + % it's not a good place to break if the last penalty was \nobreak + % or better ... + \ifnum\lastpenalty<10000 \penalty-50 \fi + \vskip\envskipamount + \fi + \fi +}} \let\afterenvbreak = \aboveenvbreak @@ -3777,54 +4740,54 @@ width0pt\relax} \fi % \newskip\lskip\newskip\rskip -\long\def\cartouche{% -\begingroup - \lskip=\leftskip \rskip=\rightskip - \leftskip=0pt\rightskip=0pt %we want these *outside*. - \cartinner=\hsize \advance\cartinner by-\lskip - \advance\cartinner by-\rskip - \cartouter=\hsize - \advance\cartouter by 18.4pt % allow for 3pt kerns on either -% side, and for 6pt waste from -% each corner char, and rule thickness - \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip - % Flag to tell @lisp, etc., not to narrow margin. - \let\nonarrowing=\comment - \vbox\bgroup - \baselineskip=0pt\parskip=0pt\lineskip=0pt - \carttop - \hbox\bgroup - \hskip\lskip - \vrule\kern3pt - \vbox\bgroup - \hsize=\cartinner - \kern3pt - \begingroup - \baselineskip=\normbskip - \lineskip=\normlskip - \parskip=\normpskip - \vskip -\parskip +\envdef\cartouche{% + \ifhmode\par\fi % can't be in the midst of a paragraph. + \startsavinginserts + \lskip=\leftskip \rskip=\rightskip + \leftskip=0pt\rightskip=0pt % we want these *outside*. + \cartinner=\hsize \advance\cartinner by-\lskip + \advance\cartinner by-\rskip + \cartouter=\hsize + \advance\cartouter by 18.4pt % allow for 3pt kerns on either + % side, and for 6pt waste from + % each corner char, and rule thickness + \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip + % Flag to tell @lisp, etc., not to narrow margin. + \let\nonarrowing=\comment + \vbox\bgroup + \baselineskip=0pt\parskip=0pt\lineskip=0pt + \carttop + \hbox\bgroup + \hskip\lskip + \vrule\kern3pt + \vbox\bgroup + \kern3pt + \hsize=\cartinner + \baselineskip=\normbskip + \lineskip=\normlskip + \parskip=\normpskip + \vskip -\parskip + \comment % For explanation, see the end of \def\group. +} \def\Ecartouche{% - \endgroup - \kern3pt - \egroup - \kern3pt\vrule - \hskip\rskip - \egroup - \cartbot - \egroup -\endgroup -}} + \ifhmode\par\fi + \kern3pt + \egroup + \kern3pt\vrule + \hskip\rskip + \egroup + \cartbot + \egroup + \checkinserts +} % This macro is called at the beginning of all the @example variants, % inside a group. \def\nonfillstart{% \aboveenvbreak - \inENV % This group ends at the end of the body \hfuzz = 12pt % Don't be fussy \sepspaces % Make spaces be word-separators rather than space tokens. - \singlespace \let\par = \lisppar % don't ignore blank lines \obeylines % each line of input is a line of output \parskip = 0pt @@ -3835,114 +4798,99 @@ width0pt\relax} \fi \ifx\nonarrowing\relax \advance \leftskip by \lispnarrowing \exdentamount=\lispnarrowing - \let\exdent=\nofillexdent - \let\nonarrowing=\relax + \fi + \let\exdent=\nofillexdent +} + +% If you want all examples etc. small: @set dispenvsize small. +% If you want even small examples the full size: @set dispenvsize nosmall. +% This affects the following displayed environments: +% @example, @display, @format, @lisp +% +\def\smallword{small} +\def\nosmallword{nosmall} +\let\SETdispenvsize\relax +\def\setnormaldispenv{% + \ifx\SETdispenvsize\smallword + \smallexamplefonts \rm + \fi +} +\def\setsmalldispenv{% + \ifx\SETdispenvsize\nosmallword + \else + \smallexamplefonts \rm \fi } -% Define the \E... control sequence only if we are inside the particular -% environment, so the error checking in \end will work. -% -% To end an @example-like environment, we first end the paragraph (via -% \afterenvbreak's vertical glue), and then the group. That way we keep -% the zero \parskip that the environments set -- \parskip glue will be -% inserted at the beginning of the next paragraph in the document, after -% the environment. -% -\def\nonfillfinish{\afterenvbreak\endgroup} +% We often define two environments, @foo and @smallfoo. +% Let's do it by one command: +\def\makedispenv #1#2{ + \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2} + \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2} + \expandafter\let\csname E#1\endcsname \afterenvbreak + \expandafter\let\csname Esmall#1\endcsname \afterenvbreak +} -% @lisp: indented, narrowed, typewriter font. -\def\lisp{\begingroup +% Define two synonyms: +\def\maketwodispenvs #1#2#3{ + \makedispenv{#1}{#3} + \makedispenv{#2}{#3} +} + +% @lisp: indented, narrowed, typewriter font; @example: same as @lisp. +% +% @smallexample and @smalllisp: use smaller fonts. +% Originally contributed by Pavel@xerox. +% +\maketwodispenvs {lisp}{example}{% \nonfillstart - \let\Elisp = \nonfillfinish \tt \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. \gobble % eat return } -% @example: Same as @lisp. -\def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp} - -% @small... is usually equivalent to the non-small (@smallbook -% redefines). We must call \example (or whatever) last in the -% definition, since it reads the return following the @example (or -% whatever) command. -% -% This actually allows (for example) @end display inside an -% @smalldisplay. Too bad, but makeinfo will catch the error anyway. +% @display/@smalldisplay: same as @lisp except keep current font. % -\def\smalldisplay{\begingroup\def\Esmalldisplay{\nonfillfinish\endgroup}\display} -\def\smallexample{\begingroup\def\Esmallexample{\nonfillfinish\endgroup}\lisp} -\def\smallformat{\begingroup\def\Esmallformat{\nonfillfinish\endgroup}\format} -\def\smalllisp{\begingroup\def\Esmalllisp{\nonfillfinish\endgroup}\lisp} - -% Real @smallexample and @smalllisp (when @smallbook): use smaller fonts. -% Originally contributed by Pavel@xerox. -\def\smalllispx{\begingroup - \def\Esmalllisp{\nonfillfinish\endgroup}% - \def\Esmallexample{\nonfillfinish\endgroup}% - \indexfonts - \lisp -} - -% @display: same as @lisp except keep current font. -% -\def\display{\begingroup +\makedispenv {display}{% \nonfillstart - \let\Edisplay = \nonfillfinish \gobble } -% @smalldisplay (when @smallbook): @display plus smaller fonts. +% @format/@smallformat: same as @display except don't narrow margins. % -\def\smalldisplayx{\begingroup - \def\Esmalldisplay{\nonfillfinish\endgroup}% - \indexfonts \rm - \display -} - -% @format: same as @display except don't narrow margins. -% -\def\format{\begingroup - \let\nonarrowing = t +\makedispenv{format}{% + \let\nonarrowing = t% \nonfillstart - \let\Eformat = \nonfillfinish \gobble } -% @smallformat (when @smallbook): @format plus smaller fonts. -% -\def\smallformatx{\begingroup - \def\Esmallformat{\nonfillfinish\endgroup}% - \indexfonts \rm - \format +% @flushleft: same as @format, but doesn't obey \SETdispenvsize. +\envdef\flushleft{% + \let\nonarrowing = t% + \nonfillstart + \gobble } - -% @flushleft (same as @format). -% -\def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format} +\let\Eflushleft = \afterenvbreak % @flushright. -% -\def\flushright{\begingroup - \let\nonarrowing = t +% +\envdef\flushright{% + \let\nonarrowing = t% \nonfillstart - \let\Eflushright = \nonfillfinish \advance\leftskip by 0pt plus 1fill \gobble } +\let\Eflushright = \afterenvbreak + % @quotation does normal linebreaking (hence we can't use \nonfillstart) -% and narrows the margins. +% and narrows the margins. We keep \parskip nonzero in general, since +% we're doing normal filling. So, when using \aboveenvbreak and +% \afterenvbreak, temporarily make \parskip 0. % -\def\quotation{% - \begingroup\inENV %This group ends at the end of the @quotation body +\envdef\quotation{% {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip - \singlespace \parindent=0pt - % We have retained a nonzero parskip for the environment, since we're - % doing normal filling. So to avoid extra space below the environment... - \def\Equotation{\parskip = 0pt \nonfillfinish}% % % @cartouche defines \nonarrowing to inhibit narrowing at next level down. \ifx\nonarrowing\relax @@ -3951,551 +4899,611 @@ width0pt\relax} \fi \exdentamount = \lispnarrowing \let\nonarrowing = \relax \fi + \parsearg\quotationlabel +} + +% We have retained a nonzero parskip for the environment, since we're +% doing normal filling. +% +\def\Equotation{% + \par + \ifx\quotationauthor\undefined\else + % indent a bit. + \leftline{\kern 2\leftskip \sl ---\quotationauthor}% + \fi + {\parskip=0pt \afterenvbreak}% +} + +% If we're given an argument, typeset it in bold with a colon after. +\def\quotationlabel#1{% + \def\temp{#1}% + \ifx\temp\empty \else + {\bf #1: }% + \fi } +% LaTeX-like @verbatim...@end verbatim and @verb{...} +% If we want to allow any as delimiter, +% we need the curly braces so that makeinfo sees the @verb command, eg: +% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org +% +% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. +% +% [Knuth] p.344; only we need to do the other characters Texinfo sets +% active too. Otherwise, they get lost as the first character on a +% verbatim line. +\def\dospecials{% + \do\ \do\\\do\{\do\}\do\$\do\&% + \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% + \do\<\do\>\do\|\do\@\do+\do\"% +} +% +% [Knuth] p. 380 +\def\uncatcodespecials{% + \def\do##1{\catcode`##1=\other}\dospecials} +% +% [Knuth] pp. 380,381,391 +% Disable Spanish ligatures ?` and !` of \tt font +\begingroup + \catcode`\`=\active\gdef`{\relax\lq} +\endgroup +% +% Setup for the @verb command. +% +% Eight spaces for a tab +\begingroup + \catcode`\^^I=\active + \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} +\endgroup +% +\def\setupverb{% + \tt % easiest (and conventionally used) font for verbatim + \def\par{\leavevmode\endgraf}% + \catcode`\`=\active + \tabeightspaces + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces +} + +% Setup for the @verbatim environment +% +% Real tab expansion +\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount +% +\def\starttabbox{\setbox0=\hbox\bgroup} +\begingroup + \catcode`\^^I=\active + \gdef\tabexpand{% + \catcode`\^^I=\active + \def^^I{\leavevmode\egroup + \dimen0=\wd0 % the width so far, or since the previous tab + \divide\dimen0 by\tabw + \multiply\dimen0 by\tabw % compute previous multiple of \tabw + \advance\dimen0 by\tabw % advance to next multiple of \tabw + \wd0=\dimen0 \box0 \starttabbox + }% + } +\endgroup +\def\setupverbatim{% + \nonfillstart + \advance\leftskip by -\defbodyindent + % Easiest (and conventionally used) font for verbatim + \tt + \def\par{\leavevmode\egroup\box0\endgraf}% + \catcode`\`=\active + \tabexpand + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces + \everypar{\starttabbox}% +} + +% Do the @verb magic: verbatim text is quoted by unique +% delimiter characters. Before first delimiter expect a +% right brace, after last delimiter expect closing brace: +% +% \def\doverb'{'#1'}'{#1} +% +% [Knuth] p. 382; only eat outer {} +\begingroup + \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other + \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] +\endgroup +% +\def\verb{\begingroup\setupverb\doverb} +% +% +% Do the @verbatim magic: define the macro \doverbatim so that +% the (first) argument ends when '@end verbatim' is reached, ie: +% +% \def\doverbatim#1@end verbatim{#1} +% +% For Texinfo it's a lot easier than for LaTeX, +% because texinfo's \verbatim doesn't stop at '\end{verbatim}': +% we need not redefine '\', '{' and '}'. +% +% Inspired by LaTeX's verbatim command set [latex.ltx] +% +\begingroup + \catcode`\ =\active + \obeylines % + % ignore everything up to the first ^^M, that's the newline at the end + % of the @verbatim input line itself. Otherwise we get an extra blank + % line in the output. + \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% + % We really want {...\end verbatim} in the body of the macro, but + % without the active space; thus we have to use \xdef and \gobble. +\endgroup +% +\envdef\verbatim{% + \setupverbatim\doverbatim +} +\let\Everbatim = \afterenvbreak + + +% @verbatiminclude FILE - insert text of file in verbatim environment. +% +\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} +% +\def\doverbatiminclude#1{% + {% + \makevalueexpandable + \setupverbatim + \input #1 + \afterenvbreak + }% +} + +% @copying ... @end copying. +% Save the text away for @insertcopying later. Many commands won't be +% allowed in this context, but that's ok. +% +% We save the uninterpreted tokens, rather than creating a box. +% Saving the text in a box would be much easier, but then all the +% typesetting commands (@smallbook, font changes, etc.) have to be done +% beforehand -- and a) we want @copying to be done first in the source +% file; b) letting users define the frontmatter in as flexible order as +% possible is very desirable. +% +\def\copying{\begingroup + % Define a command to swallow text until we reach `@end copying'. + % \ is the escape char in this texinfo.tex file, so it is the + % delimiter for the command; @ will be the escape char when we read + % it, but that doesn't matter. + \long\def\docopying##1\end copying{\gdef\copyingtext{##1}\enddocopying}% + % + % We must preserve ^^M's in the input file; see \insertcopying below. + \catcode`\^^M = \active + \docopying +} + +% What we do to finish off the copying text. +% +\def\enddocopying{\endgroup\ignorespaces} + +% @insertcopying. Here we must play games with ^^M's. On the one hand, +% we need them to delimit commands such as `@end quotation', so they +% must be active. On the other hand, we certainly don't want every +% end-of-line to be a \par, as would happen with the normal active +% definition of ^^M. On the third hand, two ^^M's in a row should still +% generate a \par. +% +% Our approach is to make ^^M insert a space and a penalty1 normally; +% then it can also check if \lastpenalty=1. If it does, then manually +% do \par. +% +% This messes up the normal definitions of @c[omment], so we redefine +% it. Similarly for @ignore. (These commands are used in the gcc +% manual for man page generation.) +% +% Seems pretty fragile, most line-oriented commands will presumably +% fail, but for the limited use of getting the copying text (which +% should be quite simple) inserted, we can hope it's ok. +% +{\catcode`\^^M=\active % +\gdef\insertcopying{\begingroup % + \parindent = 0pt % looks wrong on title page + \def^^M{% + \ifnum \lastpenalty=1 % + \par % + \else % + \space \penalty 1 % + \fi % + }% + % + % Fix @c[omment] for catcode 13 ^^M's. + \def\c##1^^M{\ignorespaces}% + \let\comment = \c % + % + % Don't bother jumping through all the hoops that \doignore does, it + % would be very hard since the catcodes are already set. + \long\def\ignore##1\end ignore{\ignorespaces}% + % + \copyingtext % +\endgroup}% +} + \message{defuns,} -% Define formatter for defuns -% First, allow user to change definition object font (\df) internally -\def\setdeffont #1 {\csname DEF#1\endcsname} +% @defun etc. \newskip\defbodyindent \defbodyindent=.4in \newskip\defargsindent \defargsindent=50pt -\newskip\deftypemargin \deftypemargin=12pt \newskip\deflastargmargin \deflastargmargin=18pt -\newcount\parencount -% define \functionparens, which makes ( and ) and & do special things. -% \functionparens affects the group it is contained in. +% Start the processing of @deffn: +\def\startdefun{% + \ifnum\lastpenalty<10000 + \medbreak + \else + % If there are two @def commands in a row, we'll have a \nobreak, + % which is there to keep the function description together with its + % header. But if there's nothing but headers, we need to allow a + % break somewhere. Check for penalty 10002 (inserted by + % \defargscommonending) instead of 10000, since the sectioning + % commands insert a \penalty10000, and we don't want to allow a break + % between a section heading and a defun. + \ifnum\lastpenalty=10002 \penalty2000 \fi + % + % Similarly, after a section heading, do not allow a break. + % But do insert the glue. + \medskip % preceded by discardable penalty, so not a breakpoint + \fi + % + \parindent=0in + \advance\leftskip by \defbodyindent + \exdentamount=\defbodyindent +} + +\def\dodefunx#1{% + % First, check whether we are in the right environment: + \checkenv#1% + % + % As above, allow line break if we have multiple x headers in a row. + % It's not a great place, though. + \ifnum\lastpenalty=10002 \penalty3000 \fi + % + % And now, it's time to reuse the body of the original defun: + \expandafter\gobbledefun#1% +} +\def\gobbledefun#1\startdefun{} + +% \printdefunline \deffnheader{text} +% +\def\printdefunline#1#2{% + \begingroup + % call \deffnheader: + #1#2 \endheader + % common ending: + \interlinepenalty = 10000 + \advance\rightskip by 0pt plus 1fil + \endgraf + \nobreak\vskip -\parskip + \penalty 10002 % signal to \startdefun and \dodefunx + % Some of the @defun-type tags do not enable magic parentheses, + % rendering the following check redundant. But we don't optimize. + \checkparencounts + \endgroup +} + +\def\Edefun{\endgraf\medbreak} + +% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; +% the only thing remainnig is to define \deffnheader. +% +\def\makedefun#1{% + \expandafter\let\csname E#1\endcsname = \Edefun + \edef\temp{\noexpand\domakedefun + \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% + \temp +} + +% \domakedefun \deffn \deffnx \deffnheader +% +% Define \deffn and \deffnx, without parameters. +% \deffnheader has to be defined explicitly. +% +\def\domakedefun#1#2#3{% + \envdef#1{% + \startdefun + \parseargusing\activeparens{\printdefunline#3}% + }% + \def#2{\dodefunx#1}% + \def#3% +} + +%%% Untyped functions: + +% @deffn category name args +\makedefun{deffn}{\deffngeneral{}} + +% @deffn category class name args +\makedefun{defop}#1 {\defopon{#1\ \putwordon}} + +% \defopon {category on}class name args +\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } + +% \deffngeneral {subind}category name args +% +\def\deffngeneral#1#2 #3 #4\endheader{% + % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}. + \dosubind{fn}{\code{#3}}{#1}% + \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% +} + +%%% Typed functions: + +% @deftypefn category type name args +\makedefun{deftypefn}{\deftypefngeneral{}} + +% @deftypeop category class type name args +\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} + +% \deftypeopon {category on}class type name args +\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } + +% \deftypefngeneral {subind}category type name args +% +\def\deftypefngeneral#1#2 #3 #4 #5\endheader{% + \dosubind{fn}{\code{#4}}{#1}% + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% +} + +%%% Typed variables: + +% @deftypevr category type var args +\makedefun{deftypevr}{\deftypecvgeneral{}} + +% @deftypecv category class type var args +\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} + +% \deftypecvof {category of}class type var args +\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } + +% \deftypecvgeneral {subind}category type var args +% +\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% + \dosubind{vr}{\code{#4}}{#1}% + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% +} + +%%% Untyped variables: + +% @defvr category var args +\makedefun{defvr}#1 {\deftypevrheader{#1} {} } + +% @defcv category class var args +\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} + +% \defcvof {category of}class var args +\def\defcvof#1#2 {\deftypecvof{#1}#2 {} } + +%%% Type: +% @deftp category name args +\makedefun{deftp}#1 #2 #3\endheader{% + \doind{tp}{\code{#2}}% + \defname{#1}{}{#2}\defunargs{#3\unskip}% +} + +% Remaining @defun-like shortcuts: +\makedefun{defun}{\deffnheader{\putwordDeffunc} } +\makedefun{defmac}{\deffnheader{\putwordDefmac} } +\makedefun{defspec}{\deffnheader{\putwordDefspec} } +\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } +\makedefun{defvar}{\defvrheader{\putwordDefvar} } +\makedefun{defopt}{\defvrheader{\putwordDefopt} } +\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } +\makedefun{defmethod}{\defopon\putwordMethodon} +\makedefun{deftypemethod}{\deftypeopon\putwordMethodon} +\makedefun{defivar}{\defcvof\putwordInstanceVariableof} +\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} + +% \defname, which formats the name of the @def (not the args). +% #1 is the category, such as "Function". +% #2 is the return type, if any. +% #3 is the function name. +% +% We are followed by (but not passed) the arguments, if any. +% +\def\defname#1#2#3{% + % Get the values of \leftskip and \rightskip as they were outside the @def... + \advance\leftskip by -\defbodyindent + % + % How we'll format the type name. Putting it in brackets helps + % distinguish it from the body text that may end up on the next line + % just below it. + \def\temp{#1}% + \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} + % + % Figure out line sizes for the paragraph shape. + % The first line needs space for \box0; but if \rightskip is nonzero, + % we need only space for the part of \box0 which exceeds it: + \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip + % The continuations: + \dimen2=\hsize \advance\dimen2 by -\defargsindent + % (plain.tex says that \dimen1 should be used only as global.) + \parshape 2 0in \dimen0 \defargsindent \dimen2 + % + % Put the type name to the right margin. + \noindent + \hbox to 0pt{% + \hfil\box0 \kern-\hsize + % \hsize has to be shortened this way: + \kern\leftskip + % Intentionally do not respect \rightskip, since we need the space. + }% + % + % Allow all lines to be underfull without complaint: + \tolerance=10000 \hbadness=10000 + \exdentamount=\defbodyindent + {% + % defun fonts. We use typewriter by default (used to be bold) because: + % . we're printing identifiers, they should be in tt in principle. + % . in languages with many accents, such as Czech or French, it's + % common to leave accents off identifiers. The result looks ok in + % tt, but exceedingly strange in rm. + % . we don't want -- and --- to be treated as ligatures. + % . this still does not fix the ?` and !` ligatures, but so far no + % one has made identifiers using them :). + \df \tt + \def\temp{#2}% return value type + \ifx\temp\empty\else \tclose{\temp} \fi + #3% output function name + }% + {\rm\enskip}% hskip 0.5 em of \tenrm + % + \boldbrax + % arguments will be output next, if any. +} + +% Print arguments in slanted roman (not ttsl), inconsistently with using +% tt for the name. This is because literal text is sometimes needed in +% the argument list (groff manual), and ttsl and tt are not very +% distinguishable. Prevent hyphenation at `-' chars. +% +\def\defunargs#1{% + % use sl by default (not ttsl), + % tt for the names. + \df \sl \hyphenchar\font=0 + % + % On the other hand, if an argument has two dashes (for instance), we + % want a way to get ttsl. Let's try @var for that. + \let\var=\ttslanted + #1% + \sl\hyphenchar\font=45 +} + +% We want ()&[] to print specially on the defun line. +% \def\activeparens{% -\catcode`\(=\active \catcode`\)=\active \catcode`\&=\active -\catcode`\[=\active \catcode`\]=\active} + \catcode`\(=\active \catcode`\)=\active + \catcode`\[=\active \catcode`\]=\active + \catcode`\&=\active +} % Make control sequences which act like normal parenthesis chars. \let\lparen = ( \let\rparen = ) -{\activeparens % Now, smart parens don't turn on until &foo (see \amprm) - % Be sure that we always have a definition for `(', etc. For example, % if the fn name has parens in it, \boldbrax will not be in effect yet, % so TeX would otherwise complain about undefined control sequence. -\global\let(=\lparen \global\let)=\rparen -\global\let[=\lbrack \global\let]=\rbrack +{ + \activeparens + \global\let(=\lparen \global\let)=\rparen + \global\let[=\lbrack \global\let]=\rbrack + \global\let& = \& -\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 } -\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} -% This is used to turn on special parens -% but make & act ordinary (given that it's active). -\gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr} - -% Definitions of (, ) and & used in args for functions. -% This is the definition of ( outside of all parentheses. -\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested - \global\advance\parencount by 1 + \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} + \gdef\magicamp{\let&=\amprm} } -% -% This is the definition of ( when already inside a level of parens. -\gdef\opnested{\char`\(\global\advance\parencount by 1 } -% -\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0. - % also in that case restore the outer-level definition of (. - \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi - \global\advance \parencount by -1 } + +\newcount\parencount + % If we encounter &foo, then turn on ()-hacking afterwards -\gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ } -% -\gdef\normalparens{\boldbrax\let&=\ampnr} -} % End of definition inside \activeparens -%% These parens (in \boldbrax) actually are a little bolder than the -%% contained text. This is especially needed for [ and ] -\def\opnr{{\sf\char`\(}\global\advance\parencount by 1 } -\def\clnr{{\sf\char`\)}\global\advance\parencount by -1 } -\def\ampnr{\&} -\def\lbrb{{\bf\char`\[}} -\def\rbrb{{\bf\char`\]}} +\newif\ifampseen +\def\amprm#1 {\ampseentrue{\bf\ }} -% First, defname, which formats the header line itself. -% #1 should be the function name. -% #2 should be the type of definition, such as "Function". +\def\parenfont{% + \ifampseen + % At the first level, print parens in roman, + % otherwise use the default font. + \ifnum \parencount=1 \rm \fi + \else + % The \sf parens (in \boldbrax) actually are a little bolder than + % the contained text. This is especially needed for [ and ] . + \sf + \fi +} +\def\infirstlevel#1{% + \ifampseen + \ifnum\parencount=1 + #1% + \fi + \fi +} +\def\bfafterword#1 {#1 \bf} -\def\defname #1#2{% -% Get the values of \leftskip and \rightskip as they were -% outside the @def... -\dimen2=\leftskip -\advance\dimen2 by -\defbodyindent -\noindent -\setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}% -\dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line -\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations -\parshape 2 0in \dimen0 \defargsindent \dimen1 -% Now output arg 2 ("Function" or some such) -% ending at \deftypemargin from the right margin, -% but stuck inside a box of width 0 so it does not interfere with linebreaking -{% Adjust \hsize to exclude the ambient margins, -% so that \rightline will obey them. -\advance \hsize by -\dimen2 -\rlap{\rightline{{\rm #2}\hskip -1.25pc }}}% -% Make all lines underfull and no complaints: -\tolerance=10000 \hbadness=10000 -\advance\leftskip by -\defbodyindent -\exdentamount=\defbodyindent -{\df #1}\enskip % Generate function name +\def\opnr{% + \global\advance\parencount by 1 + {\parenfont(}% + \infirstlevel \bfafterword +} +\def\clnr{% + {\parenfont)}% + \infirstlevel \sl + \global\advance\parencount by -1 } -% Actually process the body of a definition -% #1 should be the terminating control sequence, such as \Edefun. -% #2 should be the "another name" control sequence, such as \defunx. -% #3 should be the control sequence that actually processes the header, -% such as \defunheader. - -\def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2{\begingroup\obeylines\activeparens\spacesplit#3}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup % -\catcode 61=\active % 61 is `=' -\obeylines\activeparens\spacesplit#3} - -% #1 is the \E... control sequence to end the definition (which we define). -% #2 is the \...x control sequence for consecutive fns (which we define). -% #3 is the control sequence to call to resume processing. -% #4, delimited by the space, is the class name. -% -\def\defmethparsebody#1#2#3#4 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\activeparens\spacesplit{#3{#4}}} - -% @deftypemethod has an extra argument that nothing else does. Sigh. -% #1 is the \E... control sequence to end the definition (which we define). -% #2 is the \...x control sequence for consecutive fns (which we define). -% #3 is the control sequence to call to resume processing. -% #4, delimited by the space, is the class name. -% #5 is the method's return type. -% -\def\deftypemethparsebody#1#2#3#4 #5 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\activeparens\spacesplit{#3{#4}{#5}}} - -\def\defopparsebody #1#2#3#4#5 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 ##2 {\def#4{##1}% -\begingroup\obeylines\activeparens\spacesplit{#3{##2}}}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\activeparens\spacesplit{#3{#5}}} - -% These parsing functions are similar to the preceding ones -% except that they do not make parens into active characters. -% These are used for "variables" since they have no arguments. - -\def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2{\begingroup\obeylines\spacesplit#3}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup % -\catcode 61=\active % -\obeylines\spacesplit#3} - -% This is used for \def{tp,vr}parsebody. It could probably be used for -% some of the others, too, with some judicious conditionals. -% -\def\parsebodycommon#1#2#3{% - \begingroup\inENV % - \medbreak % - % Define the end token that this defining construct specifies - % so that it will exit this group. - \def#1{\endgraf\endgroup\medbreak}% - \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}% - \parindent=0in - \advance\leftskip by \defbodyindent - \exdentamount=\defbodyindent - \begingroup\obeylines +\newcount\brackcount +\def\lbrb{% + \global\advance\brackcount by 1 + {\bf[}% +} +\def\rbrb{% + {\bf]}% + \global\advance\brackcount by -1 } -\def\defvrparsebody#1#2#3#4 {% - \parsebodycommon{#1}{#2}{#3}% - \spacesplit{#3{#4}}% +\def\checkparencounts{% + \ifnum\parencount=0 \else \badparencount \fi + \ifnum\brackcount=0 \else \badbrackcount \fi } - -% This loses on `@deftp {Data Type} {struct termios}' -- it thinks the -% type is just `struct', because we lose the braces in `{struct -% termios}' when \spacesplit reads its undelimited argument. Sigh. -% \let\deftpparsebody=\defvrparsebody -% -% So, to get around this, we put \empty in with the type name. That -% way, TeX won't find exactly `{...}' as an undelimited argument, and -% won't strip off the braces. -% -\def\deftpparsebody #1#2#3#4 {% - \parsebodycommon{#1}{#2}{#3}% - \spacesplit{\parsetpheaderline{#3{#4}}}\empty +\def\badparencount{% + \errmessage{Unbalanced parentheses in @def}% + \global\parencount=0 } - -% Fine, but then we have to eventually remove the \empty *and* the -% braces (if any). That's what this does. -% -\def\removeemptybraces\empty#1\relax{#1} - -% After \spacesplit has done its work, this is called -- #1 is the final -% thing to call, #2 the type name (which starts with \empty), and #3 -% (which might be empty) the arguments. -% -\def\parsetpheaderline#1#2#3{% - #1{\removeemptybraces#2\relax}{#3}% -}% - -\def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 ##2 {\def#4{##1}% -\begingroup\obeylines\spacesplit{#3{##2}}}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\spacesplit{#3{#5}}} - -% Split up #2 at the first space token. -% call #1 with two arguments: -% the first is all of #2 before the space token, -% the second is all of #2 after that space token. -% If #2 contains no space token, all of it is passed as the first arg -% and the second is passed as empty. - -{\obeylines -\gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}% -\long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{% -\ifx\relax #3% -#1{#2}{}\else #1{#2}{#3#4}\fi}} - -% So much for the things common to all kinds of definitions. - -% Define @defun. - -% First, define the processing that is wanted for arguments of \defun -% Use this to expand the args and terminate the paragraph they make up - -\def\defunargs #1{\functionparens \sl -% Expand, preventing hyphenation at `-' chars. -% Note that groups don't affect changes in \hyphenchar. -\hyphenchar\tensl=0 -#1% -\hyphenchar\tensl=45 -\ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi% -\interlinepenalty=10000 -\advance\rightskip by 0pt plus 1fil -\endgraf\nobreak\vskip -\parskip\nobreak +\def\badbrackcount{% + \errmessage{Unbalanced square braces in @def}% + \global\brackcount=0 } -\def\deftypefunargs #1{% -% Expand, preventing hyphenation at `-' chars. -% Note that groups don't affect changes in \hyphenchar. -% Use \boldbraxnoamp, not \functionparens, so that & is not special. -\boldbraxnoamp -\tclose{#1}% avoid \code because of side effects on active chars -\interlinepenalty=10000 -\advance\rightskip by 0pt plus 1fil -\endgraf\nobreak\vskip -\parskip\nobreak -} - -% Do complete processing of one @defun or @defunx line already parsed. - -% @deffn Command forward-char nchars - -\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader} - -\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}% -\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @defun == @deffn Function - -\def\defun{\defparsebody\Edefun\defunx\defunheader} - -\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{Function}% -\defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @deftypefun int foobar (int @var{foo}, float @var{bar}) - -\def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader} - -% #1 is the data type. #2 is the name and args. -\def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax} -% #1 is the data type, #2 the name, #3 the args. -\def\deftypefunheaderx #1#2 #3\relax{% -\doind {fn}{\code{#2}}% Make entry in function index -\begingroup\defname {\defheaderxcond#1\relax$$$#2}{Function}% -\deftypefunargs {#3}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar}) - -\def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader} - -% \defheaderxcond#1\relax$$$ -% puts #1 in @code, followed by a space, but does nothing if #1 is null. -\def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi} - -% #1 is the classification. #2 is the data type. #3 is the name and args. -\def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax} -% #1 is the classification, #2 the data type, #3 the name, #4 the args. -\def\deftypefnheaderx #1#2#3 #4\relax{% -\doind {fn}{\code{#3}}% Make entry in function index -\begingroup -\normalparens % notably, turn off `&' magic, which prevents -% at least some C++ text from working -\defname {\defheaderxcond#2\relax$$$#3}{#1}% -\deftypefunargs {#4}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @defmac == @deffn Macro - -\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader} - -\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{Macro}% -\defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @defspec == @deffn Special Form - -\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader} - -\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{Special Form}% -\defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% This definition is run if you use @defunx -% anywhere other than immediately after a @defun or @defunx. - -\def\deffnx #1 {\errmessage{@deffnx in invalid context}} -\def\defunx #1 {\errmessage{@defunx in invalid context}} -\def\defmacx #1 {\errmessage{@defmacx in invalid context}} -\def\defspecx #1 {\errmessage{@defspecx in invalid context}} -\def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}} -\def\deftypemethodx #1 {\errmessage{@deftypemethodx in invalid context}} -\def\deftypefunx #1 {\errmessage{@deftypefunx in invalid context}} - -% @defmethod, and so on - -% @defop CATEGORY CLASS OPERATION ARG... - -\def\defop #1 {\def\defoptype{#1}% -\defopparsebody\Edefop\defopx\defopheader\defoptype} - -\def\defopheader #1#2#3{% -\dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index -\begingroup\defname {#2}{\defoptype{} on #1}% -\defunargs {#3}\endgroup % -} - -% @deftypemethod CLASS RETURN-TYPE METHOD ARG... -% -\def\deftypemethod{% - \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader} -% -% #1 is the class name, #2 the data type, #3 the method name, #4 the args. -\def\deftypemethodheader#1#2#3#4{% - \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index - \begingroup - \defname{\defheaderxcond#2\relax$$$#3}{\putwordMethodon\ \code{#1}}% - \deftypefunargs{#4}% - \endgroup -} - -% @defmethod == @defop Method -% -\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader} -% -% #1 is the class name, #2 the method name, #3 the args. -\def\defmethodheader#1#2#3{% - \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index - \begingroup - \defname{#2}{\putwordMethodon\ \code{#1}}% - \defunargs{#3}% - \endgroup -} - -% @defcv {Class Option} foo-class foo-flag - -\def\defcv #1 {\def\defcvtype{#1}% -\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype} - -\def\defcvarheader #1#2#3{% -\dosubind {vr}{\code{#2}}{of #1}% Make entry in var index -\begingroup\defname {#2}{\defcvtype{} of #1}% -\defvarargs {#3}\endgroup % -} - -% @defivar == @defcv {Instance Variable} - -\def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader} - -\def\defivarheader #1#2#3{% -\dosubind {vr}{\code{#2}}{of #1}% Make entry in var index -\begingroup\defname {#2}{Instance Variable of #1}% -\defvarargs {#3}\endgroup % -} - -% These definitions are run if you use @defmethodx, etc., -% anywhere other than immediately after a @defmethod, etc. - -\def\defopx #1 {\errmessage{@defopx in invalid context}} -\def\defmethodx #1 {\errmessage{@defmethodx in invalid context}} -\def\defcvx #1 {\errmessage{@defcvx in invalid context}} -\def\defivarx #1 {\errmessage{@defivarx in invalid context}} - -% Now @defvar - -% First, define the processing that is wanted for arguments of @defvar. -% This is actually simple: just print them in roman. -% This must expand the args and terminate the paragraph they make up -\def\defvarargs #1{\normalparens #1% -\interlinepenalty=10000 -\endgraf\nobreak\vskip -\parskip\nobreak} - -% @defvr Counter foo-count - -\def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader} - -\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}% -\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup} - -% @defvar == @defvr Variable - -\def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader} - -\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index -\begingroup\defname {#1}{Variable}% -\defvarargs {#2}\endgroup % -} - -% @defopt == @defvr {User Option} - -\def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader} - -\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index -\begingroup\defname {#1}{User Option}% -\defvarargs {#2}\endgroup % -} - -% @deftypevar int foobar - -\def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader} - -% #1 is the data type. #2 is the name, perhaps followed by text that -% is actually part of the data type, which should not be put into the index. -\def\deftypevarheader #1#2{% -\dovarind#2 \relax% Make entry in variables index -\begingroup\defname {\defheaderxcond#1\relax$$$#2}{Variable}% -\interlinepenalty=10000 -\endgraf\nobreak\vskip -\parskip\nobreak -\endgroup} -\def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}} - -% @deftypevr {Global Flag} int enable - -\def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader} - -\def\deftypevrheader #1#2#3{\dovarind#3 \relax% -\begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1} -\interlinepenalty=10000 -\endgraf\nobreak\vskip -\parskip\nobreak -\endgroup} - -% This definition is run if you use @defvarx -% anywhere other than immediately after a @defvar or @defvarx. - -\def\defvrx #1 {\errmessage{@defvrx in invalid context}} -\def\defvarx #1 {\errmessage{@defvarx in invalid context}} -\def\defoptx #1 {\errmessage{@defoptx in invalid context}} -\def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}} -\def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}} - -% Now define @deftp -% Args are printed in bold, a slight difference from @defvar. - -\def\deftpargs #1{\bf \defvarargs{#1}} - -% @deftp Class window height width ... - -\def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader} - -\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}% -\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup} - -% This definition is run if you use @deftpx, etc -% anywhere other than immediately after a @deftp, etc. - -\def\deftpx #1 {\errmessage{@deftpx in invalid context}} - \message{macros,} % @macro. -% To do this right we need a feature of e-TeX, \scantokens, +% To do this right we need a feature of e-TeX, \scantokens, % which we arrange to emulate with a temporary file in ordinary TeX. \ifx\eTeXversion\undefined - \newwrite\macscribble - \def\scanmacro#1{% - \begingroup \newlinechar`\^^M - \immediate\openout\macscribble=\jobname.tmp - \immediate\write\macscribble{#1}% - \immediate\closeout\macscribble - \let\xeatspaces\eatspaces - \input \jobname.tmp - \endgroup -} -\else -\def\scanmacro#1{% -\begingroup \newlinechar`\^^M -\let\xeatspaces\eatspaces\scantokens{#1}\endgroup} + \newwrite\macscribble + \def\scantokens#1{% + \toks0={#1\endinput}% + \immediate\openout\macscribble=\jobname.tmp + \immediate\write\macscribble{\the\toks0}% + \immediate\closeout\macscribble + \input \jobname.tmp + } \fi +\def\scanmacro#1{% + \begingroup + \newlinechar`\^^M + \let\xeatspaces\eatspaces + % Undo catcode changes of \startcontents and \doprintindex + \catcode`\@=0 \catcode`\\=\other \escapechar=`\@ + % ... and \example + \spaceisspace + % + % Append \endinput to make sure that TeX does not see the ending newline. + % + % I've verified that it is necessary both for e-TeX and for ordinary TeX + % --kasal, 29nov03 + \scantokens{#1\endinput}% + \endgroup +} + \newcount\paramno % Count of parameters \newtoks\macname % Macro name \newif\ifrecursive % Is it recursive? +\def\macrolist{} % List of all defined macros in the form + % \do\macro1\do\macro2... % Utility routines. -% Thisdoes \let #1 = #2, except with \csnames. +% This does \let #1 = #2, except with \csnames. \def\cslet#1#2{% \expandafter\expandafter \expandafter\let @@ -4514,7 +5522,7 @@ width0pt\relax} \fi } % Trim a single trailing ^^M off a string. -{\catcode`\^^M=12\catcode`\Q=3% +{\catcode`\^^M=\other \catcode`\Q=3% \gdef\eatcr #1{\eatcra #1Q^^MQ}% \gdef\eatcra#1^^MQ{\eatcrb#1Q}% \gdef\eatcrb#1Q#2Q{#1}% @@ -4524,37 +5532,37 @@ width0pt\relax} \fi % all characters are catcode 10, 11 or 12, except \ which is active % (as in normal texinfo). It is necessary to change the definition of \. -% It's necessary to have hard CRs when the macro is executed. This is -% done by making ^^M (\endlinechar) catcode 12 when reading the macro +% It's necessary to have hard CRs when the macro is executed. This is +% done by making ^^M (\endlinechar) catcode 12 when reading the macro % body, and then making it the \newlinechar in \scanmacro. \def\macrobodyctxt{% - \catcode`\~=12 - \catcode`\^=12 - \catcode`\_=12 - \catcode`\|=12 - \catcode`\<=12 - \catcode`\>=12 - \catcode`\+=12 - \catcode`\{=12 - \catcode`\}=12 - \catcode`\@=12 - \catcode`\^^M=12 + \catcode`\~=\other + \catcode`\^=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\+=\other + \catcode`\{=\other + \catcode`\}=\other + \catcode`\@=\other + \catcode`\^^M=\other \usembodybackslash} \def\macroargctxt{% - \catcode`\~=12 - \catcode`\^=12 - \catcode`\_=12 - \catcode`\|=12 - \catcode`\<=12 - \catcode`\>=12 - \catcode`\+=12 - \catcode`\@=12 - \catcode`\\=12} + \catcode`\~=\other + \catcode`\^=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\+=\other + \catcode`\@=\other + \catcode`\\=\other} % \mbodybackslash is the definition of \ in @macro bodies. -% It maps \foo\ => \csname macarg.foo\endcsname => #N +% It maps \foo\ => \csname macarg.foo\endcsname => #N % where N is the macro parameter number. % We define \csname macarg.\endcsname to be \realbackslash, so % \\ in macro replacement text gets you a backslash. @@ -4573,25 +5581,48 @@ width0pt\relax} \fi \ifx\argl\empty % no arguments \paramno=0% \else - \expandafter\parsemargdef \argl;% + \expandafter\parsemargdef \argl;% \fi - \expandafter\ifx \csname macsave.\the\macname\endcsname \relax - \cslet{macsave.\the\macname}{\the\macname}% - \else + \if1\csname ismacro.\the\macname\endcsname \message{Warning: redefining \the\macname}% + \else + \expandafter\ifx\csname \the\macname\endcsname \relax + \else \errmessage{Macro name \the\macname\space already defined}\fi + \global\cslet{macsave.\the\macname}{\the\macname}% + \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% + % Add the macroname to \macrolist + \toks0 = \expandafter{\macrolist\do}% + \xdef\macrolist{\the\toks0 + \expandafter\noexpand\csname\the\macname\endcsname}% \fi \begingroup \macrobodyctxt \ifrecursive \expandafter\parsermacbody - \else \expandafter\parsemacbody + \else \expandafter\parsemacbody \fi} -\def\unmacro{\parsearg\unmacroxxx} -\def\unmacroxxx#1{% - \expandafter\ifx \csname macsave.\the\macname\endcsname \relax - \errmessage{Macro \the\macname\ not defined.}% +\parseargdef\unmacro{% + \if1\csname ismacro.#1\endcsname + \global\cslet{#1}{macsave.#1}% + \global\expandafter\let \csname ismacro.#1\endcsname=0% + % Remove the macro name from \macrolist: + \begingroup + \expandafter\let\csname#1\endcsname \relax + \let\do\unmacrodo + \xdef\macrolist{\macrolist}% + \endgroup \else - \cslet{#1}{macsave.#1}% - \expandafter\let \csname macsave.\the\macname\endcsname \undefined + \errmessage{Macro #1 not defined}% + \fi +} + +% Called by \do from \dounmacro on each macro. The idea is to omit any +% macro definitions that have been changed to \relax. +% +\def\unmacrodo#1{% + \ifx#1\relax + % remove this + \else + \noexpand\do \noexpand #1% \fi } @@ -4650,19 +5681,20 @@ width0pt\relax} \fi \or % 1 \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt - \noexpand\braceorline\csname\the\macname xxx\endcsname}% + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname xxx\endcsname}% \expandafter\xdef\csname\the\macname xxx\endcsname##1{% \egroup\noexpand\scanmacro{\temp}}% \else % many \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt - \noexpand\csname\the\macname xx\endcsname} + \noexpand\csname\the\macname xx\endcsname}% \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \csname\the\macname xxx\endcsname ##1,}% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% \expandafter\expandafter \expandafter\xdef \expandafter\expandafter - \csname\the\macname xxx\endcsname + \csname\the\macname xxx\endcsname \paramlist{\egroup\noexpand\scanmacro{\temp}}% \fi \else @@ -4674,7 +5706,8 @@ width0pt\relax} \fi \or % 1 \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt - \noexpand\braceorline\csname\the\macname xxx\endcsname}% + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname xxx\endcsname}% \expandafter\xdef\csname\the\macname xxx\endcsname##1{% \egroup \noexpand\norecurse{\the\macname}% @@ -4682,9 +5715,9 @@ width0pt\relax} \fi \else % many \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt - \noexpand\csname\the\macname xx\endcsname} + \expandafter\noexpand\csname\the\macname xx\endcsname}% \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \csname\the\macname xxx\endcsname ##1,}% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% \expandafter\expandafter \expandafter\xdef \expandafter\expandafter @@ -4705,11 +5738,45 @@ width0pt\relax} \fi \def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx} \def\braceorlinexxx{% \ifx\nchar\bgroup\else - \expandafter\parsearg + \expandafter\parsearg \fi \next} +% We want to disable all macros during \shipout so that they are not +% expanded by \write. +\def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}% + \edef\next{\macrolist}\expandafter\endgroup\next} + +% For \indexnofonts, we need to get rid of all macros, leaving only the +% arguments (if present). Of course this is not nearly correct, but it +% is the best we can do for now. makeinfo does not expand macros in the +% argument to @deffn, which ends up writing an index entry, and texindex +% isn't prepared for an index sort entry that starts with \. +% +% Since macro invocations are followed by braces, we can just redefine them +% to take a single TeX argument. The case of a macro invocation that +% goes to end-of-line is not handled. +% +\def\emptyusermacros{\begingroup + \def\do##1{\let\noexpand##1=\noexpand\asis}% + \edef\next{\macrolist}\expandafter\endgroup\next} + + +% @alias. +% We need some trickery to remove the optional spaces around the equal +% sign. Just make them active and then expand them all to nothing. +\def\alias{\parseargusing\obeyspaces\aliasxxx} +\def\aliasxxx #1{\aliasyyy#1\relax} +\def\aliasyyy #1=#2\relax{% + {% + \expandafter\let\obeyedspace=\empty + \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% + }% + \next +} + \message{cross references,} + \newwrite\auxfile \newif\ifhavexrefs % True if xref values are known. @@ -4720,53 +5787,70 @@ width0pt\relax} \fi \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, node \samp{\ignorespaces#1{}}} -% @node's job is to define \lastnode. -\def\node{\ENVcheck\parsearg\nodezzz} -\def\nodezzz#1{\nodexxx [#1,]} -\def\nodexxx[#1,#2]{\gdef\lastnode{#1}} +% @node's only job in TeX is to define \lastnode, which is used in +% cross-references. The @node line might or might not have commas, and +% might or might not have spaces before the first comma, like: +% @node foo , bar , ... +% We don't want such trailing spaces in the node name. +% +\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} +% +% also remove a trailing comma, in case of something like this: +% @node Help-Cross, , , Cross-refs +\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} +\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}} + \let\nwnode=\node -\let\lastnode=\relax +\let\lastnode=\empty -% The sectioning commands (@chapter, etc.) call these. -\def\donoderef{% - \ifx\lastnode\relax\else - \expandafter\expandafter\expandafter\setref{\lastnode}% - {Ysectionnumberandtype}% - \global\let\lastnode=\relax +% Write a cross-reference definition for the current node. #1 is the +% type (Ynumbered, Yappendix, Ynothing). +% +\def\donoderef#1{% + \ifx\lastnode\empty\else + \setref{\lastnode}{#1}% + \global\let\lastnode=\empty \fi } -\def\unnumbnoderef{% - \ifx\lastnode\relax\else - \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}% - \global\let\lastnode=\relax - \fi -} -\def\appendixnoderef{% - \ifx\lastnode\relax\else - \expandafter\expandafter\expandafter\setref{\lastnode}% - {Yappendixletterandtype}% - \global\let\lastnode=\relax - \fi -} - % @anchor{NAME} -- define xref target at arbitrary point. -% -\def\anchor#1{\setref{#1}{Ynothing}} +% +\newcount\savesfregister +% +\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} +\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} +\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} - -% \setref{NAME}{SNT} defines a cross-reference point NAME, namely -% NAME-title, NAME-pg, and NAME-SNT. Called from \foonoderef. We have -% to set \indexdummies so commands such as @code in a section title -% aren't expanded. It would be nicer not to expand the titles in the -% first place, but there's so many layers that that is hard to do. -% -\def\setref#1#2{{% - \indexdummies - \dosetq{#1-title}{Ytitle}% - \dosetq{#1-pg}{Ypagenumber}% - \dosetq{#1-snt}{#2} -}} +% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an +% anchor), which consists of three parts: +% 1) NAME-title - the current sectioning name taken from \thissection, +% or the anchor name. +% 2) NAME-snt - section number and type, passed as the SNT arg, or +% empty for anchors. +% 3) NAME-pg - the page number. +% +% This is called from \donoderef, \anchor, and \dofloat. In the case of +% floats, there is an additional part, which is not written here: +% 4) NAME-lof - the text as it should appear in a @listoffloats. +% +\def\setref#1#2{% + \pdfmkdest{#1}% + \iflinks + {% + \atdummies % preserve commands, but don't expand them + \turnoffactive + \otherbackslash + \edef\writexrdef##1##2{% + \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef + ##1}{##2}}% these are parameters of \writexrdef + }% + \toks0 = \expandafter{\thissection}% + \immediate \writexrdef{title}{\the\toks0 }% + \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. + \writexrdef{pg}{\folio}% will be written later, during \shipout + }% + \fi +} % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is % the node name, #2 the name of the Info cross-reference, #3 the printed @@ -4777,122 +5861,158 @@ width0pt\relax} \fi \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} \def\ref#1{\xrefX[#1,,,,,,,]} \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup + \unsepspaces \def\printedmanual{\ignorespaces #5}% - \def\printednodename{\ignorespaces #3}% - \setbox1=\hbox{\printedmanual}% - \setbox0=\hbox{\printednodename}% + \def\printedrefname{\ignorespaces #3}% + \setbox1=\hbox{\printedmanual\unskip}% + \setbox0=\hbox{\printedrefname\unskip}% \ifdim \wd0 = 0pt % No printed node name was explicitly given. \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax % Use the node name inside the square brackets. - \def\printednodename{\ignorespaces #1}% + \def\printedrefname{\ignorespaces #1}% \else % Use the actual chapter/section title appear inside % the square brackets. Use the real section title if we have it. \ifdim \wd1 > 0pt % It is in another manual, so we don't have it. - \def\printednodename{\ignorespaces #1}% + \def\printedrefname{\ignorespaces #1}% \else \ifhavexrefs % We know the real title if we have the xref values. - \def\printednodename{\refx{#1-title}{}}% + \def\printedrefname{\refx{#1-title}{}}% \else % Otherwise just copy the Info node name. - \def\printednodename{\ignorespaces #1}% + \def\printedrefname{\ignorespaces #1}% \fi% \fi \fi \fi % - % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not - % insert empty discretionaries after hyphens, which means that it will - % not find a line break at a hyphen in a node names. Since some manuals - % are best written with fairly long node names, containing hyphens, this - % is a loss. Therefore, we give the text of the node name again, so it - % is as if TeX is seeing it for the first time. - \ifdim \wd1 > 0pt - \putwordsection{} ``\printednodename'' in \cite{\printedmanual}% - \else - % _ (for example) has to be the character _ for the purposes of the - % control sequence corresponding to the node, but it has to expand - % into the usual \leavevmode...\vrule stuff for purposes of - % printing. So we \turnoffactive for the \refx-snt, back on for the - % printing, back off for the \refx-pg. - {\normalturnoffactive - % Only output a following space if the -snt ref is nonempty; for - % @unnumbered and @anchor, it won't be. - \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% - \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi + % Make link in pdf output. + \ifpdf + \leavevmode + \getfilename{#4}% + {\turnoffactive \otherbackslash + \ifnum\filenamelength>0 + \startlink attr{/Border [0 0 0]}% + goto file{\the\filename.pdf} name{#1}% + \else + \startlink attr{/Border [0 0 0]}% + goto name{\pdfmkpgn{#1}}% + \fi }% - % [mynode], - [\printednodename],\space - % page 3 - \turnoffactive \putwordpage\tie\refx{#1-pg}{}% + \linkcolor \fi + % + % Float references are printed completely differently: "Figure 1.2" + % instead of "[somenode], p.3". We distinguish them by the + % LABEL-title being set to a magic string. + {% + % Have to otherify everything special to allow the \csname to + % include an _ in the xref name, etc. + \indexnofonts + \turnoffactive + \otherbackslash + \expandafter\global\expandafter\let\expandafter\Xthisreftitle + \csname XR#1-title\endcsname + }% + \iffloat\Xthisreftitle + % If the user specified the print name (third arg) to the ref, + % print it instead of our usual "Figure 1.2". + \ifdim\wd0 = 0pt + \refx{#1-snt}% + \else + \printedrefname + \fi + % + % if the user also gave the printed manual name (fifth arg), append + % "in MANUALNAME". + \ifdim \wd1 > 0pt + \space \putwordin{} \cite{\printedmanual}% + \fi + \else + % node/anchor (non-float) references. + % + % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not + % insert empty discretionaries after hyphens, which means that it will + % not find a line break at a hyphen in a node names. Since some manuals + % are best written with fairly long node names, containing hyphens, this + % is a loss. Therefore, we give the text of the node name again, so it + % is as if TeX is seeing it for the first time. + \ifdim \wd1 > 0pt + \putwordsection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% + \else + % _ (for example) has to be the character _ for the purposes of the + % control sequence corresponding to the node, but it has to expand + % into the usual \leavevmode...\vrule stuff for purposes of + % printing. So we \turnoffactive for the \refx-snt, back on for the + % printing, back off for the \refx-pg. + {\turnoffactive \otherbackslash + % Only output a following space if the -snt ref is nonempty; for + % @unnumbered and @anchor, it won't be. + \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% + \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi + }% + % output the `[mynode]' via a macro so it can be overridden. + \xrefprintnodename\printedrefname + % + % But we always want a comma and a space: + ,\space + % + % output the `page 3'. + \turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}% + \fi + \fi + \endlink \endgroup} -% \dosetq is the interface for calls from other macros - -% Use \normalturnoffactive so that punctuation chars such as underscore -% and backslash work in node names. (\turnoffactive doesn't do \.) -\def\dosetq#1#2{% - {\let\folio=0 - \normalturnoffactive - \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}% - \iflinks - \next - \fi - }% -} - -% \internalsetq {foo}{page} expands into -% CHARACTERS 'xrdef {foo}{...expansion of \Ypage...} -% When the aux file is read, ' is the escape character - -\def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}} - -% Things to be expanded by \internalsetq - -\def\Ypagenumber{\folio} - -\def\Ytitle{\thissection} - -\def\Ynothing{} - -\def\Ysectionnumberandtype{% -\ifnum\secno=0 \putwordChapter\xreftie\the\chapno % -\else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno % -\else \ifnum \subsubsecno=0 % -\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno % -\else % -\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno % -\fi \fi \fi } - -\def\Yappendixletterandtype{% -\ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}% -\else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno % -\else \ifnum \subsubsecno=0 % -\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno % -\else % -\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno % -\fi \fi \fi } - -\gdef\xreftie{'tie} - -% Use TeX 3.0's \inputlineno to get the line number, for better error -% messages, but if we're using an old version of TeX, don't do anything. +% This macro is called from \xrefX for the `[nodename]' part of xref +% output. It's a separate macro only so it can be changed more easily, +% since square brackets don't work well in some documents. Particularly +% one that Bob is working on :). % -\ifx\inputlineno\thisisundefined - \let\linenumber = \empty % Non-3.0. -\else - \def\linenumber{\the\inputlineno:\space} -\fi +\def\xrefprintnodename#1{[#1]} + +% Things referred to by \setref. +% +\def\Ynothing{} +\def\Yomitfromtoc{} +\def\Ynumbered{% + \ifnum\secno=0 + \putwordChapter@tie \the\chapno + \else \ifnum\subsecno=0 + \putwordSection@tie \the\chapno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno + \else + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} +\def\Yappendix{% + \ifnum\secno=0 + \putwordAppendix@tie @char\the\appendixno{}% + \else \ifnum\subsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno + \else + \putwordSection@tie + @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. % If its value is nonempty, SUFFIX is output afterward. - +% \def\refx#1#2{% - \expandafter\ifx\csname X#1\endcsname\relax + {% + \indexnofonts + \otherbackslash + \expandafter\global\expandafter\let\expandafter\thisrefX + \csname XR#1\endcsname + }% + \ifx\thisrefX\relax % If not defined, say something at least. \angleleft un\-de\-fined\angleright \iflinks @@ -4907,21 +6027,49 @@ width0pt\relax} \fi \fi \else % It's defined, so just use it. - \csname X#1\endcsname + \thisrefX \fi #2% Output the suffix in any case. } -% This is the macro invoked by entries in the aux file. -% -\def\xrdef#1{\begingroup - % Reenable \ as an escape while reading the second argument. - \catcode`\\ = 0 - \afterassignment\endgroup - \expandafter\gdef\csname X#1\endcsname +% This is the macro invoked by entries in the aux file. Usually it's +% just a \def (we prepend XR to the control sequence name to avoid +% collisions). But if this is a float type, we have more work to do. +% +\def\xrdef#1#2{% + \expandafter\gdef\csname XR#1\endcsname{#2}% remember this xref value. + % + % Was that xref control sequence that we just defined for a float? + \expandafter\iffloat\csname XR#1\endcsname + % it was a float, and we have the (safe) float type in \iffloattype. + \expandafter\let\expandafter\floatlist + \csname floatlist\iffloattype\endcsname + % + % Is this the first time we've seen this float type? + \expandafter\ifx\floatlist\relax + \toks0 = {\do}% yes, so just \do + \else + % had it before, so preserve previous elements in list. + \toks0 = \expandafter{\floatlist\do}% + \fi + % + % Remember this xref in the control sequence \floatlistFLOATTYPE, + % for later use in \listoffloats. + \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0{#1}}% + \fi } % Read the last existing aux file, if any. No error if none exists. +% +\def\tryauxfile{% + \openin 1 \jobname.aux + \ifeof 1 \else + \readauxfile + \global\havexrefstrue + \fi + \closein 1 +} + \def\readauxfile{\begingroup \catcode`\^^@=\other \catcode`\^^A=\other @@ -4950,9 +6098,7 @@ width0pt\relax} \fi \catcode`\^^]=\other \catcode`\^^^=\other \catcode`\^^_=\other - \catcode`\@=\other - \catcode`\^=\other - % It was suggested to define this as 7, which would allow ^^e4 etc. + % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. % in xref tags, i.e., node names. But since ^^e4 notation isn't % supported in the main text, it doesn't seem desirable. Furthermore, % that is not enough: for node names that actually contain a ^ @@ -4965,6 +6111,9 @@ width0pt\relax} \fi % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter % and then to call \auxhat in \setq. % + \catcode`\^=\other + % + % Special characters. Should be turned off anyway, but... \catcode`\~=\other \catcode`\[=\other \catcode`\]=\other @@ -4976,8 +6125,19 @@ width0pt\relax} \fi \catcode`\$=\other \catcode`\#=\other \catcode`\&=\other + \catcode`\%=\other \catcode`+=\other % avoid \+ for paranoia even though we've turned it off - % Make the characters 128-255 be printing characters + % + % This is to support \ in node names and titles, since the \ + % characters end up in a \csname. It's easier than + % leaving it active and making its active definition an actual \ + % character. What I don't understand is why it works in the *value* + % of the xrdef. Seems like it should be a catcode12 \, and that + % should not typeset properly. But it works, so I'm moving on for + % now. --karl, 15jan04. + \catcode`\\=\other + % + % Make the characters 128-255 be printing characters. {% \count 1=128 \def\loop{% @@ -4986,31 +6146,18 @@ width0pt\relax} \fi \ifnum \count 1<256 \loop \fi }% }% - % The aux file uses ' as the escape (for now). - % Turn off \ as an escape so we do not lose on - % entries which were dumped with control sequences in their names. - % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^ - % Reference to such entries still does not work the way one would wish, - % but at least they do not bomb out when the aux file is read in. + % + % @ is our escape character in .aux files, and we need braces. \catcode`\{=1 \catcode`\}=2 - \catcode`\%=\other - \catcode`\'=0 - \catcode`\\=\other + \catcode`\@=0 % - \openin 1 \jobname.aux - \ifeof 1 \else - \closein 1 - \input \jobname.aux - \global\havexrefstrue - \global\warnedobstrue - \fi - % Open the new aux file. TeX will close it automatically at exit. - \openout\auxfile=\jobname.aux + \input \jobname.aux \endgroup} -% Footnotes. +\message{insertions,} +% including footnotes. \newcount \footnoteno @@ -5024,37 +6171,39 @@ width0pt\relax} \fi % @footnotestyle is meaningful for info output only. \let\footnotestyle=\comment -\let\ptexfootnote=\footnote - {\catcode `\@=11 % % Auto-number footnotes. Otherwise like plain. \gdef\footnote{% + \let\indent=\ptexindent + \let\noindent=\ptexnoindent \global\advance\footnoteno by \@ne \edef\thisfootno{$^{\the\footnoteno}$}% % % In case the footnote comes at the end of a sentence, preserve the % extra spacing after we do the footnote number. \let\@sf\empty - \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi + \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi % % Remove inadvertent blank space before typesetting the footnote number. \unskip \thisfootno\@sf - \footnotezzz + \dofootnote }% % Don't bother with the trickery in plain.tex to not require the % footnote text as a parameter. Our footnotes don't need to be so general. % -% Oh yes, they do; otherwise, @ifset and anything else that uses -% \parseargline fail inside footnotes because the tokens are fixed when +% Oh yes, they do; otherwise, @ifset (and anything else that uses +% \parseargline) fails inside footnotes because the tokens are fixed when % the footnote is read. --karl, 16nov96. % -\long\gdef\footnotezzz{\insert\footins\bgroup +\gdef\dofootnote{% + \insert\footins\bgroup % We want to typeset this text as a normal paragraph, even if the % footnote reference occurs in (for example) a display environment. % So reset some parameters. + \hsize=\pagewidth \interlinepenalty\interfootnotelinepenalty \splittopskip\ht\strutbox % top baseline for broken footnotes \splitmaxdepth\dp\strutbox @@ -5065,8 +6214,17 @@ width0pt\relax} \fi \xspaceskip\z@skip \parindent\defaultparindent % - % Hang the footnote text off the number. - \hang + \smallfonts \rm + % + % Because we use hanging indentation in footnotes, a @noindent appears + % to exdent this text, so make it be a no-op. makeinfo does not use + % hanging indentation so @noindent can still be needed within footnote + % text after an @example or the like (not that this is good style). + \let\noindent = \relax + % + % Hang the footnote text off the number. Use \everypar in case the + % footnote extends for more than one paragraph. + \everypar = {\hang}% \textindent{\thisfootno}% % % Don't crash into the line above the footnote text. Since this @@ -5075,88 +6233,90 @@ width0pt\relax} \fi \footstrut \futurelet\next\fo@t } -\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t - \else\let\next\f@t\fi \next} -\def\f@@t{\bgroup\aftergroup\@foot\let\next} -\def\f@t#1{#1\@foot} -\def\@foot{\strut\egroup} - }%end \catcode `\@=11 -% Set the baselineskip to #1, and the lineskip and strut size -% correspondingly. There is no deep meaning behind these magic numbers -% used as factors; they just match (closely enough) what Knuth defined. +% In case a @footnote appears in a vbox, save the footnote text and create +% the real \insert just after the vbox finished. Otherwise, the insertion +% would be lost. +% Similarily, if a @footnote appears inside an alignment, save the footnote +% text to a box and make the \insert when a row of the table is finished. +% And the same can be done for other insert classes. --kasal, 16nov03. + +% Replace the \insert primitive by a cheating macro. +% Deeper inside, just make sure that the saved insertions are not spilled +% out prematurely. % -\def\lineskipfactor{.08333} -\def\strutheightpercent{.70833} -\def\strutdepthpercent {.29167} -% -\def\setleading#1{% - \normalbaselineskip = #1\relax - \normallineskip = \lineskipfactor\normalbaselineskip - \normalbaselines - \setbox\strutbox =\hbox{% - \vrule width0pt height\strutheightpercent\baselineskip - depth \strutdepthpercent \baselineskip - }% +\def\startsavinginserts{% + \ifx \insert\ptexinsert + \let\insert\saveinsert + \else + \let\checkinserts\relax + \fi } -% @| inserts a changebar to the left of the current line. It should -% surround any changed text. This approach does *not* work if the -% change spans more than two lines of output. To handle that, we would -% have adopt a much more difficult approach (putting marks into the main -% vertical list for the beginning and end of each change). +% This \insert replacement works for both \insert\footins{foo} and +% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. % -\def\|{% - % \vadjust can only be used in horizontal mode. - \leavevmode - % - % Append this vertical mode material after the current line in the output. - \vadjust{% - % We want to insert a rule with the height and depth of the current - % leading; that is exactly what \strutbox is supposed to record. - \vskip-\baselineskip - % - % \vadjust-items are inserted at the left edge of the type. So - % the \llap here moves out into the left-hand margin. - \llap{% - % - % For a thicker or thinner bar, change the `1pt'. - \vrule height\baselineskip width1pt - % - % This is the space between the bar and the text. - \hskip 12pt - }% - }% +\def\saveinsert#1{% + \edef\next{\noexpand\savetobox \makeSAVEname#1}% + \afterassignment\next + % swallow the left brace + \let\temp = +} +\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} +\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} + +\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} + +\def\placesaveins#1{% + \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname + {\box#1}% } -% For a final copy, take out the rectangles -% that mark overfull boxes (in case you have decided -% that the text looks ok even though it passes the margin). -% -\def\finalout{\overfullrule=0pt} +% eat @SAVE -- beware, all of them have catcode \other: +{ + \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) + \gdef\gobblesave @SAVE{} +} + +% initialization: +\def\newsaveins #1{% + \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% + \next +} +\def\newsaveinsX #1{% + \csname newbox\endcsname #1% + \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts + \checksaveins #1}% +} + +% initialize: +\let\checkinserts\empty +\newsaveins\footins +\newsaveins\margin + % @image. We use the macros from epsf.tex to support this. % If epsf.tex is not installed and @image is used, we complain. -% +% % Check for and read epsf.tex up front. If we read it only at @image % time, we might be inside a group, and then its definitions would get % undone and the next image would fail. \openin 1 = epsf.tex \ifeof 1 \else - \closein 1 - % Do not bother showing banner with post-v2.7 epsf.tex (available in - % doc/epsf.tex until it shows up on ctan). + % Do not bother showing banner with epsf.tex v2.7k (available in + % doc/epsf.tex and on ctan). \def\epsfannounce{\toks0 = }% \input epsf.tex \fi +\closein 1 % +% We will only complain once about lack of epsf.tex. \newif\ifwarnednoepsf \newhelp\noepsfhelp{epsf.tex must be installed for images to work. It is also included in the Texinfo distribution, or you can get - it from ftp://ftp.tug.org/tex/epsf.tex.} + it from ftp://tug.org/tex/epsf.tex.} % -% Only complain once about lack of epsf.tex. \def\image#1{% \ifx\epsfbox\undefined \ifwarnednoepsf \else @@ -5165,33 +6325,325 @@ width0pt\relax} \fi \global\warnednoepsftrue \fi \else - \imagexxx #1,,,\finish + \imagexxx #1,,,,,\finish \fi } % % Arguments to @image: % #1 is (mandatory) image filename; we tack on .eps extension. % #2 is (optional) width, #3 is (optional) height. -% #4 is just the usual extra ignored arg for parsing this stuff. -\def\imagexxx#1,#2,#3,#4\finish{% - % \epsfbox itself resets \epsf?size at each figure. - \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi - \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi +% #4 is (ignored optional) html alt text. +% #5 is (ignored optional) extension. +% #6 is just the usual extra ignored arg for parsing this stuff. +\newif\ifimagevmode +\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup + \catcode`\^^M = 5 % in case we're inside an example + \normalturnoffactive % allow _ et al. in names % If the image is by itself, center it. \ifvmode - \nobreak\medskip + \imagevmodetrue + \nobreak\bigskip + % Usually we'll have text after the image which will insert + % \parskip glue, so insert it here too to equalize the space + % above and below. + \nobreak\vskip\parskip \nobreak - \centerline{\epsfbox{#1.eps}}% - \bigbreak + \line\bgroup\hss + \fi + % + % Output the image. + \ifpdf + \dopdfimage{#1}{#2}{#3}% \else + % \epsfbox itself resets \epsf?size at each figure. + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi + \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi \epsfbox{#1.eps}% \fi + % + \ifimagevmode \hss \egroup \bigbreak \fi % space after the image +\endgroup} + + +% @float FLOATTYPE,LOC ... @end float for displayed figures, tables, etc. +% We don't actually implement floating yet, we just plop the float "here". +% But it seemed the best name for the future. +% +\envparseargdef\float{\dofloat #1,,,\finish} + +% #1 is the optional FLOATTYPE, the text label for this float, typically +% "Figure", "Table", "Example", etc. Can't contain commas. If omitted, +% this float will not be numbered and cannot be referred to. +% +% #2 is the optional xref label. Also must be present for the float to +% be referable. +% +% #3 is the optional positioning argument; for now, it is ignored. It +% will somehow specify the positions allowed to float to (here, top, bottom). +% +% We keep a separate counter for each FLOATTYPE, which we reset at each +% chapter-level command. +\let\resetallfloatnos=\empty +% +\def\dofloat#1,#2,#3,#4\finish{% + \let\thiscaption=\empty + \let\thisshortcaption=\empty + % + % don't lose footnotes inside @float. + \startsavinginserts + % + % We can't be used inside a paragraph. + \par + % + \vtop\bgroup + \def\floattype{#1}% + \def\floatlabel{#2}% + \def\floatloc{#3}% we do nothing with this yet. + % + \ifx\floattype\empty + \let\safefloattype=\empty + \else + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + \fi + % + % If label is given but no type, we handle that as the empty type. + \ifx\floatlabel\empty \else + % We want each FLOATTYPE to be numbered separately (Figure 1, + % Table 1, Figure 2, ...). (And if no label, no number.) + % + \expandafter\getfloatno\csname\safefloattype floatno\endcsname + \global\advance\floatno by 1 + % + {% + % This magic value for \thissection is output by \setref as the + % XREFLABEL-title value. \xrefX uses it to distinguish float + % labels (which have a completely different output format) from + % node and anchor labels. And \xrdef uses it to construct the + % lists of floats. + % + \edef\thissection{\floatmagic=\safefloattype}% + \setref{\floatlabel}{Yfloat}% + }% + \fi + % + % start with \parskip glue, I guess. + \vskip\parskip + % + % Don't suppress indentation if a float happens to start a section. + \restorefirstparagraphindent +} + +% we have these possibilities: +% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap +% @float Foo,lbl & no caption: Foo 1.1 +% @float Foo & @caption{Cap}: Foo: Cap +% @float Foo & no caption: Foo +% @float ,lbl & Caption{Cap}: 1.1: Cap +% @float ,lbl & no caption: 1.1 +% @float & @caption{Cap}: Cap +% @float & no caption: +% +\def\Efloat{% + \let\floatident = \empty + % + % In all cases, if we have a float type, it comes first. + \ifx\floattype\empty \else \def\floatident{\floattype}\fi + % + % If we have an xref label, the number comes next. + \ifx\floatlabel\empty \else + \ifx\floattype\empty \else % if also had float type, need tie first. + \appendtomacro\floatident{\tie}% + \fi + % the number. + \appendtomacro\floatident{\chaplevelprefix\the\floatno}% + \fi + % + % Start the printed caption with what we've constructed in + % \floatident, but keep it separate; we need \floatident again. + \let\captionline = \floatident + % + \ifx\thiscaption\empty \else + \ifx\floatident\empty \else + \appendtomacro\captionline{: }% had ident, so need a colon between + \fi + % + % caption text. + \appendtomacro\captionline\thiscaption + \fi + % + % If we have anything to print, print it, with space before. + % Eventually this needs to become an \insert. + \ifx\captionline\empty \else + \vskip.5\parskip + \captionline + \fi + % + % If have an xref label, write the list of floats info. Do this + % after the caption, to avoid chance of it being a breakpoint. + \ifx\floatlabel\empty \else + % Write the text that goes in the lof to the aux file as + % \floatlabel-lof. Besides \floatident, we include the short + % caption if specified, else the full caption if specified, else nothing. + {% + \atdummies \turnoffactive \otherbackslash + \immediate\write\auxfile{@xrdef{\floatlabel-lof}{% + \floatident + \ifx\thisshortcaption\empty + \ifx\thiscaption\empty \else : \thiscaption \fi + \else + : \thisshortcaption + \fi + }}% + }% + \fi + % + % Space below caption, if we printed anything. + \ifx\printedsomething\empty \else \vskip\parskip \fi + \egroup % end of \vtop + \checkinserts +} + +% Append the tokens #2 to the definition of macro #1, not expanding either. +% +\newtoks\appendtomacroAtoks +\newtoks\appendtomacroBtoks +\def\appendtomacro#1#2{% + \appendtomacroAtoks = \expandafter{#1}% + \appendtomacroBtoks = {#2}% + \edef#1{\the\appendtomacroAtoks \the\appendtomacroBtoks}% +} + +% @caption, @shortcaption are easy. +% +\long\def\caption#1{\checkenv\float \def\thiscaption{#1}} +\def\shortcaption#1{\checkenv\float \def\thisshortcaption{#1}} + +% The parameter is the control sequence identifying the counter we are +% going to use. Create it if it doesn't exist and assign it to \floatno. +\def\getfloatno#1{% + \ifx#1\relax + % Haven't seen this figure type before. + \csname newcount\endcsname #1% + % + % Remember to reset this floatno at the next chap. + \expandafter\gdef\expandafter\resetallfloatnos + \expandafter{\resetallfloatnos #1=0 }% + \fi + \let\floatno#1% +} + +% \setref calls this to get the XREFLABEL-snt value. We want an @xref +% to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we +% first read the @float command. +% +\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% + +% Magic string used for the XREFLABEL-title value, so \xrefX can +% distinguish floats from other xref types. +\def\floatmagic{!!float!!} + +% #1 is the control sequence we are passed; we expand into a conditional +% which is true if #1 represents a float ref. That is, the magic +% \thissection value which we \setref above. +% +\def\iffloat#1{\expandafter\doiffloat#1==\finish} +% +% #1 is (maybe) the \floatmagic string. If so, #2 will be the +% (safe) float type for this float. We set \iffloattype to #2. +% +\def\doiffloat#1=#2=#3\finish{% + \def\temp{#1}% + \def\iffloattype{#2}% + \ifx\temp\floatmagic +} + +% @listoffloats FLOATTYPE - print a list of floats like a table of contents. +% +\parseargdef\listoffloats{% + \def\floattype{#1}% floattype + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + % + % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. + \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax + \ifhavexrefs + % if the user said @listoffloats foo but never @float foo. + \message{\linenumber No `\safefloattype' floats to list.}% + \fi + \else + \begingroup + \leftskip=\tocindent % indent these entries like a toc + \let\do=\listoffloatsdo + \csname floatlist\safefloattype\endcsname + \endgroup + \fi } +% This is called on each entry in a list of floats. We're passed the +% xref label, in the form LABEL-title, which is how we save it in the +% aux file. We strip off the -title and look up \XRLABEL-lof, which +% has the text we're supposed to typeset here. +% +% Figures without xref labels will not be included in the list (since +% they won't appear in the aux file). +% +\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} +\def\listoffloatsdoentry#1-title\finish{{% + % Can't fully expand XR#1-lof because it can contain anything. Just + % pass the control sequence. On the other hand, XR#1-pg is just the + % page number, and we want to fully expand that so we can get a link + % in pdf output. + \toksA = \expandafter{\csname XR#1-lof\endcsname}% + % + % use the same \entry macro we use to generate the TOC and index. + \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% + \writeentry +}} -\message{paper sizes,} -% And other related parameters. +\message{localization,} +% and i18n. +% @documentlanguage is usually given very early, just after +% @setfilename. If done too late, it may not override everything +% properly. Single argument is the language abbreviation. +% It would be nice if we could set up a hyphenation file here. +% +\parseargdef\documentlanguage{% + \tex % read txi-??.tex file in plain TeX. + % Read the file if it exists. + \openin 1 txi-#1.tex + \ifeof 1 + \errhelp = \nolanghelp + \errmessage{Cannot read language file txi-#1.tex}% + \else + \input txi-#1.tex + \fi + \closein 1 + \endgroup +} +\newhelp\nolanghelp{The given language definition file cannot be found or +is empty. Maybe you need to install it? In the current directory +should work if nowhere else does.} + + +% @documentencoding should change something in TeX eventually, most +% likely, but for now just recognize it. +\let\documentencoding = \comment + + +% Page size parameters. +% \newdimen\defaultparindent \defaultparindent = 15pt \chapheadingskip = 15pt plus 4pt minus 2pt @@ -5211,24 +6663,25 @@ width0pt\relax} \fi % Use TeX 3.0's \emergencystretch to help line breaking, but if we're % using an old version of TeX, don't do anything. We want the amount of % stretch added to depend on the line length, hence the dependence on -% \hsize. This makes it come to about 9pt for the 8.5x11 format. We -% call this whenever the paper size is set. +% \hsize. We call this whenever the paper size is set. % \def\setemergencystretch{% \ifx\emergencystretch\thisisundefined % Allow us to assign to \emergencystretch anyway. \def\emergencystretch{\dimen0}% \else - \emergencystretch = \hsize - \divide\emergencystretch by 45 + \emergencystretch = .15\hsize \fi } % Parameters in order: 1) textheight; 2) textwidth; 3) voffset; -% 4) hoffset; 5) binding offset; 6) topskip. Then whoever calls us can -% set \parskip and call \setleading for \baselineskip. +% 4) hoffset; 5) binding offset; 6) topskip; 7) physical page height; 8) +% physical page width. % -\def\internalpagesizes#1#2#3#4#5#6{% +% We also call \setleading{\textleading}, so the caller should define +% \textleading. The caller should also set \parskip. +% +\def\internalpagesizes#1#2#3#4#5#6#7#8{% \voffset = #3\relax \topskip = #6\relax \splittopskip = \topskip @@ -5247,6 +6700,13 @@ width0pt\relax} \fi \normaloffset = #4\relax \bindingoffset = #5\relax % + \ifpdf + \pdfpageheight #7\relax + \pdfpagewidth #8\relax + \fi + % + \setleading{\textleading} + % \parindent = \defaultparindent \setemergencystretch } @@ -5254,82 +6714,129 @@ width0pt\relax} \fi % @letterpaper (the default). \def\letterpaper{{\globaldefs = 1 \parskip = 3pt plus 2pt minus 1pt - \setleading{13.2pt}% + \textleading = 13.2pt % % If page is nothing but text, make it come out even. - \internalpagesizes{46\baselineskip}{6in}{\voffset}{.25in}{\bindingoffset}{36pt}% + \internalpagesizes{46\baselineskip}{6in}% + {\voffset}{.25in}% + {\bindingoffset}{36pt}% + {11in}{8.5in}% }} % Use @smallbook to reset parameters for 7x9.5 (or so) format. \def\smallbook{{\globaldefs = 1 \parskip = 2pt plus 1pt - \setleading{12pt}% + \textleading = 12pt % - \internalpagesizes{7.5in}{5.in}{\voffset}{.25in}{\bindingoffset}{16pt}% + \internalpagesizes{7.5in}{5in}% + {\voffset}{.25in}% + {\bindingoffset}{16pt}% + {9.25in}{7in}% % \lispnarrowing = 0.3in \tolerance = 700 \hfuzz = 1pt \contentsrightmargin = 0pt - \deftypemargin = 0pt \defbodyindent = .5cm - % - \let\smalldisplay = \smalldisplayx - \let\smallexample = \smalllispx - \let\smallformat = \smallformatx - \let\smalllisp = \smalllispx }} % Use @afourpaper to print on European A4 paper. \def\afourpaper{{\globaldefs = 1 - \setleading{12pt}% \parskip = 3pt plus 2pt minus 1pt + \textleading = 13.2pt % - \internalpagesizes{53\baselineskip}{160mm}{\voffset}{4mm}{\bindingoffset}{44pt}% + % Double-side printing via postscript on Laserjet 4050 + % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. + % To change the settings for a different printer or situation, adjust + % \normaloffset until the front-side and back-side texts align. Then + % do the same for \bindingoffset. You can set these for testing in + % your texinfo source file like this: + % @tex + % \global\normaloffset = -6mm + % \global\bindingoffset = 10mm + % @end tex + \internalpagesizes{51\baselineskip}{160mm} + {\voffset}{\hoffset}% + {\bindingoffset}{44pt}% + {297mm}{210mm}% % \tolerance = 700 \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = 5mm }} -% A specific text layout, 24x15cm overall, intended for A4 paper. Top margin -% 29mm, hence bottom margin 28mm, nominal side margin 3cm. +% Use @afivepaper to print on European A5 paper. +% From romildo@urano.iceb.ufop.br, 2 July 2000. +% He also recommends making @example and @lisp be small. +\def\afivepaper{{\globaldefs = 1 + \parskip = 2pt plus 1pt minus 0.1pt + \textleading = 12.5pt + % + \internalpagesizes{160mm}{120mm}% + {\voffset}{\hoffset}% + {\bindingoffset}{8pt}% + {210mm}{148mm}% + % + \lispnarrowing = 0.2in + \tolerance = 800 + \hfuzz = 1.2pt + \contentsrightmargin = 0pt + \defbodyindent = 2mm + \tableindent = 12mm +}} + +% A specific text layout, 24x15cm overall, intended for A4 paper. \def\afourlatex{{\globaldefs = 1 - \setleading{13.6pt}% - % \afourpaper - \internalpagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}% + \internalpagesizes{237mm}{150mm}% + {\voffset}{4.6mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% % + % Must explicitly reset to 0 because we call \afourpaper. \globaldefs = 0 }} -% Use @afourwide to print on European A4 paper in wide format. -\def\afourwide{% +% Use @afourwide to print on A4 paper in landscape format. +\def\afourwide{{\globaldefs = 1 \afourpaper - \internalpagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}% - % + \internalpagesizes{241mm}{165mm}% + {\voffset}{-2.95mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% \globaldefs = 0 -} +}} % @pagesizes TEXTHEIGHT[,TEXTWIDTH] % Perhaps we should allow setting the margins, \topskip, \parskip, % and/or leading, also. Or perhaps we should compute them somehow. -% -\def\pagesizes{\parsearg\pagesizesxxx} -\def\pagesizesxxx#1{\pagesizesyyy #1,,\finish} +% +\parseargdef\pagesizes{\pagesizesyyy #1,,\finish} \def\pagesizesyyy#1,#2,#3\finish{{% \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi \globaldefs = 1 % \parskip = 3pt plus 2pt minus 1pt - \setleading{13.2pt}% + \setleading{\textleading}% % - \internalpagesizes{#1}{\hsize}{\voffset}{\normaloffset}{\bindingoffset}{44pt}% + \dimen0 = #1 + \advance\dimen0 by \voffset + % + \dimen2 = \hsize + \advance\dimen2 by \normaloffset + % + \internalpagesizes{#1}{\hsize}% + {\voffset}{\normaloffset}% + {\bindingoffset}{44pt}% + {\dimen0}{\dimen2}% }} % Set default to letter. -% +% \letterpaper + \message{and turning on texinfo input format.} % Define macros to output various characters with catcode for normal text. @@ -5341,6 +6848,7 @@ width0pt\relax} \fi \catcode`\<=\other \catcode`\>=\other \catcode`\+=\other +\catcode`\$=\other \def\normaldoublequote{"} \def\normaltilde{~} \def\normalcaret{^} @@ -5349,9 +6857,10 @@ width0pt\relax} \fi \def\normalless{<} \def\normalgreater{>} \def\normalplus{+} +\def\normaldollar{$}%$ font-lock fix -% This macro is used to make a character print one way in ttfont -% where it can probably just be output, and another way in other fonts, +% This macro is used to make a character print one way in \tt +% (where it can probably be output as-is), and another way in other fonts, % where something hairier probably needs to be done. % % #1 is what to print if we are indeed using \tt; #2 is what to print @@ -5359,7 +6868,13 @@ width0pt\relax} \fi % interword stretch (and shrink), and it is reasonable to expect all % typewriter fonts to have this, we can check that font parameter. % -\def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi} +\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} + +% Same as above, but check for italic font. Actually this also catches +% non-italic slanted fonts since it is impossible to distinguish them from +% italic fonts. But since this is only used by $ and it uses \sl anyway +% this is not a problem. +\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} % Turn off all special characters except @ % (and those which the user can use as if they were ordinary). @@ -5378,7 +6893,7 @@ width0pt\relax} \fi \catcode`\_=\active \def_{\ifusingtt\normalunderscore\_} % Subroutine for the previous macro. -\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}} +\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } \catcode`\|=\active \def|{{\tt\char124}} @@ -5390,15 +6905,8 @@ width0pt\relax} \fi \def>{{\tt \gtr}} \catcode`\+=\active \def+{{\tt \char 43}} -%\catcode 27=\active -%\def^^[{$\diamondsuit$} - -% Set up an active definition for =, but don't enable it most of the time. -{\catcode`\==\active -\global\def={{\tt \char 61}}} - -\catcode`+=\active -\catcode`\_=\active +\catcode`\$=\active +\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix % If a .fmt file is being used, characters that might appear in a file % name cannot be active until we have parsed the command line. @@ -5408,45 +6916,48 @@ width0pt\relax} \fi \catcode`\@=0 -% \rawbackslashxx output one backslash character in current font -\global\chardef\rawbackslashxx=`\\ -%{\catcode`\\=\other -%@gdef@rawbackslashxx{\}} +% \backslashcurfont outputs one backslash character in current font, +% as in \char`\\. +\global\chardef\backslashcurfont=`\\ +\global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work -% \rawbackslash redefines \ as input to do \rawbackslashxx. +% \rawbackslash defines an active \ to do \backslashcurfont. +% \otherbackslash defines an active \ to be a literal `\' character with +% catcode other. {\catcode`\\=\active -@gdef@rawbackslash{@let\=@rawbackslashxx }} + @gdef@rawbackslash{@let\=@backslashcurfont} + @gdef@otherbackslash{@let\=@realbackslash} +} + +% \realbackslash is an actual character `\' with catcode other. +{\catcode`\\=\other @gdef@realbackslash{\}} % \normalbackslash outputs one backslash in fixed width font. -\def\normalbackslash{{\tt\rawbackslashxx}} +\def\normalbackslash{{\tt\backslashcurfont}} -% Say @foo, not \foo, in error messages. -\escapechar=`\@ - -% \catcode 17=0 % Define control-q \catcode`\\=\active % Used sometimes to turn off (effectively) the active characters % even after parsing them. -@def@turnoffactive{@let"=@normaldoublequote -@let\=@realbackslash -@let~=@normaltilde -@let^=@normalcaret -@let_=@normalunderscore -@let|=@normalverticalbar -@let<=@normalless -@let>=@normalgreater -@let+=@normalplus} +@def@turnoffactive{% + @let"=@normaldoublequote + @let\=@realbackslash + @let~=@normaltilde + @let^=@normalcaret + @let_=@normalunderscore + @let|=@normalverticalbar + @let<=@normalless + @let>=@normalgreater + @let+=@normalplus + @let$=@normaldollar %$ font-lock fix + @unsepspaces +} -@def@normalturnoffactive{@let"=@normaldoublequote -@let\=@normalbackslash -@let~=@normaltilde -@let^=@normalcaret -@let_=@normalunderscore -@let|=@normalverticalbar -@let<=@normalless -@let>=@normalgreater -@let+=@normalplus} +% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of +% the literal character `\'. (Thus, \ is not expandable when this is in +% effect.) +% +@def@normalturnoffactive{@turnoffactive @let\=@normalbackslash} % Make _ and + \other characters, temporarily. % This is canceled by @fixbackslash. @@ -5465,20 +6976,31 @@ width0pt\relax} \fi % Also back turn on active characters that might appear in the input % file name, in case not using a pre-dumped format. % -@gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi - @catcode`+=@active @catcode`@_=@active} +@gdef@fixbackslash{% + @ifx\@eatinput @let\ = @normalbackslash @fi + @catcode`+=@active + @catcode`@_=@active +} -% These look ok in all fonts, so just make them not special. The @rm below -% makes sure that the current font starts out as the newly loaded cmr10 -@catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other +% Say @foo, not \foo, in error messages. +@escapechar = `@@ + +% These look ok in all fonts, so just make them not special. +@catcode`@& = @other +@catcode`@# = @other +@catcode`@% = @other -@textfonts -@rm @c Local variables: @c eval: (add-hook 'write-file-hooks 'time-stamp) @c page-delimiter: "^\\\\message" @c time-stamp-start: "def\\\\texinfoversion{" -@c time-stamp-format: "%:y-%02m-%02d" +@c time-stamp-format: "%:y-%02m-%02d.%02H" @c time-stamp-end: "}" @c End: + +@c vim:sw=2: + +@ignore + arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 +@end ignore diff --git a/doc/tinc.conf.5 b/doc/tinc.conf.5.in similarity index 69% rename from doc/tinc.conf.5 rename to doc/tinc.conf.5.in index 2dfdf07..1797aa7 100644 --- a/doc/tinc.conf.5 +++ b/doc/tinc.conf.5.in @@ -1,14 +1,14 @@ .Dd 2002-04-09 .Dt TINC.CONF 5 .\" Manual page created by: -.\" Ivo Timmermans -.\" Guus Sliepen +.\" Ivo Timmermans +.\" Guus Sliepen .Sh NAME .Nm tinc.conf .Nd tinc daemon configuration .Sh DESCRIPTION The files in the -.Pa /etc/tinc/ +.Pa @sysconfdir@/tinc/ directory contain runtime and security information for the tinc daemon. .Sh NETWORKS It is perfectly ok for you to run more than one tinc daemon. @@ -25,7 +25,7 @@ with the option, which will assign a name to this daemon. .Pp The effect of this is that the daemon will set its configuration root to -.Pa /etc/tinc/ Ns Ar NETNAME Ns Pa / , +.Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa / , where .Ar NETNAME is your argument to the @@ -41,13 +41,13 @@ In this case, the network name would just be empty, and it will be used as such. .Nm tinc now looks for files in -.Pa /etc/tinc/ , +.Pa @sysconfdir@/tinc/ , instead of -.Pa /etc/tinc/ Ns Ar NETNAME Ns Pa / ; +.Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa / ; the configuration file should be -.Pa /etc/tinc/tinc.conf , +.Pa @sysconfdir@/tinc/tinc.conf , and the host configuration files are now expected to be in -.Pa /etc/tinc/hosts/ . +.Pa @sysconfdir@/tinc/hosts/ . .Pp But it is highly recommended that you use this feature of .Nm tinc , @@ -57,7 +57,7 @@ Hence, we will assume that you use it. Each tinc daemon should have a name that is unique in the network which it will be part of. The name will be used by other tinc daemons for identification. The name has to be declared in the -.Pa /etc/tinc/ Ns Ar NETNAME Ns Pa /tinc.conf +.Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc.conf file. .Pp To make things easy, @@ -69,21 +69,21 @@ You should use to generate public/private keypairs. It will generate two keys. The private key should be stored in a separate file -.Pa /etc/tinc/ Ns Ar NETNAME Ns Pa /rsa_key.priv +.Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /rsa_key.priv \-\- where .Ar NETNAME stands for the network (see .Sx NETWORKS ) above. The public key should be stored in the host configuration file -.Pa /etc/tinc/ Ns Ar NETNAME Ns Pa /hosts/ Ns Va NAME +.Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /hosts/ Ns Va NAME \-\- where .Va NAME stands for the name of the local tinc daemon (see .Sx NAMES ) . .Sh SERVER CONFIGURATION The server configuration of the daemon is done in the file -.Pa /etc/tinc/ Ns Ar NETNAME Ns Pa /tinc.conf . +.Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc.conf . This file consists of comments (lines started with a .Li # ) or assignments in the form of: @@ -100,12 +100,19 @@ If you leave it out, remember to replace it with at least one space character. Here are all valid variables, listed in alphabetical order. The default value is given between parentheses. .Bl -tag -width indent -.It Va AddressFamily Li = ipv4 | ipv6 | any Po ipv4 Pc Bq experimental +.It Va AddressFamily Li = ipv4 | ipv6 | any Pq any This option affects the address family of listening and outgoing sockets. If .Qq any is selected, then depending on the operating system both IPv4 and IPv6 or just IPv6 listening sockets will be created. +.It Va BindToAddress Li = Ar address Bq experimental +If your computer has more than one IPv4 or IPv6 address, +.Nm tinc +will by default listen on all of them for incoming connections. +It is possible to bind only to a single address with this variable. +.Pp +This option may not work on all platforms. .It Va BindToInterface Li = Ar interface Bq experimental If your computer has more than one network interface, .Nm tinc @@ -113,6 +120,13 @@ will by default listen on all of them for incoming connections. It is possible to bind only to a single interface with this variable. .Pp This option may not work on all platforms. +.It Va BlockingTCP Li = yes | no Po no Pc Bq experimental +This options selects whether TCP connections, when established, should use blocking writes. +When turned off, tinc will never block when a TCP connection becomes congested, but will have to terminate that connection instead. +If turned on, tinc will not terminate connections but will block, thereby unable to process data to/from other connections. +Turn this option on if you also use +.Va TCPOnly +and tinc terminates connections frequently. .It Va ConnectTo Li = Ar name Specifies which other tinc daemon to connect to on startup. Multiple @@ -129,11 +143,15 @@ If you don't specify a host with .Nm tinc won't try to connect to other daemons at all, and will instead just listen for incoming connections. -.It Va Device Li = Ar device Po /dev/tap0 or /dev/misc/net/tun Pc +.It Va Device Li = Ar device Po Pa /dev/tap0 , Pa /dev/net/tun No or other depending on platform Pc The virtual network device to use. .Nm tinc will automatically detect what kind of device it is. Note that you can only use one device per daemon. +Under Windows, use +.Va Interface +instead of +.Va Device . The info pages of the tinc package contain more information about configuring the virtual network device. .It Va Hostnames Li = yes | no Pq no @@ -146,19 +164,22 @@ This does not affect resolving hostnames to IP addresses from the host configuration files. .It Va Interface Li = Ar interface Defines the name of the interface corresponding to the virtual network device. -Depending on the operating system and the type of device this may or may not actually set the name. -Currently this option only affects the Linux tun/tap device. -.It Va KeyExpire Li = Ar period Pq 3600 +Depending on the operating system and the type of device this may or may not actually set the name of the interface. +Under Windows, this variable is used to select which network interface will be used. +If you specified a +.Va Device , +this variable is almost always already correctly set. +.It Va KeyExpire Li = Ar seconds Pq 3600 This option controls the period the encryption keys used to encrypt the data are valid. It is common practice to change keys at regular intervals to make it even harder for crackers, even though it is thought to be nearly impossible to crack a single key. -.It Va MACExpire Li = Ar period Pq 600 +.It Va MACExpire Li = Ar seconds Pq 600 This option controls the amount of time MAC addresses are kept before they are removed. This only has effect when .Va Mode is set to .Qq switch . -.It Va MaxTimeout Li = Ar period Pq 900 +.It Va MaxTimeout Li = Ar seconds Pq 900 This is the maximum delay before trying to reconnect to other tinc daemons. .It Va Mode Li = router | switch | hub Pq router This option selects the way packets are routed to other daemons. @@ -168,11 +189,15 @@ In this mode .Va Subnet variables in the host configuration files will be used to form a routing table. Only unicast packets of routable protocols (IPv4 and IPv6) are supported in this mode. +.Pp +This is the default mode, and unless you really know you need another mode, don't change it. .It switch In this mode the MAC addresses of the packets on the VPN will be used to dynamically create a routing table just like an Ethernet switch does. Unicast, multicast and broadcast packets of every protocol that runs over Ethernet are supported in this mode at the cost of frequent broadcast ARP requests and routing table updates. +.Pp +This mode is primarily useful if you want to bridge Ethernet segments. .It hub This mode is almost the same as the switch mode, but instead every packet will be broadcast to the other daemons @@ -181,7 +206,7 @@ while no routing table is managed. .It Va Name Li = Ar name Bq required This is the name which identifies this tinc daemon. It must be unique for the virtual private network this daemon will connect to. -.It Va PingTimeout Li = Ar period Pq 60 +.It Va PingTimeout Li = Ar seconds Pq 60 The number of seconds of inactivity that .Nm tinc will wait before sending a probe to the other end. @@ -194,13 +219,18 @@ will be inherited by the UDP packets that are sent out. .It Va PrivateKey Li = Ar key Bq obsolete The private RSA key of this tinc daemon. It will allow this tinc daemon to authenticate itself to other daemons. -.It Va PrivateKeyFile Li = Ar filename Bq recommended +.It Va PrivateKeyFile Li = Ar filename Po Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /rsa_key.priv Pc The file in which the private RSA key of this tinc daemon resides. Note that there must be exactly one of .Va PrivateKey or .Va PrivateKeyFile specified in the configuration file. +.It Va TunnelServer Li = yes | no Po no Pc Bq experimental +When this option is enabled tinc will no longer forward information between other tinc daemons, +and will only allow nodes and subnets on the VPN which are present in the +.Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /hosts/ +directory. .El .Sh HOST CONFIGURATION FILES The host configuration files contain all information needed @@ -228,9 +258,11 @@ Any cipher supported by OpenSSL is recognised. Furthermore, specifying .Qq none will turn off packet encryption. +It is best to use only those ciphers which support CBC mode. .It Va Compression Li = Ar level Pq 0 This option sets the level of compression used for UDP packets. -Possible values are 0 (off), 1 (fast) and any integer up to 9 (best). +Possible values are 0 (off), 1 (fast zlib) and any integer up to 9 (best zlib), +10 (fast lzo) and 11 (best lzo). .It Va Digest Li = Ar digest Pq sha1 The digest algorithm used to authenticate UDP packets. Any digest supported by OpenSSL is recognised. @@ -249,6 +281,11 @@ The length of the message authentication code used to authenticate UDP packets. Can be anything from .Qq 0 up to the length of the digest produced by the digest algorithm. +.It Va PMTU Li = Ar mtu Po 1514 Pc Bq experimental +This option controls the initial path MTU to this node. +.It Va PMTUDiscovery Li = yes | no Po no Pc Bq experimental +When this option is enabled, tinc will try to discover the path MTU to this node. +After the path MTU has been discovered, it will be enforced on the VPN. .It Va Port Li = Ar port Pq 655 The port number on which this tinc daemon is listening for incoming connections. .It Va PublicKey Li = Ar key Bq obsolete @@ -292,39 +329,79 @@ from behind a masquerading firewall, or if UDP packet routing is disabled somehow. Setting this options also implicitly sets IndirectData. .El -.Sh FILES +.Sh SCRIPTS +Apart from reading the server and host configuration files, +tinc can also run scripts at certain moments. +Under Windows (not Cygwin), the scripts should have the extension +.Pa .bat . .Bl -tag -width indent -.It Pa /etc/tinc/ +.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc-up +This is the most important script. +If it is present it will be executed right after the tinc daemon has been started and has connected to the virtual network device. +It should be used to set up the corresponding network interface, +but can also be used to start other things. +Under Windows you can use the Network Connections control panel instead of creating this script. +.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc-down +This script is started right before the tinc daemon quits. +.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /hosts/ Ns Ar HOST Ns Pa -up +This script is started when the tinc daemon with name +.Ar HOST +becomes reachable. +.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /hosts/ Ns Ar HOST Ns Pa -down +This script is started when the tinc daemon with name +.Ar HOST +becomes unreachable. +.El +.Pp +The scripts are started without command line arguments, but can make use of certain environment variables. +Under UNIX like operating systems the names of environment variables must be preceded by a +.Li $ +in scripts. +Under Windows, in +.Pa .bat +files, they have to be put between +.Li % +signs. +.Bl -tag -width indent +.It Ev NETNAME +If a netname was specified, this environment variable contains it. +.It Ev NAME +Contains the name of this tinc daemon. +.It Ev DEVICE +Contains the name of the virtual network device that tinc uses. +.It Ev INTERFACE +Contains the name of the virtual network interface that tinc uses. +This should be used for commands like +.Pa ifconfig . +.It Ev NODE +When a host becomes (un)reachable, this is set to its name. +.It Ev REMOTEADDRESS +When a host becomes (un)reachable, this is set to its real address. +.It Ev REMOTEPORT +When a host becomes (un)reachable, this is set to the port number it uses for communication with other tinc daemons. +.El +.Sh FILES +The most important files are: +.Bl -tag -width indent +.It Pa @sysconfdir@/tinc/ The top directory for configuration files. -.It Pa /etc/tinc/ Ns Ar NETNAME Ns Pa /tinc.conf +.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc.conf The default name of the server configuration file for net .Ar NETNAME . -.It Pa /etc/tinc/ Ns Ar NETNAME Ns Pa /hosts/ +.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /hosts/ Host configuration files are kept in this directory. -.It Pa /etc/tinc/ Ns Ar NETNAME Ns Pa /tinc-up +.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc-up If an executable file with this name exists, it will be executed right after the tinc daemon has connected to the virtual network device. It can be used to set up the corresponding network interface. -.Pp -The environment variable -.Ev $NETNAME -will be passed to the executable. -If specified with the -.Va Interface -configuration variable, -or if the virtual network device is a Linux tun/tap device, -the environment variable -.Ev $INTERFACE -will be set to the name of the network interface. -.It Pa /etc/tinc/ Ns Ar NETNAME Ns Pa /tinc-down +.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc-down If an executable file with this name exists, it will be executed right before the tinc daemon is going to close its connection to the virtual network device. -The same environment variables will be passed as mentioned above. .El .Sh SEE ALSO .Xr tincd 8 , -.Pa http://tinc.nl.linux.org/ , +.Pa http://www.tinc-vpn.org/ , .Pa http://www.linuxdoc.org/LDP/nag2/ . .Pp The full documentation for diff --git a/doc/tinc.info b/doc/tinc.info index 71dcb80..5a03ae6 100644 --- a/doc/tinc.info +++ b/doc/tinc.info @@ -1,17 +1,17 @@ -This is tinc.info, produced by makeinfo version 4.1 from tinc.texi. +This is tinc.info, produced by makeinfo version 4.7 from tinc.texi. INFO-DIR-SECTION Networking tools START-INFO-DIR-ENTRY * tinc: (tinc). The tinc Manual. END-INFO-DIR-ENTRY - This is the info manual for tinc, a Virtual Private Network daemon. + This is the info manual for tinc version 1.0.3, a Virtual Private +Network daemon. - Copyright (C) 1998-2002 Ivo Timmermans , -Guus Sliepen and Wessel Dankers -. + Copyright (C) 1998-2004 Ivo Timmermans , Guus +Sliepen and Wessel Dankers . - $Id: tinc.texi,v 1.8.4.28 2002/04/09 11:43:29 guus Exp $ + $Id: tinc.texi 1416 2004-11-10 23:21:41Z guus $ Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are @@ -23,57 +23,2385 @@ entire resulting derived work is distributed under the terms of a permission notice identical to this one.  -Indirect: -tinc.info-1: 888 -tinc.info-2: 49234 +File: tinc.info, Node: Top, Next: Introduction, Up: (dir) + +Top +*** + +* Menu: + +* Introduction:: +* Preparations:: +* Installation:: +* Configuration:: +* Running tinc:: +* Technical information:: +* Platform specific information:: +* About us:: +* Concept Index:: All used terms explained + + +File: tinc.info, Node: Introduction, Next: Preparations, Prev: Top, Up: Top + +1 Introduction +************** + +Tinc is a Virtual Private Network (VPN) daemon that uses tunneling and +encryption to create a secure private network between hosts on the +Internet. + + Because the tunnel appears to the IP level network code as a normal +network device, there is no need to adapt any existing software. The +encrypted tunnels allows VPN sites to share information with each other +over the Internet without exposing any information to others. + + This document is the manual for tinc. Included are chapters on how +to configure your computer to use tinc, as well as the configuration +process of tinc itself. + +* Menu: + +* Virtual Private Networks:: +* tinc:: About tinc +* Supported platforms:: + + +File: tinc.info, Node: Virtual Private Networks, Next: tinc, Up: Introduction + +1.1 Virtual Private Networks +============================ + +A Virtual Private Network or VPN is a network that can only be accessed +by a few elected computers that participate. This goal is achievable in +more than just one way. + + Private networks can consist of a single stand-alone Ethernet LAN. +Or even two computers hooked up using a null-modem cable. In these +cases, it is obvious that the network is _private_, no one can access +it from the outside. But if your computers are linked to the Internet, +the network is not private anymore, unless one uses firewalls to block +all private traffic. But then, there is no way to send private data to +trusted computers on the other end of the Internet. + + This problem can be solved by using _virtual_ networks. Virtual +networks can live on top of other networks, but they use encapsulation +to keep using their private address space so they do not interfere with +the Internet. Mostly, virtual networks appear like a singe LAN, even +though they can span the entire world. But virtual networks can't be +secured by using firewalls, because the traffic that flows through it +has to go through the Internet, where other people can look at it. + + As is the case with either type of VPN, anybody could eavesdrop. Or +worse, alter data. Hence it's probably advisable to encrypt the data +that flows over the network. + + When one introduces encryption, we can form a true VPN. Other +people may see encrypted traffic, but if they don't know how to +decipher it (they need to know the key for that), they cannot read the +information that flows through the VPN. This is what tinc was made for. + + +File: tinc.info, Node: tinc, Next: Supported platforms, Prev: Virtual Private Networks, Up: Introduction + +1.2 tinc +======== + +I really don't quite remember what got us started, but it must have been +Guus' idea. He wrote a simple implementation (about 50 lines of C) that +used the ethertap device that Linux knows of since somewhere about +kernel 2.1.60. It didn't work immediately and he improved it a bit. +At this stage, the project was still simply called "vpnd". + + Since then, a lot has changed--to say the least. + + Tinc now supports encryption, it consists of a single daemon (tincd) +for both the receiving and sending end, it has become largely +runtime-configurable--in short, it has become a full-fledged +professional package. + + Tinc also allows more than two sites to connect to eachother and +form a single VPN. Traditionally VPNs are created by making tunnels, +which only have two endpoints. Larger VPNs with more sites are created +by adding more tunnels. Tinc takes another approach: only endpoints +are specified, the software itself will take care of creating the +tunnels. This allows for easier configuration and improved scalability. + + A lot can--and will be--changed. We have a number of things that we +would like to see in the future releases of tinc. Not everything will +be available in the near future. Our first objective is to make tinc +work perfectly as it stands, and then add more advanced features. + + Meanwhile, we're always open-minded towards new ideas. And we're +available too. + + +File: tinc.info, Node: Supported platforms, Prev: tinc, Up: Introduction + +1.3 Supported platforms +======================= + +Tinc has been verified to work under Linux, FreeBSD, OpenBSD, NetBSD, +MacOS/X (Darwin), Solaris, and Windows (both natively and in a Cygwin +environment), with various hardware architectures. These are some of +the platforms that are supported by the universal tun/tap device driver +or other virtual network device drivers. Without such a driver, tinc +will most likely compile and run, but it will not be able to send or +receive data packets. + + For an up to date list of supported platforms, please check the list +on our website: `http://www.tinc-vpn.org/platforms'. + + +File: tinc.info, Node: Preparations, Next: Installation, Prev: Introduction, Up: Top + +2 Preparations +************** + +This chapter contains information on how to prepare your system to +support tinc. + +* Menu: + +* Configuring the kernel:: +* Libraries:: + + +File: tinc.info, Node: Configuring the kernel, Next: Libraries, Up: Preparations + +2.1 Configuring the kernel +========================== + +* Menu: + +* Configuration of Linux kernels 2.1.60 up to 2.4.0:: +* Configuration of Linux kernels 2.4.0 and higher:: +* Configuration of FreeBSD kernels:: +* Configuration of OpenBSD kernels:: +* Configuration of NetBSD kernels:: +* Configuration of Solaris kernels:: +* Configuration of Darwin (MacOS/X) kernels:: +* Configuration of Windows:: + + +File: tinc.info, Node: Configuration of Linux kernels 2.1.60 up to 2.4.0, Next: Configuration of Linux kernels 2.4.0 and higher, Up: Configuring the kernel + +2.1.1 Configuration of Linux kernels 2.1.60 up to 2.4.0 +------------------------------------------------------- + +For kernels up to 2.4.0, you need a kernel that supports the ethertap +device. Most distributions come with kernels that already support this. +If not, here are the options you have to turn on when configuring a new +kernel: + + Code maturity level options + [*] Prompt for development and/or incomplete code/drivers + Networking options + [*] Kernel/User netlink socket + Netlink device emulation + Network device support + Ethertap network tap + + If you want to run more than one instance of tinc or other programs +that use the ethertap, you have to compile the ethertap driver as a +module, otherwise you can also choose to compile it directly into the +kernel. + + If you decide to build any of these as dynamic kernel modules, it's +a good idea to add these lines to `/etc/modules.conf': + + alias char-major-36 netlink_dev + alias tap0 ethertap + options tap0 -o tap0 unit=0 + alias tap1 ethertap + options tap1 -o tap1 unit=1 + ... + alias tap_N_ ethertap + options tap_N_ -o tap_N_ unit=_N_ + + Add as much alias/options lines as necessary. + + +File: tinc.info, Node: Configuration of Linux kernels 2.4.0 and higher, Next: Configuration of FreeBSD kernels, Prev: Configuration of Linux kernels 2.1.60 up to 2.4.0, Up: Configuring the kernel + +2.1.2 Configuration of Linux kernels 2.4.0 and higher +----------------------------------------------------- + +For kernels 2.4.0 and higher, you need a kernel that supports the +Universal tun/tap device. Most distributions come with kernels that +already support this. Here are the options you have to turn on when +configuring a new kernel: + + Code maturity level options + [*] Prompt for development and/or incomplete code/drivers + Network device support + Universal tun/tap device driver support + + It's not necessary to compile this driver as a module, even if you +are going to run more than one instance of tinc. + + If you have an early 2.4 kernel, you can choose both the tun/tap +driver and the `Ethertap network tap' device. This latter is marked +obsolete, and chances are that it won't even function correctly +anymore. Make sure you select the universal tun/tap driver. + + If you decide to build the tun/tap driver as a kernel module, add +these lines to `/etc/modules.conf': + + alias char-major-10-200 tun + + +File: tinc.info, Node: Configuration of FreeBSD kernels, Next: Configuration of OpenBSD kernels, Prev: Configuration of Linux kernels 2.4.0 and higher, Up: Configuring the kernel + +2.1.3 Configuration of FreeBSD kernels +-------------------------------------- + +For FreeBSD version 4.1 and higher, tun and tap drivers are included in +the default kernel configuration. Using tap devices is recommended. + + +File: tinc.info, Node: Configuration of OpenBSD kernels, Next: Configuration of NetBSD kernels, Prev: Configuration of FreeBSD kernels, Up: Configuring the kernel + +2.1.4 Configuration of OpenBSD kernels +-------------------------------------- + +For OpenBSD version 2.9 and higher, the tun driver is included in the +default kernel configuration. There is also a kernel patch from +`http://diehard.n-r-g.com/stuff/openbsd/' which adds a tap device to +OpenBSD. This should work with tinc. + + +File: tinc.info, Node: Configuration of NetBSD kernels, Next: Configuration of Solaris kernels, Prev: Configuration of OpenBSD kernels, Up: Configuring the kernel + +2.1.5 Configuration of NetBSD kernels +------------------------------------- + +For NetBSD version 1.5.2 and higher, the tun driver is included in the +default kernel configuration. + + Tunneling IPv6 may not work on NetBSD's tun device. + + +File: tinc.info, Node: Configuration of Solaris kernels, Next: Configuration of Darwin (MacOS/X) kernels, Prev: Configuration of NetBSD kernels, Up: Configuring the kernel + +2.1.6 Configuration of Solaris kernels +-------------------------------------- + +For Solaris 8 (SunOS 5.8) and higher, the tun driver may or may not be +included in the default kernel configuration. If it isn't, the source +can be downloaded from `http://vtun.sourceforge.net/tun/'. For x86 and +sparc64 architectures, precompiled versions can be found at +`http://www.monkey.org/~dugsong/fragroute/'. If the `net/if_tun.h' +header file is missing, install it from the source package. + + +File: tinc.info, Node: Configuration of Darwin (MacOS/X) kernels, Next: Configuration of Windows, Prev: Configuration of Solaris kernels, Up: Configuring the kernel + +2.1.7 Configuration of Darwin (MacOS/X) kernels +----------------------------------------------- + +Tinc on Darwin relies on a tunnel driver for its data acquisition from +the kernel. Tinc supports either the driver from +`http://www-user.rhrk.uni-kl.de/~nissler/tuntap/', which supports both +tun and tap style devices, and also the driver from from +`http://chrisp.de/en/projects/tunnel.html'. The former driver is +recommended. The tunnel driver must be loaded before starting tinc +with the following command: + + kmodload tunnel + + +File: tinc.info, Node: Configuration of Windows, Prev: Configuration of Darwin (MacOS/X) kernels, Up: Configuring the kernel + +2.1.8 Configuration of Windows +------------------------------ + +You will need to install the latest TAP-Win32 driver from OpenVPN. You +can download it from `http://openvpn.sourceforge.net'. Using the +Network Connections control panel, configure the TAP-Win32 network +interface in the same way as you would do from the tinc-up script, as +explained in the rest of the documentation. + + +File: tinc.info, Node: Libraries, Prev: Configuring the kernel, Up: Preparations + +2.2 Libraries +============= + +Before you can configure or build tinc, you need to have the OpenSSL, +zlib and lzo libraries installed on your system. If you try to +configure tinc without having them installed, configure will give you +an error message, and stop. + +* Menu: + +* OpenSSL:: +* zlib:: +* lzo:: + + +File: tinc.info, Node: OpenSSL, Next: zlib, Up: Libraries + +2.2.1 OpenSSL +------------- + +For all cryptography-related functions, tinc uses the functions provided +by the OpenSSL library. + + If this library is not installed, you wil get an error when +configuring tinc for build. Support for running tinc without having +OpenSSL installed _may_ be added in the future. + + You can use your operating system's package manager to install this +if available. Make sure you install the development AND runtime +versions of this package. + + If you have to install OpenSSL manually, you can get the source code +from `http://www.openssl.org/'. Instructions on how to configure, +build and install this package are included within the package. Please +make sure you build development and runtime libraries (which is the +default). + + If you installed the OpenSSL libraries from source, it may be +necessary to let configure know where they are, by passing configure +one of the -with-openssl-* parameters. + + --with-openssl=DIR OpenSSL library and headers prefix + --with-openssl-include=DIR OpenSSL headers directory + (Default is OPENSSL_DIR/include) + --with-openssl-lib=DIR OpenSSL library directory + (Default is OPENSSL_DIR/lib) + +License +....... + +The complete source code of tinc is covered by the GNU GPL version 2. +Since the license under which OpenSSL is distributed is not directly +compatible with the terms of the GNU GPL +`http://www.openssl.org/support/faq.html#LEGAL2', we include an +exemption to the GPL (see also the file COPYING.README) to allow +everyone to create a statically or dynamically linked executable: + + This program is released under the GPL with the additional + exemption that compiling, linking, and/or using OpenSSL is + allowed. You may provide binary packages linked to the OpenSSL + libraries, provided that all other requirements of the GPL are met. + + Since the LZO library used by tinc is also covered by the GPL, we +also present the following exemption: + + Hereby I grant a special exception to the tinc VPN project + (http://www.tinc-vpn.org/) to link the LZO library with the + OpenSSL library (http://www.openssl.org). + + Markus F.X.J. Oberhumer + + +File: tinc.info, Node: zlib, Next: lzo, Prev: OpenSSL, Up: Libraries + +2.2.2 zlib +---------- + +For the optional compression of UDP packets, tinc uses the functions +provided by the zlib library. + + If this library is not installed, you wil get an error when +configuring tinc for build. Support for running tinc without having +zlib installed _may_ be added in the future. + + You can use your operating system's package manager to install this +if available. Make sure you install the development AND runtime +versions of this package. + + If you have to install zlib manually, you can get the source code +from `http://www.gzip.org/zlib/'. Instructions on how to configure, +build and install this package are included within the package. Please +make sure you build development and runtime libraries (which is the +default). + + +File: tinc.info, Node: lzo, Prev: zlib, Up: Libraries + +2.2.3 lzo +--------- + +Another form of compression is offered using the lzo library. + + If this library is not installed, you wil get an error when +configuring tinc for build. Support for running tinc without having lzo +installed _may_ be added in the future. + + You can use your operating system's package manager to install this +if available. Make sure you install the development AND runtime +versions of this package. + + If you have to install lzo manually, you can get the source code +from `http://www.oberhumer.com/opensource/lzo/'. Instructions on how +to configure, build and install this package are included within the +package. Please make sure you build development and runtime libraries +(which is the default). + + +File: tinc.info, Node: Installation, Next: Configuration, Prev: Preparations, Up: Top + +3 Installation +************** + +If you use Debian, you may want to install one of the precompiled +packages for your system. These packages are equipped with system +startup scripts and sample configurations. + + If you cannot use one of the precompiled packages, or you want to +compile tinc for yourself, you can use the source. The source is +distributed under the GNU General Public License (GPL). Download the +source from the download page (http://www.tinc-vpn.org/download), which +has the checksums of these files listed; you may wish to check these +with md5sum before continuing. + + Tinc comes in a convenient autoconf/automake package, which you can +just treat the same as any other package. Which is just untar it, type +`./configure' and then `make'. More detailed instructions are in the +file `INSTALL', which is included in the source distribution. + +* Menu: + +* Building and installing tinc:: +* System files:: + + +File: tinc.info, Node: Building and installing tinc, Next: System files, Up: Installation + +3.1 Building and installing tinc +================================ + +Detailed instructions on configuring the source, building tinc and +installing tinc can be found in the file called `INSTALL'. + + If you happen to have a binary package for tinc for your +distribution, you can use the package management tools of that +distribution to install tinc. The documentation that comes along with +your distribution will tell you how to do that. + +* Menu: + +* Darwin (MacOS/X) build environment:: +* Cygwin (Windows) build environment:: +* MinGW (Windows) build environment:: + + +File: tinc.info, Node: Darwin (MacOS/X) build environment, Next: Cygwin (Windows) build environment, Up: Building and installing tinc + +3.1.1 Darwin (MacOS/X) build environment +---------------------------------------- + +In order to build tinc on Darwin, you need to install the MacOS/X +Developer Tools from +`http://developer.apple.com/tools/macosxtools.html' and a recent +version of Fink from `http://fink.sourceforge.net/'. + + After installation use fink to download and install the following +packages: autoconf25, automake, dlcompat, m4, openssl, zlib and lzo. + + +File: tinc.info, Node: Cygwin (Windows) build environment, Next: MinGW (Windows) build environment, Prev: Darwin (MacOS/X) build environment, Up: Building and installing tinc + +3.1.2 Cygwin (Windows) build environment +---------------------------------------- + +If Cygwin hasn't already been installed, install it directly from +`http://www.cygwin.com/'. + + When tinc is compiled in a Cygwin environment, it can only be run in +this environment, but all programs, including those started outside the +Cygwin environment, will be able to use the VPN. It will also support +all features. + + +File: tinc.info, Node: MinGW (Windows) build environment, Prev: Cygwin (Windows) build environment, Up: Building and installing tinc + +3.1.3 MinGW (Windows) build environment +--------------------------------------- + +You will need to install the MinGW environment from +`http://www.mingw.org'. + + When tinc is compiled using MinGW it runs natively under Windows, it +is not necessary to keep MinGW installed. + + When detaching, tinc will install itself as a service, which will be +restarted automatically after reboots. + + +File: tinc.info, Node: System files, Prev: Building and installing tinc, Up: Installation + +3.2 System files +================ + +Before you can run tinc, you must make sure you have all the needed +files on your system. + +* Menu: + +* Device files:: +* Other files:: + + +File: tinc.info, Node: Device files, Next: Other files, Up: System files + +3.2.1 Device files +------------------ + +First, you'll need the special device file(s) that form the interface +between the kernel and the daemon. + + The permissions for these files have to be such that only the super +user may read/write to this file. You'd want this, because otherwise +eavesdropping would become a bit too easy. This does, however, imply +that you'd have to run tincd as root. + + If you use Linux and have a kernel version prior to 2.4.0, you have +to make the ethertap devices: + + mknod -m 600 /dev/tap0 c 36 16 + mknod -m 600 /dev/tap1 c 36 17 + ... + mknod -m 600 /dev/tap_N_ c 36 _N+16_ + + There is a maximum of 16 ethertap devices. + + If you use the universal tun/tap driver, you have to create the +following device file (unless it already exist): + + mknod -m 600 /dev/tun c 10 200 + + If you use Linux, and you run the new 2.4 kernel using the devfs +filesystem, then the tun/tap device will probably be automatically +generated as `/dev/net/tun'. + + Unlike the ethertap device, you do not need multiple device files if +you are planning to run multiple tinc daemons. + + +File: tinc.info, Node: Other files, Prev: Device files, Up: System files + +3.2.2 Other files +----------------- + +`/etc/networks' +............... + +You may add a line to `/etc/networks' so that your VPN will get a +symbolic name. For example: + + myvpn 10.0.0.0 + +`/etc/services' +............... + +You may add this line to `/etc/services'. The effect is that you may +supply a `tinc' as a valid port number to some programs. The number +655 is registered with the IANA. + + tinc 655/tcp TINC + tinc 655/udp TINC + # Ivo Timmermans + + +File: tinc.info, Node: Configuration, Next: Running tinc, Prev: Installation, Up: Top + +4 Configuration +*************** + +* Menu: + +* Configuration introduction:: +* Multiple networks:: +* How connections work:: +* Configuration files:: +* Generating keypairs:: +* Network interfaces:: +* Example configuration:: + + +File: tinc.info, Node: Configuration introduction, Next: Multiple networks, Up: Configuration + +4.1 Configuration introduction +============================== + +Before actually starting to configure tinc and editing files, make sure +you have read this entire section so you know what to expect. Then, +make it clear to yourself how you want to organize your VPN: What are +the nodes (computers running tinc)? What IP addresses/subnets do they +have? What is the network mask of the entire VPN? Do you need special +firewall rules? Do you have to set up masquerading or forwarding rules? +Do you want to run tinc in router mode or switch mode? These questions +can only be answered by yourself, you will not find the answers in this +documentation. Make sure you have an adequate understanding of +networks in general. A good resource on networking is the Linux +Network Administrators Guide (http://www.linuxdoc.org/LDP/nag2/). + + If you have everything clearly pictured in your mind, proceed in the +following order: First, generate the configuration files (`tinc.conf', +your host configuration file, `tinc-up' and perhaps `tinc-down'). Then +generate the keypairs. Finally, distribute the host configuration +files. These steps are described in the subsections below. + + +File: tinc.info, Node: Multiple networks, Next: How connections work, Prev: Configuration introduction, Up: Configuration + +4.2 Multiple networks +===================== + +In order to allow you to run more than one tinc daemon on one computer, +for instance if your computer is part of more than one VPN, you can +assign a NETNAME to your VPN. It is not required if you only run one +tinc daemon, it doesn't even have to be the same on all the sites of +your VPN, but it is recommended that you choose one anyway. + + We will asume you use a netname throughout this document. This +means that you call tincd with the -n argument, which will assign a +netname to this daemon. + + The effect of this is that the daemon will set its configuration +root to `/usr/local/etc/tinc/NETNAME/', where NETNAME is your argument +to the -n option. You'll notice that it appears in syslog as +`tinc.NETNAME'. + + However, it is not strictly necessary that you call tinc with the -n +option. In this case, the network name would just be empty, and it will +be used as such. tinc now looks for files in `/usr/local/etc/tinc/', +instead of `/usr/local/etc/tinc/NETNAME/'; the configuration file +should be `/usr/local/etc/tinc/tinc.conf', and the host configuration +files are now expected to be in `/usr/local/etc/tinc/hosts/'. + + But it is highly recommended that you use this feature of tinc, +because it will be so much clearer whom your daemon talks to. Hence, +we will assume that you use it. + + +File: tinc.info, Node: How connections work, Next: Configuration files, Prev: Multiple networks, Up: Configuration + +4.3 How connections work +======================== + +When tinc starts up, it parses the command-line options and then reads +in the configuration file tinc.conf. If it sees one or more +`ConnectTo' values pointing to other tinc daemons in that file, it will +try to connect to those other daemons. Whether this succeeds or not +and whether `ConnectTo' is specified or not, tinc will listen for +incoming connection from other deamons. If you did specify a +`ConnectTo' value and the other side is not responding, tinc will keep +retrying. This means that once started, tinc will stay running until +you tell it to stop, and failures to connect to other tinc daemons will +not stop your tinc daemon for trying again later. This means you don't +have to intervene if there are temporary network problems. + + There is no real distinction between a server and a client in tinc. +If you wish, you can view a tinc daemon without a `ConnectTo' value as +a server, and one which does specify such a value as a client. It does +not matter if two tinc daemons have a `ConnectTo' value pointing to +each other however. + + +File: tinc.info, Node: Configuration files, Next: Generating keypairs, Prev: How connections work, Up: Configuration + +4.4 Configuration files +======================= + +The actual configuration of the daemon is done in the file +`/usr/local/etc/tinc/NETNAME/tinc.conf' and at least one other file in +the directory `/usr/local/etc/tinc/NETNAME/hosts/'. + + These file consists of comments (lines started with a #) or +assignments in the form of + + Variable = Value. + + The variable names are case insensitive, and any spaces, tabs, +newlines and carriage returns are ignored. Note: it is not required +that you put in the `=' sign, but doing so improves readability. If +you leave it out, remember to replace it with at least one space +character. + + In this section all valid variables are listed in alphabetical order. +The default value is given between parentheses, other comments are +between square brackets. + +* Menu: + +* Main configuration variables:: +* Host configuration variables:: +* Scripts:: +* How to configure:: + + +File: tinc.info, Node: Main configuration variables, Next: Host configuration variables, Up: Configuration files + +4.4.1 Main configuration variables +---------------------------------- + +AddressFamily = (any) + This option affects the address family of listening and outgoing + sockets. If any is selected, then depending on the operating + system both IPv4 and IPv6 or just IPv6 listening sockets will be + created. + +BindToAddress =
[experimental] + If your computer has more than one IPv4 or IPv6 address, tinc will + by default listen on all of them for incoming connections. It is + possible to bind only to a single address with this variable. + + This option may not work on all platforms. + +BindToInterface = [experimental] + If you have more than one network interface in your computer, tinc + will by default listen on all of them for incoming connections. + It is possible to bind tinc to a single interface like eth0 or + ppp0 with this variable. + + This option may not work on all platforms. + +BlockingTCP = (no) [experimental] + This options selects whether TCP connections, when established, + should use blocking writes. When turned off, tinc will never + block when a TCP connection becomes congested, but will have to + terminate that connection instead. If turned on, tinc will not + terminate connections but will block, thereby unable to process + data to/from other connections. Turn this option on if you also + use TCPOnly and tinc terminates connections frequently. + +ConnectTo = + Specifies which other tinc daemon to connect to on startup. + Multiple ConnectTo variables may be specified, in which case + outgoing connections to each specified tinc daemon are made. The + names should be known to this tinc daemon (i.e., there should be a + host configuration file for the name on the ConnectTo line). + + If you don't specify a host with ConnectTo, tinc won't try to + connect to other daemons at all, and will instead just listen for + incoming connections. + +Device = (`/dev/tap0', `/dev/net/tun' or other depending on platform) + The virtual network device to use. Tinc will automatically detect + what kind of device it is. Note that you can only use one device + per daemon. Under Windows, use INTERFACE instead of DEVICE. Note + that you can only use one device per daemon. See also *Note + Device files::. + +Hostnames = (no) + This option selects whether IP addresses (both real and on the VPN) + should be resolved. Since DNS lookups are blocking, it might + affect tinc's efficiency, even stopping the daemon for a few + seconds everytime it does a lookup if your DNS server is not + responding. + + This does not affect resolving hostnames to IP addresses from the + configuration file. + +Interface = + Defines the name of the interface corresponding to the virtual + network device. Depending on the operating system and the type of + device this may or may not actually set the name of the interface. + Under Windows, this variable is used to select which network + interface will be used. If you specified a Device, this variable + is almost always already correctly set. + +Mode = (router) + This option selects the way packets are routed to other daemons. + + router + In this mode Subnet variables in the host configuration files + will be used to form a routing table. Only unicast packets + of routable protocols (IPv4 and IPv6) are supported in this + mode. + + This is the default mode, and unless you really know you need + another mode, don't change it. + + switch + In this mode the MAC addresses of the packets on the VPN will + be used to dynamically create a routing table just like an + Ethernet switch does. Unicast, multicast and broadcast + packets of every protocol that runs over Ethernet are + supported in this mode at the cost of frequent broadcast ARP + requests and routing table updates. + + This mode is primarily useful if you want to bridge Ethernet + segments. + + hub + This mode is almost the same as the switch mode, but instead + every packet will be broadcast to the other daemons while no + routing table is managed. + +KeyExpire = (3600) + This option controls the time the encryption keys used to encrypt + the data are valid. It is common practice to change keys at + regular intervals to make it even harder for crackers, even though + it is thought to be nearly impossible to crack a single key. + +MACExpire = (600) + This option controls the amount of time MAC addresses are kept + before they are removed. This only has effect when Mode is set to + "switch". + +Name = [required] + This is a symbolic name for this connection. It can be anything + +PingTimeout = (60) + The number of seconds of inactivity that tinc will wait before + sending a probe to the other end. If that other end doesn't + answer within that same amount of seconds, the connection is + terminated, and the others will be notified of this. + +PriorityInheritance = (no) [experimental] + When this option is enabled the value of the TOS field of tunneled + IPv4 packets will be inherited by the UDP packets that are sent + out. + +PrivateKey = [obsolete] + This is the RSA private key for tinc. However, for safety reasons + it is advised to store private keys of any kind in separate files. + This prevents accidental eavesdropping if you are editting the + configuration file. + +PrivateKeyFile = (`/usr/local/etc/tinc/NETNAME/rsa_key.priv') + This is the full path name of the RSA private key file that was + generated by `tincd --generate-keys'. It must be a full path, not + a relative directory. + + Note that there must be exactly one of PrivateKey or PrivateKeyFile + specified in the configuration file. + +TunnelServer = (no) [experimental] + When this option is enabled tinc will no longer forward + information between other tinc daemons, and will only allow nodes + and subnets on the VPN which are present in the + `/usr/local/etc/tinc/NETNAME/hosts/' directory. + + + +File: tinc.info, Node: Host configuration variables, Next: Scripts, Prev: Main configuration variables, Up: Configuration files + +4.4.2 Host configuration variables +---------------------------------- + +Address = [recommended] + This variable is only required if you want to connect to this + host. It must resolve to the external IP address where the host + can be reached, not the one that is internal to the VPN. + +Cipher = (blowfish) + The symmetric cipher algorithm used to encrypt UDP packets. Any + cipher supported by OpenSSL is recognized. Furthermore, + specifying "none" will turn off packet encryption. It is best to + use only those ciphers which support CBC mode. + +Compression = (0) + This option sets the level of compression used for UDP packets. + Possible values are 0 (off), 1 (fast zlib) and any integer up to 9 + (best zlib), 10 (fast lzo) and 11 (best lzo). + +Digest = (sha1) + The digest algorithm used to authenticate UDP packets. Any digest + supported by OpenSSL is recognized. Furthermore, specifying + "none" will turn off packet authentication. + +IndirectData = (no) + This option specifies whether other tinc daemons besides the one + you specified with ConnectTo can make a direct connection to you. + This is especially useful if you are behind a firewall and it is + impossible to make a connection from the outside to your tinc + daemon. Otherwise, it is best to leave this option out or set it + to no. + +MACLength = (4) + The length of the message authentication code used to authenticate + UDP packets. Can be anything from 0 up to the length of the + digest produced by the digest algorithm. + +Port = (655) + This is the port this tinc daemon listens on. You can use decimal + portnumbers or symbolic names (as listed in `/etc/services'). + +PublicKey = [obsolete] + This is the RSA public key for this host. + +PublicKeyFile = [obsolete] + This is the full path name of the RSA public key file that was + generated by `tincd --generate-keys'. It must be a full path, not + a relative directory. + + From version 1.0pre4 on tinc will store the public key directly + into the host configuration file in PEM format, the above two + options then are not necessary. Either the PEM format is used, or + exactly *one of the above two options* must be specified in each + host configuration file, if you want to be able to establish a + connection with that host. + +Subnet = + The subnet which this tinc daemon will serve. Tinc tries to look + up which other daemon it should send a packet to by searching the + appropiate subnet. If the packet matches a subnet, it will be + sent to the daemon who has this subnet in his host configuration + file. Multiple subnet lines can be specified for each daemon. + + Subnets can either be single MAC, IPv4 or IPv6 addresses, in which + case a subnet consisting of only that single address is assumed, + or they can be a IPv4 or IPv6 network address with a prefixlength. + Shorthand notations are not supported. For example, IPv4 subnets + must be in a form like 192.168.1.0/24, where 192.168.1.0 is the + network address and 24 is the number of bits set in the netmask. + Note that subnets like 192.168.1.1/24 are invalid! Read a + networking HOWTO/FAQ/guide if you don't understand this. IPv6 + subnets are notated like fec0:0:0:1:0:0:0:0/64. MAC addresses are + notated like 0:1a:2b:3c:4d:5e. + + Prefixlength is the number of bits set to 1 in the netmask part; + for example: netmask 255.255.255.0 would become /24, 255.255.252.0 + becomes /22. This conforms to standard CIDR notation as described + in RFC1519 (ftp://ftp.isi.edu/in-notes/rfc1519.txt) + +TCPonly = (no) [experimental] + If this variable is set to yes, then the packets are tunnelled + over a TCP connection instead of a UDP connection. This is + especially useful for those who want to run a tinc daemon from + behind a masquerading firewall, or if UDP packet routing is + disabled somehow. Setting this options also implicitly sets + IndirectData. + + +File: tinc.info, Node: Scripts, Next: How to configure, Prev: Host configuration variables, Up: Configuration files + +4.4.3 Scripts +------------- + +Apart from reading the server and host configuration files, tinc can +also run scripts at certain moments. Under Windows (not Cygwin), the +scripts should have the extension .bat. + +`/usr/local/etc/tinc/NETNAME/tinc-up' + This is the most important script. If it is present it will be + executed right after the tinc daemon has been started and has + connected to the virtual network device. It should be used to set + up the corresponding network interface, but can also be used to + start other things. Under Windows you can use the Network + Connections control panel instead of creating this script. + +`/usr/local/etc/tinc/NETNAME/tinc-down' + This script is started right before the tinc daemon quits. + +`/usr/local/etc/tinc/NETNAME/hosts/HOST-up' + This script is started when the tinc daemon with name HOST becomes + reachable. + +`/usr/local/etc/tinc/NETNAME/hosts/HOST-down' + This script is started when the tinc daemon with name HOST becomes + unreachable. + + The scripts are started without command line arguments, but can make +use of certain environment variables. Under UNIX like operating +systems the names of environment variables must be preceded by a $ in +scripts. Under Windows, in `.bat' files, they have to be put between % +signs. + +`NETNAME' + If a netname was specified, this environment variable contains it. + +`NAME' + Contains the name of this tinc daemon. + +`DEVICE' + Contains the name of the virtual network device that tinc uses. + +`INTERFACE' + Contains the name of the virtual network interface that tinc uses. + This should be used for commands like ifconfig. + +`NODE' + When a host becomes (un)reachable, this is set to its name. + +`REMOTEADDRESS' + When a host becomes (un)reachable, this is set to its real address. + +`REMOTEPORT' + When a host becomes (un)reachable, this is set to the port number + it uses for communication with other tinc daemons. + + +File: tinc.info, Node: How to configure, Prev: Scripts, Up: Configuration files + +4.4.4 How to configure +---------------------- + +Step 1. Creating the main configuration file +............................................. + +The main configuration file will be called +`/usr/local/etc/tinc/NETNAME/tinc.conf'. Adapt the following example +to create a basic configuration file: + + Name = YOURNAME + Device = `/dev/tap0' + + Then, if you know to which other tinc daemon(s) yours is going to +connect, add `ConnectTo' values. + +Step 2. Creating your host configuration file +.............................................. + +If you added a line containing `Name = yourname' in the main +configuarion file, you will need to create a host configuration file +`/usr/local/etc/tinc/NETNAME/hosts/yourname'. Adapt the following +example to create a host configuration file: + + Address = your.real.hostname.org + Subnet = 192.168.1.0/24 + + You can also use an IP address instead of a hostname. The `Subnet' +specifies the address range that is local for _your part of the VPN +only_. If you have multiple address ranges you can specify more than +one `Subnet'. You might also need to add a `Port' if you want your +tinc daemon to run on a different port number than the default (655). + + +File: tinc.info, Node: Generating keypairs, Next: Network interfaces, Prev: Configuration files, Up: Configuration + +4.5 Generating keypairs +======================= + +Now that you have already created the main configuration file and your +host configuration file, you can easily create a public/private keypair +by entering the following command: + + tincd -n NETNAME -K + + Tinc will generate a public and a private key and ask you where to +put them. Just press enter to accept the defaults. + + +File: tinc.info, Node: Network interfaces, Next: Example configuration, Prev: Generating keypairs, Up: Configuration + +4.6 Network interfaces +====================== + +Before tinc can start transmitting data over the tunnel, it must set up +the virtual network interface. + + First, decide which IP addresses you want to have associated with +these devices, and what network mask they must have. + + Tinc will open a virtual network device (`/dev/tun', `/dev/tap0' or +similar), which will also create a network interface called something +like `tun0', `tap0'. If you are using the Linux tun/tap driver, the +network interface will by default have the same name as the NETNAME. +Under Windows you can change the name of the network interface from the +Network Connections control panel. + + You can configure the network interface by putting ordinary +ifconfig, route, and other commands to a script named +`/usr/local/etc/tinc/NETNAME/tinc-up'. When tinc starts, this script +will be executed. When tinc exits, it will execute the script named +`/usr/local/etc/tinc/NETNAME/tinc-down', but normally you don't need to +create that script. + + An example `tinc-up' script: + + #!/bin/sh + ifconfig $INTERFACE 192.168.1.1 netmask 255.255.0.0 + + This script gives the interface an IP address and a netmask. The +kernel will also automatically add a route to this interface, so +normally you don't need to add route commands to the `tinc-up' script. +The kernel will also bring the interface up after this command. The +netmask is the mask of the _entire_ VPN network, not just your own +subnet. + + The exact syntax of the ifconfig and route commands differs from +platform to platform. You can look up the commands for setting +addresses and adding routes in *Note Platform specific information::, +but it is best to consult the manpages of those utilities on your +platform. + + +File: tinc.info, Node: Example configuration, Prev: Network interfaces, Up: Configuration + +4.7 Example configuration +========================= + +Imagine the following situation. Branch A of our example `company' +wants to connect three branch offices in B, C and D using the Internet. +All four offices have a 24/7 connection to the Internet. + + A is going to serve as the center of the network. B and C will +connect to A, and D will connect to C. Each office will be assigned +their own IP network, 10.x.0.0. + + A: net 10.1.0.0 mask 255.255.0.0 gateway 10.1.54.1 internet IP 1.2.3.4 + B: net 10.2.0.0 mask 255.255.0.0 gateway 10.2.1.12 internet IP 2.3.4.5 + C: net 10.3.0.0 mask 255.255.0.0 gateway 10.3.69.254 internet IP 3.4.5.6 + D: net 10.4.0.0 mask 255.255.0.0 gateway 10.4.3.32 internet IP 4.5.6.7 + + Here, "gateway" is the VPN IP address of the machine that is running +the tincd, and "internet IP" is the IP address of the firewall, which +does not need to run tincd, but it must do a port forwarding of TCP and +UDP on port 655 (unless otherwise configured). + + In this example, it is assumed that eth0 is the interface that +points to the inner (physical) LAN of the office, although this could +also be the same as the interface that leads to the Internet. The +configuration of the real interface is also shown as a comment, to give +you an idea of how these example host is set up. All branches use the +netname `company' for this particular VPN. + +For Branch A +............ + +_BranchA_ would be configured like this: + + In `/usr/local/etc/tinc/company/tinc-up': + + # Real interface of internal network: + # ifconfig eth0 10.1.54.1 netmask 255.255.0.0 + + ifconfig $INTERFACE 10.1.54.1 netmask 255.0.0.0 + + and in `/usr/local/etc/tinc/company/tinc.conf': + + Name = BranchA + Device = /dev/tap0 + + On all hosts, `/usr/local/etc/tinc/company/hosts/BranchA' contains: + + Subnet = 10.1.0.0/16 + Address = 1.2.3.4 + + -----BEGIN RSA PUBLIC KEY----- + ... + -----END RSA PUBLIC KEY----- + + Note that the IP addresses of eth0 and tap0 are the same. This is +quite possible, if you make sure that the netmasks of the interfaces +are different. It is in fact recommended to give give both real +internal network interfaces and tap interfaces the same IP address, +since that will make things a lot easier to remember and set up. + +For Branch B +............ + +In `/usr/local/etc/tinc/company/tinc-up': + + # Real interface of internal network: + # ifconfig eth0 10.2.43.8 netmask 255.255.0.0 + + ifconfig $INTERFACE 10.2.1.12 netmask 255.0.0.0 + + and in `/usr/local/etc/tinc/company/tinc.conf': + + Name = BranchB + ConnectTo = BranchA + + Note here that the internal address (on eth0) doesn't have to be the +same as on the tap0 device. Also, ConnectTo is given so that no-one can +connect to this node. + + On all hosts, in `/usr/local/etc/tinc/company/hosts/BranchB': + + Subnet = 10.2.0.0/16 + Address = 2.3.4.5 + + -----BEGIN RSA PUBLIC KEY----- + ... + -----END RSA PUBLIC KEY----- + +For Branch C +............ + +In `/usr/local/etc/tinc/company/tinc-up': + + # Real interface of internal network: + # ifconfig eth0 10.3.69.254 netmask 255.255.0.0 + + ifconfig $INTERFACE 10.3.69.254 netmask 255.0.0.0 + + and in `/usr/local/etc/tinc/company/tinc.conf': + + Name = BranchC + ConnectTo = BranchA + Device = /dev/tap1 + + C already has another daemon that runs on port 655, so they have to +reserve another port for tinc. It knows the portnumber it has to listen +on from it's own host configuration file. + + On all hosts, in `/usr/local/etc/tinc/company/hosts/BranchC': + + Address = 3.4.5.6 + Subnet = 10.3.0.0/16 + Port = 2000 + + -----BEGIN RSA PUBLIC KEY----- + ... + -----END RSA PUBLIC KEY----- + +For Branch D +............ + +In `/usr/local/etc/tinc/company/tinc-up': + + # Real interface of internal network: + # ifconfig eth0 10.4.3.32 netmask 255.255.0.0 + + ifconfig $INTERFACE 10.4.3.32 netmask 255.0.0.0 + + and in `/usr/local/etc/tinc/company/tinc.conf': + + Name = BranchD + ConnectTo = BranchC + Device = /dev/net/tun + + D will be connecting to C, which has a tincd running for this +network on port 2000. It knows the port number from the host +configuration file. Also note that since D uses the tun/tap driver, +the network interface will not be called `tun' or `tap0' or something +like that, but will have the same name as netname. + + On all hosts, in `/usr/local/etc/tinc/company/hosts/BranchD': + + Subnet = 10.4.0.0/16 + Address = 4.5.6.7 + + -----BEGIN RSA PUBLIC KEY----- + ... + -----END RSA PUBLIC KEY----- + +Key files +......... + +A, B, C and D all have generated a public/private keypair with the +following command: + + tincd -n company -K + + The private key is stored in +`/usr/local/etc/tinc/company/rsa_key.priv', the public key is put into +the host configuration file in the `/usr/local/etc/tinc/company/hosts/' +directory. During key generation, tinc automatically guesses the right +filenames based on the -n option and the Name directive in the +`tinc.conf' file (if it is available). + +Starting +........ + +After each branch has finished configuration and they have distributed +the host configuration files amongst them, they can start their tinc +daemons. They don't necessarily have to wait for the other branches to +have started their daemons, tinc will try connecting until they are +available. + + +File: tinc.info, Node: Running tinc, Next: Technical information, Prev: Configuration, Up: Top + +5 Running tinc +************** + +If everything else is done, you can start tinc by typing the following +command: + + tincd -n NETNAME + + Tinc will detach from the terminal and continue to run in the +background like a good daemon. If there are any problems however you +can try to increase the debug level and look in the syslog to find out +what the problems are. + +* Menu: + +* Runtime options:: +* Signals:: +* Debug levels:: +* Solving problems:: +* Error messages:: +* Sending bug reports:: + + +File: tinc.info, Node: Runtime options, Next: Signals, Up: Running tinc + +5.1 Runtime options +=================== + +Besides the settings in the configuration file, tinc also accepts some +command line options. + +`-c, --config=PATH' + Read configuration options from the directory PATH. The default is + `/usr/local/etc/tinc/NETNAME/'. + +`-D, --no-detach' + Don't fork and detach. This will also disable the automatic + restart mechanism for fatal errors. + +`-d, --debug=LEVEL' + Set debug level to LEVEL. The higher the debug level, the more + gets logged. Everything goes via syslog. + +`-k, --kill[=SIGNAL]' + Attempt to kill a running tincd (optionally with the specified + SIGNAL instead of SIGTERM) and exit. Use it in conjunction with + the -n option to make sure you kill the right tinc daemon. Under + native Windows the optional argument is ignored, the service will + always be stopped and removed. + +`-n, --net=NETNAME' + Use configuration for net NETNAME. *Note Multiple networks::. + +`-K, --generate-keys[=BITS]' + Generate public/private keypair of BITS length. If BITS is not + specified, 1024 is the default. tinc will ask where you want to + store the files, but will default to the configuration directory + (you can use the -c or -n option in combination with -K). After + that, tinc will quit. + +`-L, --mlock' + Lock tinc into main memory. This will prevent sensitive data like + shared private keys to be written to the system swap + files/partitions. + +`--logfile[=FILE]' + Write log entries to a file instead of to the system logging + facility. If FILE is omitted, the default is + `/usr/local/var/log/tinc.NETNAME.log'. + +`--pidfile=FILE' + Write PID to FILE instead of `/usr/local/var/run/tinc.NETNAME.pid'. + +`--bypass-security' + Disables encryption and authentication. Only useful for debugging. + +`--help' + Display a short reminder of these runtime options and terminate. + +`--version' + Output version information and exit. + + + +File: tinc.info, Node: Signals, Next: Debug levels, Prev: Runtime options, Up: Running tinc + +5.2 Signals +=========== + +You can also send the following signals to a running tincd process: + +`ALRM' + Forces tinc to try to connect to all uplinks immediately. Usually + tinc attempts to do this itself, but increases the time it waits + between the attempts each time it failed, and if tinc didn't + succeed to connect to an uplink the first time after it started, + it defaults to the maximum time of 15 minutes. + +`HUP' + Partially rereads configuration files. Connections to hosts whose + host config file are removed are closed. New outgoing connections + specified in `tinc.conf' will be made. + +`INT' + Temporarily increases debug level to 5. Send this signal again to + revert to the original level. + +`USR1' + Dumps the connection list to syslog. + +`USR2' + Dumps virtual network device statistics, all known nodes, edges + and subnets to syslog. + +`WINCH' + Purges all information remembered about unreachable nodes. + + + +File: tinc.info, Node: Debug levels, Next: Solving problems, Prev: Signals, Up: Running tinc + +5.3 Debug levels +================ + +The tinc daemon can send a lot of messages to the syslog. The higher +the debug level, the more messages it will log. Each level inherits +all messages of the previous level: + +`0' + This will log a message indicating tinc has started along with a + version number. It will also log any serious error. + +`1' + This will log all connections that are made with other tinc + daemons. + +`2' + This will log status and error messages from scripts and other + tinc daemons. + +`3' + This will log all requests that are exchanged with other tinc + daemons. These include authentication, key exchange and connection + list updates. + +`4' + This will log a copy of everything received on the meta socket. + +`5' + This will log all network traffic over the virtual private network. + + + +File: tinc.info, Node: Solving problems, Next: Error messages, Prev: Debug levels, Up: Running tinc + +5.4 Solving problems +==================== + +If tinc starts without problems, but if the VPN doesn't work, you will +have to find the cause of the problem. The first thing to do is to +start tinc with a high debug level in the foreground, so you can +directly see everything tinc logs: + + tincd -n NETNAME -d5 -D + + If tinc does not log any error messages, then you might want to +check the following things: + + * `tinc-up' script Does this script contain the right commands? + Normally you must give the interface the address of this host on + the VPN, and the netmask must be big enough so that the entire VPN + is covered. + + * Subnet Does the Subnet (or Subnets) in the host configuration file + of this host match the portion of the VPN that belongs to this + host? + + * Firewalls and NATs Do you have a firewall or a NAT device (a + masquerading firewall or perhaps an ADSL router that performs + masquerading)? If so, check that it allows TCP and UDP traffic on + port 655. If it masquerades and the host running tinc is behind + it, make sure that it forwards TCP and UDP traffic to port 655 to + the host running tinc. You can add `TCPOnly = yes' to your host + config file to force tinc to only use a single TCP connection, + this works through most firewalls and NATs. + + + +File: tinc.info, Node: Error messages, Next: Sending bug reports, Prev: Solving problems, Up: Running tinc + +5.5 Error messages +================== + +What follows is a list of the most common error messages you might find +in the logs. Some of them will only be visible if the debug level is +high enough. + +`Could not open /dev/tap0: No such device' + * You forgot to `modprobe netlink_dev' or `modprobe ethertap'. + + * You forgot to compile `Netlink device emulation' in the + kernel. + +`Can't write to /dev/net/tun: No such device' + * You forgot to `modprobe tun'. + + * You forgot to compile `Universal TUN/TAP driver' in the + kernel. + + * The tun device is located somewhere else in `/dev/'. + +`Network address and prefix length do not match!' + * The Subnet field must contain a _network_ address, trailing + bits should be 0. + + * If you only want to use one IP address, set the netmask to + /32. + +`Error reading RSA key file `rsa_key.priv': No such file or directory' + * You forgot to create a public/private keypair. + + * Specify the complete pathname to the private key file with + the `PrivateKeyFile' option. + +`Warning: insecure file permissions for RSA private key file `rsa_key.priv'!' + * The private key file is readable by users other than root. + Use chmod to correct the file permissions. + +`Creating metasocket failed: Address family not supported' + * By default tinc tries to create both IPv4 and IPv6 sockets. + On some platforms this might not be implemented. If the logs + show `Ready' later on, then at least one metasocket was + created, and you can ignore this message. You can add + `AddressFamily = ipv4' to `tinc.conf' to prevent this from + happening. + +`Cannot route packet: unknown IPv4 destination 1.2.3.4' + * You try to send traffic to a host on the VPN for which no + Subnet is known. + + * If it is a broadcast address (ending in .255), it probably is + a samba server or a Windows host sending broadcast packets. + You can ignore it. + +`Cannot route packet: ARP request for unknown address 1.2.3.4' + * You try to send traffic to a host on the VPN for which no + Subnet is known. + +`Packet with destination 1.2.3.4 is looping back to us!' + * Something is not configured right. Packets are being sent out + to the virtual network device, but according to the Subnet + directives in your host configuration file, those packets + should go to your own host. Most common mistake is that you + have a Subnet line in your host configuration file with a + prefix length which is just as large as the prefix of the + virtual network interface. The latter should in almost all + cases be larger. Rethink your configuration. Note that you + will only see this message if you specified a debug level of + 5 or higher! + + * Chances are that a `Subnet = ...' line in the host + configuration file of this tinc daemon is wrong. Change it + to a subnet that is accepted locally by another interface, or + if that is not the case, try changing the prefix length into + /32. + +`Node foo (1.2.3.4) is not reachable' + * Node foo does not have a connection anymore, its tinc daemon + is not running or its connection to the Internet is broken. + +`Received UDP packet from unknown source 1.2.3.4 (port 12345)' + * If you see this only sporadically, it is harmless and caused + by a node sending packets using an old key. + + * If you see this often and another node is not reachable + anymore, then a NAT (masquerading firewall) is changing the + source address of UDP packets. You can add `TCPOnly = yes' + to host configuration files to force all VPN traffic to go + over a TCP connection. + +`Got bad/bogus/unauthorized REQUEST from foo (1.2.3.4 port 12345)' + * Node foo does not have the right public/private keypair. + Generate new keypairs and distribute them again. + + * An attacker tries to gain access to your VPN. + + * A network error caused corruption of metadata sent from foo. + + + +File: tinc.info, Node: Sending bug reports, Prev: Error messages, Up: Running tinc + +5.6 Sending bug reports +======================= + +If you really can't find the cause of a problem, or if you suspect tinc +is not working right, you can send us a bugreport, see *Note Contact +information::. Be sure to include the following information in your +bugreport: + + * A clear description of what you are trying to achieve and what the + problem is. + + * What platform (operating system, version, hardware architecture) + and which version of tinc you use. + + * If compiling tinc fails, a copy of `config.log' and the error + messages you get. + + * Otherwise, a copy of `tinc.conf', `tinc-up' and all files in the + `hosts/' directory. + + * The output of the commands `ifconfig -a' and `route -n' (or + `netstat -rn' if that doesn't work). + + * The output of any command that fails to work as it should (like + ping or traceroute). + + +File: tinc.info, Node: Technical information, Next: Platform specific information, Prev: Running tinc, Up: Top + +6 Technical information +*********************** + +* Menu: + +* The connection:: +* The meta-protocol:: +* Security:: + + +File: tinc.info, Node: The connection, Next: The meta-protocol, Up: Technical information + +6.1 The connection +================== + +Tinc is a daemon that takes VPN data and transmit that to another host +computer over the existing Internet infrastructure. + +* Menu: + +* The UDP tunnel:: +* The meta-connection:: + + +File: tinc.info, Node: The UDP tunnel, Next: The meta-connection, Up: The connection + +6.1.1 The UDP tunnel +-------------------- + +The data itself is read from a character device file, the so-called +_virtual network device_. This device is associated with a network +interface. Any data sent to this interface can be read from the device, +and any data written to the device gets sent from the interface. There +are two possible types of virtual network devices: `tun' style, which +are point-to-point devices which can only handle IPv4 and/or IPv6 +packets, and `tap' style, which are Ethernet devices and handle +complete Ethernet frames. + + So when tinc reads an Ethernet frame from the device, it determines +its type. When tinc is in it's default routing mode, it can handle IPv4 +and IPv6 packets. Depending on the Subnet lines, it will send the +packets off to their destination IP address. In the `switch' and `hub' +mode, tinc will use broadcasts and MAC address discovery to deduce the +destination of the packets. Since the latter modes only depend on the +link layer information, any protocol that runs over Ethernet is +supported (for instance IPX and Appletalk). However, only `tap' style +devices provide this information. + + After the destination has been determined, the packet will be +compressed (optionally), a sequence number will be added to the packet, +the packet will then be encrypted and a message authentication code +will be appended. + + When that is done, time has come to actually transport the packet to +the destination computer. We do this by sending the packet over an UDP +connection to the destination host. This is called _encapsulating_, +the VPN packet (though now encrypted) is encapsulated in another IP +datagram. + + When the destination receives this packet, the same thing happens, +only in reverse. So it checks the message authentication code, +decrypts the contents of the UDP datagram, checks the sequence number +and writes the decrypted information to its own virtual network device. + + If the virtual network device is a `tun' device (a point-to-point +tunnel), there is no problem for the kernel to accept a packet. +However, if it is a `tap' device (this is the only available type on +FreeBSD), the destination MAC address must match that of the virtual +network interface. If tinc is in it's default routing mode, ARP does +not work, so the correct destination MAC can not be known by the +sending host. Tinc solves this by letting the receiving end detect the +MAC address of its own virtual network interface and overwriting the +destination MAC address of the received packet. + + In switch or hub modes ARP does work so the sender already knows the +correct destination MAC address. In those modes every interface should +have a unique MAC address, so make sure they are not the same. Because +switch and hub modes rely on MAC addresses to function correctly, these +modes cannot be used on the following operating systems which don't +have a `tap' style virtual network device: OpenBSD, NetBSD, Darwin and +Solaris. + + +File: tinc.info, Node: The meta-connection, Prev: The UDP tunnel, Up: The connection + +6.1.2 The meta-connection +------------------------- + +Having only a UDP connection available is not enough. Though suitable +for transmitting data, we want to be able to reliably send other +information, such as routing and session key information to somebody. + + TCP is a better alternative, because it already contains protection +against information being lost, unlike UDP. + + So we establish two connections. One for the encrypted VPN data, +and one for other information, the meta-data. Hence, we call the second +connection the meta-connection. We can now be sure that the +meta-information doesn't get lost on the way to another computer. + + Like with any communication, we must have a protocol, so that +everybody knows what everything stands for, and how she should react. +Because we have two connections, we also have two protocols. The +protocol used for the UDP data is the "data-protocol," the other one is +the "meta-protocol." + + The reason we don't use TCP for both protocols is that UDP is much +better for encapsulation, even while it is less reliable. The real +problem is that when TCP would be used to encapsulate a TCP stream +that's on the private network, for every packet sent there would be +three ACKs sent instead of just one. Furthermore, if there would be a +timeout, both TCP streams would sense the timeout, and both would start +re-sending packets. + + +File: tinc.info, Node: The meta-protocol, Next: Security, Prev: The connection, Up: Technical information + +6.2 The meta-protocol +===================== + +The meta protocol is used to tie all tinc daemons together, and +exchange information about which tinc daemon serves which virtual +subnet. + + The meta protocol consists of requests that can be sent to the other +side. Each request has a unique number and several parameters. All +requests are represented in the standard ASCII character set. It is +possible to use tools such as telnet or netcat to connect to a tinc +daemon started with the -bypass-security option and to read and write +requests by hand, provided that one understands the numeric codes sent. + + The authentication scheme is described in *Note Authentication +protocol::. After a successful authentication, the server and the +client will exchange all the information about other tinc daemons and +subnets they know of, so that both sides (and all the other tinc +daemons behind them) have their information synchronised. + + message + ------------------------------------------------------------------ + ADD_EDGE node1 node2 21.32.43.54 655 222 0 + | | | | | +-> options + | | | | +----> weight + | | | +--------> UDP port of node2 + | | +----------------> real address of node2 + | +-------------------------> name of destination node + +-------------------------------> name of source node + + ADD_SUBNET node 192.168.1.0/24 + | | +--> prefixlength + | +--------> network address + +------------------> owner of this subnet + ------------------------------------------------------------------ + + The ADD_EDGE messages are to inform other tinc daemons that a +connection between two nodes exist. The address of the destination node +is available so that VPN packets can be sent directly to that node. + + The ADD_SUBNET messages inform other tinc daemons that certain +subnets belong to certain nodes. tinc will use it to determine to which +node a VPN packet has to be sent. + + message + ------------------------------------------------------------------ + DEL_EDGE node1 node2 + | +----> name of destination node + +----------> name of source node + + DEL_SUBNET node 192.168.1.0/24 + | | +--> prefixlength + | +--------> network address + +------------------> owner of this subnet + ------------------------------------------------------------------ + + In case a connection between two daemons is closed or broken, +DEL_EDGE messages are sent to inform the other daemons of that fact. +Each daemon will calculate a new route to the the daemons, or mark them +unreachable if there isn't any. + + message + ------------------------------------------------------------------ + REQ_KEY origin destination + | +--> name of the tinc daemon it wants the key from + +----------> name of the daemon that wants the key + + ANS_KEY origin destination 4ae0b0a82d6e0078 91 64 4 + | | \______________/ | | +--> MAC length + | | | | +-----> digest algorithm + | | | +--------> cipher algorithm + | | +--> 128 bits key + | +--> name of the daemon that wants the key + +----------> name of the daemon that uses this key + + KEY_CHANGED origin + +--> daemon that has changed it's packet key + ------------------------------------------------------------------ + + The keys used to encrypt VPN packets are not sent out directly. This +is because it would generate a lot of traffic on VPNs with many +daemons, and chances are that not every tinc daemon will ever send a +packet to every other daemon. Instead, if a daemon needs a key it sends +a request for it via the meta connection of the nearest hop in the +direction of the destination. + + daemon message + ------------------------------------------------------------------ + origin PING + dest. PONG + ------------------------------------------------------------------ + + There is also a mechanism to check if hosts are still alive. Since +network failures or a crash can cause a daemon to be killed without +properly shutting down the TCP connection, this is necessary to keep an +up to date connection list. PINGs are sent at regular intervals, except +when there is also some other traffic. A little bit of salt (random +data) is added with each PING and PONG message, to make sure that long +sequences of PING/PONG messages without any other traffic won't result +in known plaintext. + + This basically covers what is sent over the meta connection by tinc. + + +File: tinc.info, Node: Security, Prev: The meta-protocol, Up: Technical information + +6.3 Security +============ + +Tinc got its name from "TINC," short for _There Is No Cabal_; the +alleged Cabal was/is an organisation that was said to keep an eye on the +entire Internet. As this is exactly what you _don't_ want, we named +the tinc project after TINC. + + But in order to be "immune" to eavesdropping, you'll have to encrypt +your data. Because tinc is a _Secure_ VPN (SVPN) daemon, it does +exactly that: encrypt. Tinc by default uses blowfish encryption with +128 bit keys in CBC mode, 32 bit sequence numbers and 4 byte long +message authentication codes to make sure eavesdroppers cannot get and +cannot change any information at all from the packets they can +intercept. The encryption algorithm and message authentication +algorithm can be changed in the configuration. The length of the message +authentication codes is also adjustable. The length of the key for the +encryption algorithm is always the default length used by OpenSSL. + +* Menu: + +* Authentication protocol:: +* Encryption of network packets:: +* Security issues:: + + +File: tinc.info, Node: Authentication protocol, Next: Encryption of network packets, Up: Security + +6.3.1 Authentication protocol +----------------------------- + +A new scheme for authentication in tinc has been devised, which offers +some improvements over the protocol used in 1.0pre2 and 1.0pre3. +Explanation is below. + + daemon message + -------------------------------------------------------------------------- + client + + server + + client ID client 12 + | +---> version + +-------> name of tinc daemon + + server ID server 12 + | +---> version + +-------> name of tinc daemon + + client META_KEY 5f0823a93e35b69e...7086ec7866ce582b + \_________________________________/ + +-> RSAKEYLEN bits totally random string S1, + encrypted with server's public RSA key + + server META_KEY 6ab9c1640388f8f0...45d1a07f8a672630 + \_________________________________/ + +-> RSAKEYLEN bits totally random string S2, + encrypted with client's public RSA key + + From now on: + - the client will symmetrically encrypt outgoing traffic using S1 + - the server will symmetrically encrypt outgoing traffic using S2 + + client CHALLENGE da02add1817c1920989ba6ae2a49cecbda0 + \_________________________________/ + +-> CHALLEN bits totally random string H1 + + server CHALLENGE 57fb4b2ccd70d6bb35a64c142f47e61d57f + \_________________________________/ + +-> CHALLEN bits totally random string H2 + + client CHAL_REPLY 816a86 + +-> 160 bits SHA1 of H2 + + server CHAL_REPLY 928ffe + +-> 160 bits SHA1 of H1 + + After the correct challenge replies are received, both ends have proved + their identity. Further information is exchanged. + + client ACK 655 123 0 + | | +-> options + | +----> estimated weight + +--------> listening port of client + + server ACK 655 321 0 + | | +-> options + | +----> estimated weight + +--------> listening port of server + -------------------------------------------------------------------------- + + This new scheme has several improvements, both in efficiency and +security. + + First of all, the server sends exactly the same kind of messages +over the wire as the client. The previous versions of tinc first +authenticated the client, and then the server. This scheme even allows +both sides to send their messages simultaneously, there is no need to +wait for the other to send something first. This means that any +calculations that need to be done upon sending or receiving a message +can also be done in parallel. This is especially important when doing +RSA encryption/decryption. Given that these calculations are the main +part of the CPU time spent for the authentication, speed is improved by +a factor 2. + + Second, only one RSA encrypted message is sent instead of two. This +reduces the amount of information attackers can see (and thus use for a +cryptographic attack). It also improves speed by a factor two, making +the total speedup a factor 4. + + Third, and most important: The symmetric cipher keys are exchanged +first, the challenge is done afterwards. In the previous authentication +scheme, because a man-in-the-middle could pass the challenge/chal_reply +phase (by just copying the messages between the two real tinc daemons), +but no information was exchanged that was really needed to read the +rest of the messages, the challenge/chal_reply phase was of no real +use. The man-in-the-middle was only stopped by the fact that only after +the ACK messages were encrypted with the symmetric cipher. Potentially, +it could even send it's own symmetric key to the server (if it knew the +server's public key) and read some of the metadata the server would +send it (it was impossible for the mitm to read actual network packets +though). The new scheme however prevents this. + + This new scheme makes sure that first of all, symmetric keys are +exchanged. The rest of the messages are then encrypted with the +symmetric cipher. Then, each side can only read received messages if +they have their private key. The challenge is there to let the other +side know that the private key is really known, because a challenge +reply can only be sent back if the challenge is decrypted correctly, +and that can only be done with knowledge of the private key. + + Fourth: the first thing that is sent via the symmetric cipher +encrypted connection is a totally random string, so that there is no +known plaintext (for an attacker) in the beginning of the encrypted +stream. + + +File: tinc.info, Node: Encryption of network packets, Next: Security issues, Prev: Authentication protocol, Up: Security + +6.3.2 Encryption of network packets +----------------------------------- + +A data packet can only be sent if the encryption key is known to both +parties, and the connection is activated. If the encryption key is not +known, a request is sent to the destination using the meta connection +to retrieve it. The packet is stored in a queue while waiting for the +key to arrive. + + The UDP packet containing the network packet from the VPN has the +following layout: + + ... | IP header | UDP header | seqno | VPN packet | MAC | UDP trailer + \___________________/\_____/ + | | + V +---> digest algorithm + Encrypted with symmetric cipher + + So, the entire VPN packet is encrypted using a symmetric cipher, +including a 32 bits sequence number that is added in front of the +actual VPN packet, to act as a unique IV for each packet and to prevent +replay attacks. A message authentication code is added to the UDP +packet to prevent alteration of packets. By default the first 4 bytes +of the digest are used for this, but this can be changed using the +MACLength configuration variable. + + +File: tinc.info, Node: Security issues, Prev: Encryption of network packets, Up: Security + +6.3.3 Security issues +--------------------- + +In August 2000, we discovered the existence of a security hole in all +versions of tinc up to and including 1.0pre2. This had to do with the +way we exchanged keys. Since then, we have been working on a new +authentication scheme to make tinc as secure as possible. The current +version uses the OpenSSL library and uses strong authentication with +RSA keys. + + On the 29th of December 2001, Jerome Etienne posted a security +analysis of tinc 1.0pre4. Due to a lack of sequence numbers and a +message authentication code for each packet, an attacker could possibly +disrupt certain network services or launch a denial of service attack +by replaying intercepted packets. The current version adds sequence +numbers and message authentication codes to prevent such attacks. + + On the 15th of September 2003, Peter Gutmann posted a security +analysis of tinc 1.0.1. He argues that the 32 bit sequence number used +by tinc is not a good IV, that tinc's default length of 4 bytes for the +MAC is too short, and he doesn't like tinc's use of RSA during +authentication. We do not know of a security hole in this version of +tinc, but tinc's security is not as strong as TLS or IPsec. We will +address these issues in tinc 2.0. + + Cryptography is a hard thing to get right. We cannot make any +guarantees. Time, review and feedback are the only things that can +prove the security of any cryptographic product. If you wish to review +tinc or give us feedback, you are stronly encouraged to do so. + + +File: tinc.info, Node: Platform specific information, Next: About us, Prev: Technical information, Up: Top + +7 Platform specific information +******************************* + +* Menu: + +* Interface configuration:: +* Routes:: + + +File: tinc.info, Node: Interface configuration, Next: Routes, Up: Platform specific information + +7.1 Interface configuration +=========================== + +When configuring an interface, one normally assigns it an address and a +netmask. The address uniquely identifies the host on the network +attached to the interface. The netmask, combined with the address, +forms a subnet. It is used to add a route to the routing table +instructing the kernel to send all packets which fall into that subnet +to that interface. Because all packets for the entire VPN should go to +the virtual network interface used by tinc, the netmask should be such +that it encompasses the entire VPN. + + For IPv4 addresses: + +Linux `ifconfig' INTERFACE ADDRESS `netmask' NETMASK +Linux iproute2 `ip addr add' ADDRESS`/'PREFIXLENGTH `dev' INTERFACE +FreeBSD `ifconfig' INTERFACE ADDRESS `netmask' NETMASK +OpenBSD `ifconfig' INTERFACE ADDRESS `netmask' NETMASK +NetBSD `ifconfig' INTERFACE ADDRESS `netmask' NETMASK +Solaris `ifconfig' INTERFACE ADDRESS `netmask' NETMASK +Darwin (MacOS/X) `ifconfig' INTERFACE ADDRESS `netmask' NETMASK +Windows `netsh interface ip set address' INTERFACE `static' ADDRESS NETMASK + + For IPv6 addresses: + +Linux `ifconfig' INTERFACE `add' ADDRESS`/'PREFIXLENGTH +FreeBSD `ifconfig' INTERFACE `inet6' ADDRESS `prefixlen' PREFIXLENGTH +OpenBSD `ifconfig' INTERFACE `inet6' ADDRESS `prefixlen' PREFIXLENGTH +NetBSD `ifconfig' INTERFACE `inet6' ADDRESS `prefixlen' PREFIXLENGTH +Solaris `ifconfig' INTERFACE `inet6 plumb up' + `ifconfig' INTERFACE `inet6 addif' ADDRESS ADDRESS +Darwin (MacOS/X) `ifconfig' INTERFACE `inet6' ADDRESS `prefixlen' PREFIXLENGTH +Windows `netsh interface ipv6 add address' INTERFACE `static' ADDRESS/PREFIXLENGTH + + +File: tinc.info, Node: Routes, Prev: Interface configuration, Up: Platform specific information + +7.2 Routes +========== + +In some cases it might be necessary to add more routes to the virtual +network interface. There are two ways to indicate which interface a +packet should go to, one is to use the name of the interface itself, +another way is to specify the (local) address that is assigned to that +interface (LOCAL_ADDRESS). The former way is unambiguous and therefore +preferable, but not all platforms support this. + + Adding routes to IPv4 subnets: + +Linux `route add -net' NETWORK_ADDRESS `netmask' NETMASK INTERFACE +Linux iproute2 `ip route add' NETWORK_ADDRESS`/'PREFIXLENGTH `dev' INTERFACE +FreeBSD `route add' NETWORK_ADDRESS`/'PREFIXLENGTH LOCAL_ADDRESS +OpenBSD `route add' NETWORK_ADDRESS`/'PREFIXLENGTH LOCAL_ADDRESS +NetBSD `route add' NETWORK_ADDRESS`/'PREFIXLENGTH LOCAL_ADDRESS +Solaris `route add' NETWORK_ADDRESS`/'PREFIXLENGTH LOCAL_ADDRESS `-interface' +Darwin (MacOS/X) `route add' NETWORK_ADDRESS`/'PREFIXLENGTH LOCAL_ADDRESS +Windows `netsh routing ip add persistentroute' NETWORK_ADDRESS NETMASK INTERFACE + LOCAL_ADDRESS + + Adding routes to IPv6 subnets: + +Linux `route add -A inet6' NETWORK_ADDRESS`/'PREFIXLENGTH INTERFACE +Linux iproute2 `ip route add' NETWORK_ADDRESS`/'PREFIXLENGTH `dev' INTERFACE +FreeBSD `route add -inet6' NETWORK_ADDRESS`/'PREFIXLENGTH LOCAL_ADDRESS +OpenBSD `route add -inet6' NETWORK_ADDRESS LOCAL_ADDRESS `-prefixlen' PREFIXLENGTH +NetBSD `route add -inet6' NETWORK_ADDRESS LOCAL_ADDRESS `-prefixlen' PREFIXLENGTH +Solaris `route add -inet6' NETWORK_ADDRESS`/'PREFIXLENGTH LOCAL_ADDRESS `-interface' +Darwin (MacOS/X) ? +Windows `netsh interface ipv6 add route' NETWORK ADDRESS/PREFIXLENGTH INTERFACE + + +File: tinc.info, Node: About us, Next: Concept Index, Prev: Platform specific information, Up: Top + +8 About us +********** + +* Menu: + +* Contact information:: +* Authors:: + + +File: tinc.info, Node: Contact information, Next: Authors, Up: About us + +8.1 Contact information +======================= + +Tinc's website is at `http://www.tinc-vpn.org/', this server is located +in the Netherlands. + + We have an IRC channel on the FreeNode and OFTC IRC networks. +Connect to irc.freenode.net (http://www.freenode.net/) or irc.oftc.net +(http://www.oftc.net/) and join channel #tinc. + + +File: tinc.info, Node: Authors, Prev: Contact information, Up: About us + +8.2 Authors +=========== + +Ivo Timmermans (zarq) () + +Guus Sliepen (guus) () + + We have received a lot of valuable input from users. With their +help, tinc has become the flexible and robust tool that it is today. +We have composed a list of contributions, in the file called `THANKS' in +the source distribution. + + +File: tinc.info, Node: Concept Index, Prev: About us, Up: Top + +Concept Index +************* + +[index] +* Menu: + +* ACK: Authentication protocol. + (line 10) +* ADD_EDGE: The meta-protocol. (line 23) +* ADD_SUBNET: The meta-protocol. (line 23) +* Address: Host configuration variables. + (line 6) +* AddressFamily: Main configuration variables. + (line 6) +* ANS_KEY: The meta-protocol. (line 64) +* authentication: Authentication protocol. + (line 6) +* binary package: Building and installing tinc. + (line 9) +* BindToAddress: Main configuration variables. + (line 12) +* BindToInterface: Main configuration variables. + (line 19) +* BlockingTCP: Main configuration variables. + (line 27) +* Cabal: Security. (line 6) +* CHAL_REPLY: Authentication protocol. + (line 10) +* CHALLENGE: Authentication protocol. + (line 10) +* CIDR notation: Host configuration variables. + (line 77) +* Cipher: Host configuration variables. + (line 11) +* client: How connections work. + (line 18) +* command line: Runtime options. (line 9) +* Compression: Host configuration variables. + (line 17) +* connection: The connection. (line 6) +* ConnectTo: Main configuration variables. + (line 36) +* daemon: Running tinc. (line 11) +* data-protocol: The meta-connection. (line 18) +* debug level: Runtime options. (line 17) +* debug levels: Debug levels. (line 6) +* DEL_EDGE: The meta-protocol. (line 47) +* DEL_SUBNET: The meta-protocol. (line 47) +* DEVICE: Scripts. (line 41) +* Device: Main configuration variables. + (line 47) +* device files: Device files. (line 6) +* Digest: Host configuration variables. + (line 22) +* encapsulating: The UDP tunnel. (line 30) +* encryption: Encryption of network packets. + (line 6) +* environment variables: Scripts. (line 29) +* ethertap: Configuration of Linux kernels 2.1.60 up to 2.4.0. + (line 6) +* example: Example configuration. + (line 6) +* frame type: The UDP tunnel. (line 6) +* Hostnames: Main configuration variables. + (line 54) +* hub: Main configuration variables. + (line 95) +* ID: Authentication protocol. + (line 10) +* IndirectData: Host configuration variables. + (line 27) +* INTERFACE: Scripts. (line 44) +* Interface: Main configuration variables. + (line 64) +* IRC: Contact information. (line 9) +* key generation: Generating keypairs. (line 6) +* KEY_CHANGED: The meta-protocol. (line 64) +* KeyExpire: Main configuration variables. + (line 100) +* libraries: Libraries. (line 6) +* license: OpenSSL. (line 36) +* lzo: lzo. (line 6) +* MACExpire: Main configuration variables. + (line 106) +* MACLength: Host configuration variables. + (line 35) +* meta-protocol: The meta-connection. (line 18) +* META_KEY: Authentication protocol. + (line 10) +* Mode: Main configuration variables. + (line 72) +* multiple networks: Multiple networks. (line 6) +* NAME: Scripts. (line 38) +* Name: Main configuration variables. + (line 111) +* netmask: Network interfaces. (line 34) +* NETNAME: Scripts. (line 35) +* netname: Multiple networks. (line 6) +* Network Administrators Guide: Configuration introduction. + (line 15) +* NODE: Scripts. (line 48) +* OpenSSL: OpenSSL. (line 6) +* options: Runtime options. (line 9) +* PEM format: Host configuration variables. + (line 52) +* PING: The meta-protocol. (line 89) +* PingTimeout: Main configuration variables. + (line 114) +* platforms: Supported platforms. (line 6) +* PONG: The meta-protocol. (line 89) +* Port: Host configuration variables. + (line 40) +* port numbers: Other files. (line 17) +* PriorityInheritance: Main configuration variables. + (line 120) +* private: Virtual Private Networks. + (line 10) +* PrivateKey: Main configuration variables. + (line 125) +* PrivateKeyFile: Main configuration variables. + (line 131) +* PublicKey: Host configuration variables. + (line 44) +* PublicKeyFile: Host configuration variables. + (line 47) +* release: Supported platforms. (line 14) +* REMOTEADDRESS: Scripts. (line 51) +* REMOTEPORT: Scripts. (line 54) +* REQ_KEY: The meta-protocol. (line 64) +* requirements: Libraries. (line 6) +* router: Main configuration variables. + (line 75) +* runtime options: Runtime options. (line 9) +* scalability: tinc. (line 19) +* scripts: Scripts. (line 6) +* server: How connections work. + (line 18) +* signals: Signals. (line 6) +* Subnet: Host configuration variables. + (line 59) +* SVPN: Security. (line 11) +* switch: Main configuration variables. + (line 84) +* TCP: The meta-connection. (line 10) +* TCPonly: Host configuration variables. + (line 82) +* TINC: Security. (line 6) +* tinc: Introduction. (line 6) +* tinc-down: Scripts. (line 18) +* tinc-up <1>: Network interfaces. (line 19) +* tinc-up: Scripts. (line 10) +* tincd: tinc. (line 14) +* traditional VPNs: tinc. (line 19) +* TunnelServer: Main configuration variables. + (line 139) +* UDP <1>: Encryption of network packets. + (line 12) +* UDP: The UDP tunnel. (line 30) +* Universal tun/tap: Configuration of Linux kernels 2.4.0 and higher. + (line 6) +* virtual: Virtual Private Networks. + (line 18) +* virtual network device: The UDP tunnel. (line 6) +* VPN: Virtual Private Networks. + (line 6) +* vpnd: tinc. (line 6) +* website: Contact information. (line 6) +* zlib: zlib. (line 6) + +  Tag Table: -(Indirect) -Node: Top888 -Node: Introduction1186 -Node: VPNs2034 -Node: tinc3755 -Node: Supported platforms5258 -Node: Preparations7214 -Node: Configuring the kernel7469 -Node: Configuration of Linux kernels 2.1.60 up to 2.4.08812 -Node: Configuration of Linux kernels 2.4.0 and higher10055 -Node: Configuration of FreeBSD kernels11128 -Node: Configuration of OpenBSD kernels11742 -Node: Configuration of Solaris kernels12225 -Node: Libraries12683 -Node: OpenSSL13040 -Node: zlib14878 -Node: Installation15686 -Node: Building and installing tinc16704 -Node: System files17253 -Node: Device files17513 -Node: Other files18817 -Node: Configuration19431 -Node: Configuration introduction19738 -Node: Multiple networks20972 -Node: How connections work22387 -Node: Configuration files23571 -Node: Main configuration variables24605 -Node: Host configuration variables29459 -Node: How to configure33723 -Node: Generating keypairs35062 -Node: Network interfaces35558 -Node: Example configuration37837 -Node: Running tinc43704 -Node: Runtime options44221 -Node: Error messages45810 -Node: Technical information48691 -Node: The connection48897 -Node: The UDP tunnel49234 -Node: The meta-connection51531 -Node: The meta-protocol52992 -Node: Security57443 -Node: Authentication protocol58648 -Node: Encryption of network packets63939 -Node: About us65262 -Node: Contact Information65425 -Node: Authors65820 -Node: Concept Index66438 +Node: Top879 +Node: Introduction1178 +Node: Virtual Private Networks1988 +Node: tinc3713 +Node: Supported platforms5240 +Node: Preparations5938 +Node: Configuring the kernel6194 +Node: Configuration of Linux kernels 2.1.60 up to 2.4.06674 +Node: Configuration of Linux kernels 2.4.0 and higher8046 +Node: Configuration of FreeBSD kernels9286 +Node: Configuration of OpenBSD kernels9693 +Node: Configuration of NetBSD kernels10185 +Node: Configuration of Solaris kernels10590 +Node: Configuration of Darwin (MacOS/X) kernels11251 +Node: Configuration of Windows11954 +Node: Libraries12468 +Node: OpenSSL12856 +Node: zlib15132 +Node: lzo15961 +Node: Installation16748 +Node: Building and installing tinc17763 +Node: Darwin (MacOS/X) build environment18422 +Node: Cygwin (Windows) build environment18990 +Node: MinGW (Windows) build environment19578 +Node: System files20102 +Node: Device files20367 +Node: Other files21553 +Node: Configuration22166 +Node: Configuration introduction22477 +Node: Multiple networks23750 +Node: How connections work25226 +Node: Configuration files26448 +Node: Main configuration variables27475 +Node: Host configuration variables33939 +Node: Scripts38235 +Node: How to configure40329 +Node: Generating keypairs41612 +Node: Network interfaces42111 +Node: Example configuration43979 +Node: Running tinc49431 +Node: Runtime options50021 +Node: Signals52058 +Node: Debug levels53127 +Node: Solving problems54063 +Node: Error messages55493 +Node: Sending bug reports59815 +Node: Technical information60767 +Node: The connection60998 +Node: The UDP tunnel61310 +Node: The meta-connection64371 +Node: The meta-protocol65840 +Node: Security70849 +Node: Authentication protocol71979 +Node: Encryption of network packets76983 +Node: Security issues78356 +Node: Platform specific information79973 +Node: Interface configuration80201 +Node: Routes82100 +Node: About us84016 +Node: Contact information84191 +Node: Authors84595 +Node: Concept Index85021  End Tag Table diff --git a/doc/tinc.info-1 b/doc/tinc.info-1 deleted file mode 100644 index a893700..0000000 --- a/doc/tinc.info-1 +++ /dev/null @@ -1,1317 +0,0 @@ -This is tinc.info, produced by makeinfo version 4.1 from tinc.texi. - -INFO-DIR-SECTION Networking tools -START-INFO-DIR-ENTRY -* tinc: (tinc). The tinc Manual. -END-INFO-DIR-ENTRY - - This is the info manual for tinc, a Virtual Private Network daemon. - - Copyright (C) 1998-2002 Ivo Timmermans , -Guus Sliepen and Wessel Dankers -. - - $Id: tinc.texi,v 1.8.4.28 2002/04/09 11:43:29 guus Exp $ - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided that the -entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - - -File: tinc.info, Node: Top, Next: Introduction, Prev: (dir), Up: (dir) - -* Menu: - -* Introduction:: Introduction -* Preparations:: -* Installation:: -* Configuration:: -* Running tinc:: -* Technical information:: -* About us:: -* Concept Index:: All used terms explained - - -File: tinc.info, Node: Introduction, Next: Preparations, Prev: Top, Up: Top - -Introduction -************ - - tinc is a Virtual Private Network (VPN) daemon that uses tunneling -and encryption to create a secure private network between hosts on the -Internet. - - Because the tunnel appears to the IP level network code as a normal -network device, there is no need to adapt any existing software. The -encrypted tunnels allows VPN sites to share information with each other -over the Internet without exposing any information to others. - - This document is the manual for tinc. Included are chapters on how -to configure your computer to use tinc, as well as the configuration -process of tinc itself. - -* Menu: - -* VPNs:: Virtual Private Networks in general -* tinc:: about tinc -* Supported platforms:: - - -File: tinc.info, Node: VPNs, Next: tinc, Prev: Introduction, Up: Introduction - -Virtual Private Networks -======================== - - A Virtual Private Network or VPN is a network that can only be -accessed by a few elected computers that participate. This goal is -achievable in more than just one way. - - Private networks can consist of a single stand-alone Ethernet LAN. -Or even two computers hooked up using a null-modem cable. In these -cases, it is obvious that the network is _private_, no one can access -it from the outside. But if your computers are linked to the Internet, -the network is not private anymore, unless one uses firewalls to block -all private traffic. But then, there is no way to send private data to -trusted computers on the other end of the Internet. - - This problem can be solved by using _virtual_ networks. Virtual -networks can live on top of other networks, but they use encapsulation -to keep using their private address space so they do not interfere with -the Internet. Mostly, virtual networks appear like a singe LAN, even -though they can span the entire world. But virtual networks can't be -secured by using firewalls, because the traffic that flows through it -has to go through the Internet, where other people can look at it. - - As is the case with either type of VPN, anybody could eavesdrop. Or -worse, alter data. Hence it's probably advisable to encrypt the data -that flows over the network. - - When one introduces encryption, we can form a true VPN. Other -people may see encrypted traffic, but if they don't know how to -decipher it (they need to know the key for that), they cannot read the -information that flows through the VPN. This is what tinc was made for. - - -File: tinc.info, Node: tinc, Next: Supported platforms, Prev: VPNs, Up: Introduction - -tinc -==== - - I really don't quite remember what got us started, but it must have -been Guus' idea. He wrote a simple implementation (about 50 lines of -C) that used the ethertap device that Linux knows of since somewhere -about kernel 2.1.60. It didn't work immediately and he improved it a -bit. At this stage, the project was still simply called `vpnd'. - - Since then, a lot has changed--to say the least. - - tinc now supports encryption, it consists of a single daemon (tincd) -for both the receiving and sending end, it has become largely -runtime-configurable--in short, it has become a full-fledged -professional package. - - tinc also allows more than two sites to connect to eachother and -form a single VPN. Traditionally VPNs are created by making tunnels, -which only have two endpoints. Larger VPNs with more sites are created -by adding more tunnels. tinc takes another approach: only endpoints -are specified, the software itself will take care of creating the -tunnels. This allows for easier configuration and improved scalability. - - A lot can--and will be--changed. We have a number of things that we -would like to see in the future releases of tinc. Not everything will -be available in the near future. Our first objective is to make tinc -work perfectly as it stands, and then add more advanced features. - - Meanwhile, we're always open-minded towards new ideas. And we're -available too. - - -File: tinc.info, Node: Supported platforms, Prev: tinc, Up: Introduction - -Supported platforms -=================== - - tinc has been verified to work under Linux, FreeBSD, OpenBSD and -Solaris, with various hardware architectures. These are some of the -platforms that are supported by the universal tun/tap device driver or -other virtual network device drivers. Without such a driver, tinc will -most likely compile and run, but it will not be able to send or receive -data packets. - - For an up to date list of supported platforms, please check the list -on our website: `http://tinc.nl.linux.org/platforms.html'. - -Linux ------ - - tinc was first written for Linux running on an intel x86 processor, -so this is the best supported platform. The protocol however, and -actually anything about tinc, has been rewritten to support random byte -ordering and arbitrary word length. So in theory it should run on other -processors that Linux runs on. It has already been verified to run on -alpha and sparc processors as well. - - tinc uses the ethertap device or the universal tun/tap driver. The -former is provided in the standard kernel from version 2.1.60 up to -2.3.x, but has been replaced in favour of the tun/tap driver in kernel -versions 2.4.0 and later. - -FreeBSD -------- - - tinc on FreeBSD relies on the universal tun/tap driver for its data -acquisition from the kernel. Therefore, tinc will work on the same -platforms as this driver. These are: FreeBSD 3.x, 4.x, 5.x. - -OpenBSD -------- - - tinc on OpenBSD relies on the tun driver for its data acquisition -from the kernel. It has been verified to work under at least OpenBSD -2.9. - - Tunneling IPv6 packets may not work on OpenBSD. - -Solaris -------- - - tinc on Solaris relies on the universal tun/tap driver for its data -acquisition from the kernel. Therefore, tinc will work on the same -platforms as this driver. These are: Solaris 8 (SunOS 5.8). - - IPv6 packets cannot be tunneled on Solaris. - - -File: tinc.info, Node: Preparations, Next: Installation, Prev: Introduction, Up: Top - -Preparations -************ - - This chapter contains information on how to prepare your system to -support tinc. - -* Menu: - -* Configuring the kernel:: -* Libraries:: - - -File: tinc.info, Node: Configuring the kernel, Next: Libraries, Prev: Preparations, Up: Preparations - -Configuring the kernel -====================== - - If you are running Linux, chances are good that your kernel already -supports all the devices that tinc needs for proper operation. For -example, the standard kernel from Redhat Linux already has support for -ethertap and netlink compiled in. Debian users can use the modconf -utility to select the modules. If your Linux distribution supports -this method of selecting devices, look out for something called -`ethertap', and `netlink_dev' if it is using a kernel version prior to -2.4.0. In that case you will need both these devices. If you are using -kernel 2.4.0 or later, you need to select `tun'. - - If you can install these devices in a similar manner, you may skip -this section. Otherwise, you will have to recompile the kernel in -order to turn on the required features. If you are unfamiliar with the -process of configuring and compiling a new kernel, you should read the -Kernel HOWTO (http://howto.linuxberg.com/LDP/HOWTO/Kernel-HOWTO.html) -first. - -* Menu: - -* Configuration of Linux kernels 2.1.60 up to 2.4.0:: -* Configuration of Linux kernels 2.4.0 and higher:: -* Configuration of FreeBSD kernels:: -* Configuration of OpenBSD kernels:: -* Configuration of Solaris kernels:: - - -File: tinc.info, Node: Configuration of Linux kernels 2.1.60 up to 2.4.0, Next: Configuration of Linux kernels 2.4.0 and higher, Prev: Configuring the kernel, Up: Configuring the kernel - -Configuration of Linux kernels 2.1.60 up to 2.4.0 -------------------------------------------------- - - Here are the options you have to turn on when configuring a new -kernel: - - Code maturity level options - [*] Prompt for development and/or incomplete code/drivers - Networking options - [*] Kernel/User netlink socket - Netlink device emulation - Network device support - Ethertap network tap - - If you want to run more than one instance of tinc or other programs -that use the ethertap, you have to compile the ethertap driver as a -module, otherwise you can also choose to compile it directly into the -kernel. - - If you decide to build any of these as dynamic kernel modules, it's -a good idea to add these lines to `/etc/modules.conf': - - alias char-major-36 netlink_dev - alias tap0 ethertap - options tap0 -o tap0 unit=0 - alias tap1 ethertap - options tap1 -o tap1 unit=1 - ... - alias tap_N_ ethertap - options tap_N_ -o tap_N_ unit=_N_ - - Add as much alias/options lines as necessary. - - -File: tinc.info, Node: Configuration of Linux kernels 2.4.0 and higher, Next: Configuration of FreeBSD kernels, Prev: Configuration of Linux kernels 2.1.60 up to 2.4.0, Up: Configuring the kernel - -Configuration of Linux kernels 2.4.0 and higher ------------------------------------------------ - - Here are the options you have to turn on when configuring a new -kernel: - - Code maturity level options - [*] Prompt for development and/or incomplete code/drivers - Network device support - Universal tun/tap device driver support - - It's not necessary to compile this driver as a module, even if you -are going to run more than one instance of tinc. - - If you have an early 2.4 kernel, you can choose both the tun/tap -driver and the `Ethertap network tap' device. This latter is marked -obsolete, and chances are that it won't even function correctly -anymore. Make sure you select the universal tun/tap driver. - - If you decide to build the tun/tap driver as a kernel module, add -these lines to `/etc/modules.conf': - - alias char-major-10-200 tun - - -File: tinc.info, Node: Configuration of FreeBSD kernels, Next: Configuration of OpenBSD kernels, Prev: Configuration of Linux kernels 2.4.0 and higher, Up: Configuring the kernel - -Configuration of FreeBSD kernels --------------------------------- - - This section will contain information on how to configure your -FreeBSD kernel to support the universal tun/tap device. For 4.1 and -higher versions, this is included in the default kernel configuration, -for earlier systems (4.0 and earlier), you need to install the -universal tun/tap driver yourself. - - Unfortunately somebody still has to write the text. - - -File: tinc.info, Node: Configuration of OpenBSD kernels, Next: Configuration of Solaris kernels, Prev: Configuration of FreeBSD kernels, Up: Configuring the kernel - -Configuration of OpenBSD kernels --------------------------------- - - This section will contain information on how to configure your -OpenBSD kernel to support the tun device. For 2.9 and 3.0 systems, -this is included in the default kernel configuration. - - Unfortunately somebody still has to write the text. - - -File: tinc.info, Node: Configuration of Solaris kernels, Prev: Configuration of OpenBSD kernels, Up: Configuring the kernel - -Configuration of Solaris kernels --------------------------------- - - This section will contain information on how to configure your -Solaris kernel to support the universal tun/tap device. For Solaris 8 -(SunOS 5.8), this is included in the default kernel configuration. - - Unfortunately somebody still has to write the text. - - -File: tinc.info, Node: Libraries, Prev: Configuring the kernel, Up: Preparations - -Libraries -========= - - Before you can configure or build tinc, you need to have the OpenSSL -library installed on your system. If you try to configure tinc without -having installed it, configure will give you an error message, and stop. - -* Menu: - -* OpenSSL:: -* zlib:: - - -File: tinc.info, Node: OpenSSL, Next: zlib, Prev: Libraries, Up: Libraries - -OpenSSL -------- - - For all cryptography-related functions, tinc uses the functions -provided by the OpenSSL library. - - If this library is not installed, you wil get an error when -configuring tinc for build. Support for running tinc without having -OpenSSL installed _may_ be added in the future. - - You can use your operating system's package manager to install this -if available. Make sure you install the development AND runtime -versions of this package. - - If you have to install OpenSSL manually, you can get the source code -from . Instructions on how to configure, -build and install this package are included within the package. Please -make sure you build development and runtime libraries (which is the -default). - - If you installed the OpenSSL libraries from source, it may be -necessary to let configure know where they are, by passing configure -one of the -with-openssl-* parameters. - - --with-openssl=DIR OpenSSL library and headers prefix - --with-openssl-include=DIR OpenSSL headers directory - (Default is OPENSSL_DIR/include) - --with-openssl-lib=DIR OpenSSL library directory - (Default is OPENSSL_DIR/lib) - -License -....... - - Since the license under which OpenSSL is distributed is not directly -compatible with the terms of the GNU GPL -`http://www.openssl.org/support/faq.html#LEGAL2', therefore we include -an addition to the GPL (see also the file COPYING.README): - - This program is released under the GPL with the additional - exemption that compiling, linking, and/or using OpenSSL is - allowed. You may provide binary packages linked to the OpenSSL - libraries, provided that all other requirements of the GPL are met. - - -File: tinc.info, Node: zlib, Prev: OpenSSL, Up: Libraries - -zlib ----- - - For the optional compression of UDP packets, tinc uses the functions -provided by the zlib library. - - If this library is not installed, you wil get an error when -configuring tinc for build. Support for running tinc without having -zlib installed _may_ be added in the future. - - You can use your operating system's package manager to install this -if available. Make sure you install the development AND runtime -versions of this package. - - If you have to install zlib manually, you can get the source code -from . Instructions on how to configure, -build and install this package are included within the package. Please -make sure you build development and runtime libraries (which is the -default). - - -File: tinc.info, Node: Installation, Next: Configuration, Prev: Preparations, Up: Top - -Installation -************ - - If you use Debian, you may want to install one of the precompiled -packages for your system. These packages are equipped with system -startup scripts and sample configurations. - - If you cannot use one of the precompiled packages, or you want to -compile tinc for yourself, you can use the source. The source is -distributed under the GNU General Public License (GPL). Download the -source from the download page (http://tinc.nl.linux.org/download.html), -which has the checksums of these files listed; you may wish to check -these with md5sum before continuing. - - tinc comes in a convenient autoconf/automake package, which you can -just treat the same as any other package. Which is just untar it, type -`configure' and then `make'. More detailed instructions are in the -file `INSTALL', which is included in the source distribution. - -* Menu: - -* Building and installing tinc:: -* System files:: - - -File: tinc.info, Node: Building and installing tinc, Next: System files, Prev: Installation, Up: Installation - -Building and installing tinc -============================ - - Detailed instructions on configuring the source, building tinc and -installing tinc can be found in the file called `INSTALL'. - - If you happen to have a binary package for tinc for your -distribution, you can use the package management tools of that -distribution to install tinc. The documentation that comes along with -your distribution will tell you how to do that. - - -File: tinc.info, Node: System files, Prev: Building and installing tinc, Up: Installation - -System files -============ - - Before you can run tinc, you must make sure you have all the needed -files on your system. - -* Menu: - -* Device files:: -* Other files:: - - -File: tinc.info, Node: Device files, Next: Other files, Prev: System files, Up: System files - -Device files ------------- - - First, you'll need the special device file(s) that form the interface -between the kernel and the daemon. - - The permissions for these files have to be such that only the super -user may read/write to this file. You'd want this, because otherwise -eavesdropping would become a bit too easy. This does, however, imply -that you'd have to run tincd as root. - - If you use Linux and have a kernel version prior to 2.4.0, you have -to make the ethertap devices: - - mknod -m 600 /dev/tap0 c 36 16 - chown 0.0 /dev/tap0 - mknod -m 600 /dev/tap1 c 36 17 - chown 0.0 /dev/tap0 - ... - mknod -m 600 /dev/tap_N_ c 36 _N+16_ - chown 0.0 /dev/tap_N_ - - There is a maximum of 16 ethertap devices. - - If you use the universal tun/tap driver, you have to create the -following device file (unless it already exist): - - mknod -m 600 /dev/tun c 10 200 - chown 0.0 /dev/tun - - If you use Linux, and you run the new 2.4 kernel using the devfs -filesystem, then the tun/tap device will probably be automatically -generated as `/dev/misc/net/tun'. - - Unlike the ethertap device, you do not need multiple device files if -you are planning to run multiple tinc daemons. - - -File: tinc.info, Node: Other files, Prev: Device files, Up: System files - -Other files ------------ - -`/etc/networks' -............... - - You may add a line to `/etc/networks' so that your VPN will get a -symbolic name. For example: - - myvpn 10.0.0.0 - -`/etc/services' -............... - - You may add this line to `/etc/services'. The effect is that you -may supply a `tinc' as a valid port number to some programs. The -number 655 is registered with the IANA. - - tinc 655/tcp TINC - tinc 655/udp TINC - # Ivo Timmermans - - -File: tinc.info, Node: Configuration, Next: Running tinc, Prev: Installation, Up: Top - -Configuration -************* - -* Menu: - -* Configuration introduction:: -* Multiple networks:: -* How connections work:: -* Configuration files:: -* Generating keypairs:: -* Network interfaces:: -* Example configuration:: - - -File: tinc.info, Node: Configuration introduction, Next: Multiple networks, Prev: Configuration, Up: Configuration - -Configuration introduction -========================== - - Before actually starting to configure tinc and editing files, make -sure you have read this entire section so you know what to expect. -Then, make it clear to yourself how you want to organize your VPN: What -are the nodes (computers running tinc)? What IP addresses/subnets do -they have? What is the network mask of the entire VPN? Do you need -special firewall rules? Do you have to set up masquerading or -forwarding rules? These questions can only be answered by yourself, -you will not find the answers in this documentation. Make sure you -have an adequate understanding of networks in general. A good resource -on networking is the Linux Network Administrators Guide -(http://www.linuxdoc.org/LDP/nag2/). - - If you have everything clearly pictured in your mind, proceed in the -following order: First, generate the configuration files (`tinc.conf', -your host configuration file, `tinc-up' and perhaps `tinc-down'). Then -generate the keypairs. Finally, distribute the host configuration -files. These steps are described in the subsections below. - - -File: tinc.info, Node: Multiple networks, Next: How connections work, Prev: Configuration introduction, Up: Configuration - -Multiple networks -================= - - In order to allow you to run more than one tinc daemon on one -computer, for instance if your computer is part of more than one VPN, -you can assign a "netname" to your VPN. It is not required if you only -run one tinc daemon, it doesn't even have to be the same on all the -sites of your VPN, but it is recommended that you choose one anyway. - - We will asume you use a netname throughout this document. This -means that you call tincd with the -n argument, which will assign a -netname to this daemon. - - The effect of this is that the daemon will set its configuration -"root" to /etc/tinc/netname/, where netname is your argument to the -n -option. You'll notice that it appears in syslog as "tinc.netname". - - However, it is not strictly necessary that you call tinc with the -n -option. In this case, the network name would just be empty, and it will -be used as such. tinc now looks for files in /etc/tinc/, instead of -/etc/tinc/netname/; the configuration file should be -/etc/tinc/tinc.conf, and the host configuration files are now expected -to be in /etc/tinc/hosts/. - - But it is highly recommended that you use this feature of tinc, -because it will be so much clearer whom your daemon talks to. Hence, -we will assume that you use it. - - -File: tinc.info, Node: How connections work, Next: Configuration files, Prev: Multiple networks, Up: Configuration - -How connections work -==================== - - When tinc starts up, it parses the command-line options and then -reads in the configuration file. If it sees a `ConnectTo' value -pointing to another tinc daemon in the file, it will try to connect to -that other one. Whether this succeeds or not and whether `ConnectTo' -is specified or not, tinc will listen for incoming connection from -other deamons. If you did specify a `ConnectTo' value and the other -side is not responding, tinc will keep retrying. This means that once -started, tinc will stay running until you tell it to stop, and failures -to connect to other tinc daemons will not stop your tinc daemon for -trying again later. This means you don't have to intervene if there -are any network problems. - - There is no real distinction between a server and a client in tinc. -If you wish, you can view a tinc daemon without a `ConnectTo' value as -a server, and one which does specify such a value as a client. It does -not matter if two tinc daemons have a `ConnectTo' value pointing to -eachother however. - - -File: tinc.info, Node: Configuration files, Next: Generating keypairs, Prev: How connections work, Up: Configuration - -Configuration files -=================== - - The actual configuration of the daemon is done in the file -`/etc/tinc/netname/tinc.conf' and at least one other file in the -directory `/etc/tinc/netname/hosts/'. - - These file consists of comments (lines started with a #) or -assignments in the form of - - Variable = Value. - - The variable names are case insensitive, and any spaces, tabs, -newlines and carriage returns are ignored. Note: it is not required -that you put in the `=' sign, but doing so improves readability. If -you leave it out, remember to replace it with at least one space -character. - - In this section all valid variables are listed in alphabetical order. -The default value is given between parentheses, other comments are -between square brackets and required directives are given in *bold*. - -* Menu: - -* Main configuration variables:: -* Host configuration variables:: -* How to configure:: - - -File: tinc.info, Node: Main configuration variables, Next: Host configuration variables, Prev: Configuration files, Up: Configuration files - -Main configuration variables ----------------------------- - -AddressFamily = (ipv4) [experimental] - This option affects the address family of listening and outgoing - sockets. If "any" is selected, then depending on the operating - system both IPv4 and IPv6 or just IPv6 listening sockets will be - created. - -BindToInterface = [experimental] - If you have more than one network interface in your computer, tinc - will by default listen on all of them for incoming connections. - It is possible to bind tinc to a single interface like eth0 or - ppp0 with this variable. - - This option may not work on all platforms. - -*ConnectTo = * - Specifies which host to connect to on startup. Multiple ConnectTo - variables may be specified, if connecting to the first one fails - then tinc will try the next one, and so on. It is possible to - specify hostnames for dynamic IP addresses (like those given on - dyndns.org), tinc will not cache the resolved IP address. - - If you don't specify a host with ConnectTo, regardless of whether a - value for ConnectPort is given, tinc won't connect at all, and will - instead just listen for incoming connections. - -*Device = * (/dev/tap0 or /dev/misc/net/tun) - The virtual network device to use. Note that you can only use one - device per daemon. See also *Note Device files::. - -Hostnames = (no) - This option selects whether IP addresses (both real and on the VPN) - should be resolved. Since DNS lookups are blocking, it might - affect tinc's efficiency, even stopping the daemon for a few - seconds everytime it does a lookup if your DNS server is not - responding. - - This does not affect resolving hostnames to IP addresses from the - configuration file. - -Interface = - Defines the name of the interface corresponding to the virtual - network device. Depending on the operating system and the type of - device this may or may not actually set the name. Currently this - option only affects the Linux tun/tap device. - -Mode = (router) - This option selects the way packets are routed to other daemons. - - router - In this mode Subnet variables in the host configuration files - will be used to form a routing table. Only unicast packets - of routable protocols (IPv4 and IPv6) are supported in this - mode. - - switch - In this mode the MAC addresses of the packets on the VPN will - be used to dynamically create a routing table just like an - Ethernet switch does. Unicast, multicast and broadcast - packets of every protocol that runs over Ethernet are - supported in this mode at the cost of frequent broadcast ARP - requests and routing table updates. - - hub - This mode is almost the same as the switch mode, but instead - every packet will be broadcast to the other daemons while no - routing table is managed. - -KeyExpire = (3600) - This option controls the time the encryption keys used to encrypt - the data are valid. It is common practice to change keys at - regular intervals to make it even harder for crackers, even though - it is thought to be nearly impossible to crack a single key. - -MACExpire = (600) - This option controls the amount of time MAC addresses are kept - before they are removed. This only has effect when Mode is set to - "switch". - -*Name = * - This is a symbolic name for this connection. It can be anything - -PingTimeout = (60) - The number of seconds of inactivity that tinc will wait before - sending a probe to the other end. If that other end doesn't - answer within that same amount of seconds, the connection is - terminated, and the others will be notified of this. - -PriorityInheritance = (no) [experimental] - When this option is enabled the value of the TOS field of tunneled - IPv4 packets will be inherited by the UDP packets that are sent - out. - -PrivateKey = [obsolete] - This is the RSA private key for tinc. However, for safety reasons - it is advised to store private keys of any kind in separate files. - This prevents accidental eavesdropping if you are editting the - configuration file. - -*PrivateKeyFile = * [recommended] - This is the full path name of the RSA private key file that was - generated by "tincd -generate-keys". It must be a full path, not a - relative directory. - - Note that there must be exactly one of PrivateKey or PrivateKeyFile - specified in the configuration file. - - -File: tinc.info, Node: Host configuration variables, Next: How to configure, Prev: Main configuration variables, Up: Configuration files - -Host configuration variables ----------------------------- - -*Address = * [recommended] - This variable is only required if you want to connect to this - host. It must resolve to the external IP address where the host - can be reached, not the one that is internal to the VPN. - -Cipher = (blowfish) - The symmetric cipher algorithm used to encrypt UDP packets. Any - cipher supported by OpenSSL is recognized. - -Compression = (0) - This option sets the level of compression used for UDP packets. - Possible values are 0 (off), 1 (fast) and any integer up to 9 - (best). - -Digest = (sha1) - The digest algorithm used to authenticate UDP packets. Any digest - supported by OpenSSL is recognized. Furthermore, specifying - "none" will turn off packet authentication. - -IndirectData = (no) - This option specifies whether other tinc daemons besides the one - you specified with ConnectTo can make a direct connection to you. - This is especially useful if you are behind a firewall and it is - impossible to make a connection from the outside to your tinc - daemon. Otherwise, it is best to leave this option out or set it - to no. - -MACLength = (4) - The length of the message authentication code used to authenticate - UDP packets. Can be anything from 0 up to the length of the - digest produced by the digest algorithm. - -Port = (655) - Connect to the upstream host (given with the ConnectTo directive) - on port port. port may be given in decimal (default), octal (when - preceded by a single zero) o hexadecimal (prefixed with 0x). port - is the port number for both the UDP and the TCP (meta) connections. - -PublicKey = [obsolete] - This is the RSA public key for this host. - -PublicKeyFile = [obsolete] - This is the full path name of the RSA public key file that was - generated by "tincd -generate-keys". It must be a full path, not - a relative directory. - - From version 1.0pre4 on tinc will store the public key directly - into the host configuration file in PEM format, the above two - options then are not necessary. Either the PEM format is used, or - exactly *one of the above two options* must be specified in each - host configuration file, if you want to be able to establish a - connection with that host. - -Subnet = - The subnet which this tinc daemon will serve. tinc tries to look - up which other daemon it should send a packet to by searching the - appropiate subnet. If the packet matches a subnet, it will be - sent to the daemon who has this subnet in his host configuration - file. Multiple subnet lines can be specified for each daemon. - - Subnets can either be single MAC, IPv4 or IPv6 addresses, in which - case a subnet consisting of only that single address is assumed, - or they can be a IPv4 or IPv6 network address with a prefixlength. - Shorthand notations are not supported. For example, IPv4 subnets - must be in a form like 192.168.1.0/24, where 192.168.1.0 is the - network address and 24 is the number of bits set in the netmask. - Note that subnets like 192.168.1.1/24 are invalid! Read a - networking HOWTO/FAQ/guide if you don't understand this. IPv6 - subnets are notated like fec0:0:0:1:0:0:0:0/64. MAC addresses are - notated like 0:1a:2b:3c:4d:5e. - - prefixlength is the number of bits set to 1 in the netmask part; - for example: netmask 255.255.255.0 would become /24, 255.255.252.0 - becomes /22. This conforms to standard CIDR notation as described - in RFC1519 (ftp://ftp.isi.edu/in-notes/rfc1519.txt) - -TCPonly = (no) [experimental] - If this variable is set to yes, then the packets are tunnelled - over a TCP connection instead of a UDP connection. This is - especially useful for those who want to run a tinc daemon from - behind a masquerading firewall, or if UDP packet routing is - disabled somehow. Setting this options also implicitly sets - IndirectData. - - -File: tinc.info, Node: How to configure, Prev: Host configuration variables, Up: Configuration files - -How to configure ----------------- - -Step 1. Creating the main configuration file -............................................. - - The main configuration file will be called -`/etc/tinc/netname/tinc.conf'. Adapt the following example to create a -basic configuration file: - - Name = _yourname_ - Device = _/dev/tap0_ - PrivateKeyFile = /etc/tinc/_netname_/rsa_key.priv - - Then, if you know to which other tinc daemon(s) yours is going to -connect, add `ConnectTo' values. - -Step 2. Creating your host configuration file -.............................................. - - If you added a line containing `Name = yourname' in the main -configuarion file, you will need to create a host configuration file -`/etc/tinc/netname/hosts/yourname'. Adapt the following example to -create a host configuration file: - - Address = _your.real.hostname.org_ - Subnet = _192.168.1.0/24_ - - You can also use an IP address instead of a hostname. The `Subnet' -specifies the address range that is local for _your part of the VPN -only_. If you have multiple address ranges you can specify more than -one `Subnet'. You might also need to add a `Port' if you want your -tinc daemon to run on a different port number than the default (655). - - -File: tinc.info, Node: Generating keypairs, Next: Network interfaces, Prev: Configuration files, Up: Configuration - -Generating keypairs -=================== - - Now that you have already created the main configuration file and -your host configuration file, you can easily create a public/private -keypair by entering the following command: - - tincd -n _netname_ -K - - tinc will generate a public and a private key and ask you where to -put them. Just press enter to accept the defaults. - - -File: tinc.info, Node: Network interfaces, Next: Example configuration, Prev: Generating keypairs, Up: Configuration - -Network interfaces -================== - - Before tinc can start transmitting data over the tunnel, it must set -up the virtual network interface. - - First, decide which IP addresses you want to have associated with -these devices, and what network mask they must have. - - tinc will open a virtual network device (`/dev/tun', `/dev/tap0' or -similar), which will also create a network interface called something -like `tun0', `tap0', or, if you are using the Linux tun/tap driver, the -network interface will by default have the same name as the netname. - - You can configure the network interface by putting ordinary -ifconfig, route, and other commands to a script named -`/etc/tinc/netname/tinc-up'. When tinc starts, this script will be -executed. When tinc exits, it will execute the script named -`/etc/tinc/netname/tinc-down', but normally you don't need to create -that script. - - An example `tinc-up' script: - - #!/bin/sh - ifconfig $INTERFACE hw ether fe:fd:0:0:0:0 - ifconfig $INTERFACE 192.168.1.1 netmask 255.255.0.0 - ifconfig $INTERFACE -arp - - The first line sets up the MAC address of the network interface. -Due to the nature of how Ethernet and tinc work, it has to be set to -fe:fd:0:0:0:0 for tinc to work in it's normal mode. If you configured -tinc to work in `switch' or `hub' mode, the hardware address should -instead be set to a unique address instead of fe:fd:0:0:0:0. - - You can use the environment variable $INTERFACE to get the name of -the interface. However, this might not be reliable. If in doubt, use -the name of the interface explicitly. - - The next line gives the interface an IP address and a netmask. The -kernel will also automatically add a route to this interface, so -normally you don't need to add route commands to the `tinc-up' script. -The kernel will also bring the interface up after this command. The -netmask is the mask of the _entire_ VPN network, not just your own -subnet. - - The last line tells the kernel not to use ARP on that interface. -Again this has to do with how Ethernet and tinc work. Use this option -only if you are running tinc under Linux and are using tinc's normal -routing mode. - - -File: tinc.info, Node: Example configuration, Prev: Network interfaces, Up: Configuration - -Example configuration -===================== - - Imagine the following situation. Branch A of our example `company' -wants to connect three branch offices in B, C and D using the Internet. -All four offices have a 24/7 connection to the Internet. - - A is going to serve as the center of the network. B and C will -connect to A, and D will connect to C. Each office will be assigned -their own IP network, 10.x.0.0. - - A: net 10.1.0.0 mask 255.255.0.0 gateway 10.1.54.1 internet IP 1.2.3.4 - B: net 10.2.0.0 mask 255.255.0.0 gateway 10.2.1.12 internet IP 2.3.4.5 - C: net 10.3.0.0 mask 255.255.0.0 gateway 10.3.69.254 internet IP 3.4.5.6 - D: net 10.4.0.0 mask 255.255.0.0 gateway 10.4.3.32 internet IP 4.5.6.7 - - "gateway" is the VPN IP address of the machine that is running the -tincd. "internet IP" is the IP address of the firewall, which does not -need to run tincd, but it must do a port forwarding of TCP&UDP on port -655 (unless otherwise configured). - - In this example, it is assumed that eth0 is the interface that -points to the inner (physical) LAN of the office, although this could -also be the same as the interface that leads to the Internet. The -configuration of the real interface is also shown as a comment, to give -you an idea of how these example host is set up. All branches use the -netname `company' for this particular VPN. - -For Branch A -............ - - _BranchA_ would be configured like this: - - In `/etc/tinc/company/tinc-up': - - # Real interface of internal network: - # ifconfig eth0 10.1.54.1 netmask 255.255.0.0 broadcast 10.1.255.255 - - ifconfig tap0 hw ether fe:fd:0:0:0:0 - ifconfig tap0 10.1.54.1 netmask 255.0.0.0 - ifconfig tap0 -arp - - and in `/etc/tinc/company/tinc.conf': - - Name = BranchA - PrivateKey = /etc/tinc/company/rsa_key.priv - Device = /dev/tap0 - - On all hosts, /etc/tinc/company/hosts/BranchA contains: - - Subnet = 10.1.0.0/16 - Address = 1.2.3.4 - - Note that the IP addresses of eth0 and tap0 are the same. - This is quite possible, if you make sure that the netmasks of the interfaces are different. - It is in fact recommended to give give both real internal network interfaces and tap interfaces the same IP address, - since that will make things a lot easier to remember and set up. - - -----BEGIN RSA PUBLIC KEY----- - ... - -----END RSA PUBLIC KEY----- - -For Branch B -............ - - In `/etc/tinc/company/tinc-up': - - # Real interface of internal network: - # ifconfig eth0 10.2.43.8 netmask 255.255.0.0 broadcast 10.2.255.255 - - ifconfig tap0 hw ether fe:fd:0:0:0:0 - ifconfig tap0 10.2.1.12 netmask 255.0.0.0 - ifconfig tap0 -arp - - and in `/etc/tinc/company/tinc.conf': - - Name = BranchB - ConnectTo = BranchA - PrivateKey = /etc/tinc/company/rsa_key.priv - - Note here that the internal address (on eth0) doesn't have to be the -same as on the tap0 device. Also, ConnectTo is given so that no-one can -connect to this node. - - On all hosts, in `/etc/tinc/company/hosts/BranchB': - - Subnet = 10.2.0.0/16 - Address = 2.3.4.5 - - -----BEGIN RSA PUBLIC KEY----- - ... - -----END RSA PUBLIC KEY----- - -For Branch C -............ - - In `/etc/tinc/company/tinc-up': - - # Real interface of internal network: - # ifconfig eth0 10.3.69.254 netmask 255.255.0.0 broadcast 10.3.255.255 - - ifconfig tap1 hw ether fe:fd:0:0:0:0 - ifconfig tap1 10.3.69.254 netmask 255.0.0.0 - ifconfig tap1 -arp - - and in `/etc/tinc/company/tinc.conf': - - Name = BranchC - ConnectTo = BranchA - Device = /dev/tap1 - - C already has another daemon that runs on port 655, so they have to -reserve another port for tinc. It knows the portnumber it has to listen -on from it's own host configuration file. - - On all hosts, in `/etc/tinc/company/hosts/BranchC': - - Address = 3.4.5.6 - Subnet = 10.3.0.0/16 - Port = 2000 - - -----BEGIN RSA PUBLIC KEY----- - ... - -----END RSA PUBLIC KEY----- - -For Branch D -............ - - In `/etc/tinc/company/tinc-up': - - # Real interface of internal network: - # ifconfig eth0 10.4.3.32 netmask 255.255.0.0 broadcast 10.4.255.255 - - ifconfig company hw ether fe:fd:0:0:0:0 - ifconfig company 10.4.3.32 netmask 255.0.0.0 - ifconfig company -arp - - and in `/etc/tinc/company/tinc.conf': - - Name = BranchD - ConnectTo = BranchC - Device = /dev/misc/net/tun - PrivateKeyFile = /etc/tinc/company/rsa_key.priv - - D will be connecting to C, which has a tincd running for this -network on port 2000. It knows the port number from the host -configuration file. Also note that since D uses the tun/tap driver, -the network interface will not be called `tun' or `tap0' or something -like that, but will have the same name as netname. - - On all hosts, in `/etc/tinc/company/hosts/BranchD': - - Subnet = 10.4.0.0/16 - Address = 4.5.6.7 - - -----BEGIN RSA PUBLIC KEY----- - ... - -----END RSA PUBLIC KEY----- - -Key files -......... - - A, B, C and D all have generated a public/private keypair with the -following command: - - tincd -n company -K - - The private key is stored in `/etc/tinc/company/rsa_key.priv', the -public key is put into the host configuration file in the -`/etc/tinc/company/hosts/' directory. During key generation, tinc -automatically guesses the right filenames based on the -n option and -the Name directive in the `tinc.conf' file (if it is available). - -Starting -........ - - After each branch has finished configuration and they have -distributed the host configuration files amongst them, they can start -their tinc daemons. They don't necessarily have to wait for the other -branches to have started their daemons, tinc will try connecting until -they are available. - - -File: tinc.info, Node: Running tinc, Next: Technical information, Prev: Configuration, Up: Top - -Running tinc -************ - - If everything else is done, you can start tinc by typing the -following command: - - tincd -n _netname_ - - tinc will detach from the terminal and continue to run in the -background like a good daemon. If there are any problems however you -can try to increase the debug level and look in the syslog to find out -what the problems are. - -* Menu: - -* Runtime options:: -* Error messages:: - - -File: tinc.info, Node: Runtime options, Next: Error messages, Up: Running tinc - -Runtime options -=============== - - Besides the settings in the configuration file, tinc also accepts -some command line options. - - This list is a longer version of that in the manpage. The latter is -generated automatically, so may be more up-to-date. - -`--bypass-security' - Disables encryption and authentication. Only useful for debugging. - -`-c, --config=PATH' - Read configuration options from the directory PATH. The default is - `/etc/tinc/netname/'. - -`-d, --debug=LEVEL' - Set debug level to LEVEL. The higher the debug level, the more - gets logged. Everything goes via syslog. - -`-K, --generate-keys[=BITS]' - Generate public/private keypair of BITS length. If BITS is not - specified, 1024 is the default. tinc will ask where you want to - store the files, but will default to the configuration directory - (you can use the -c or -n option in combination with -K). After - that, tinc will quit. - -`--help' - Display a short reminder of these runtime options and terminate. - -`-k, --kill[=SIGNAL]' - Attempt to kill a running tincd (optionally with the specified - SIGNAL instead of SIGTERM) and exit. Use it in conjunction with - the -n option to make sure you kill the right tinc daemon. - -`-n, --net=NETNAME' - Connect to net NETNAME. *Note Multiple networks::. - -`-D, --no-detach' - Don't fork and detach. This will also disable the automatic - restart mechanism for fatal errors. - -`--version' - Output version information and exit. - - -File: tinc.info, Node: Error messages, Prev: Runtime options, Up: Running tinc - -Error messages -============== - - What follows is a list of the most common error messages you can see -when configuring tinc. Most of these messages are visible in the syslog -only, so keep an eye on it! - -*Could not open /dev/tap0: No such device* - * You forgot to `modprobe netlink_dev' or `modprobe ethertap'. - - * You forgot to compile `Netlink device emulation' in the - kernel. - -*Can't write to /dev/misc/net/tun: No such device* - * You forgot to `modprobe tun'. - - * You forgot to compile `Universal TUN/TAP driver' in the - kernel. - -*Packet with destination 1.2.3.4 is looping back to us!* - * Something is not configured right. Packets are being sent out - to the virtual network device, but according to the Subnet - directives in your host configuration file, those packets - should go to your own host. Most common mistake is that you - have a Subnet line in your host configuration file with a - prefix length which is just as large as the prefix of the - virtual network interface. The latter should in almost all - cases be larger. Rethink your configuration. Note that you - will only see this message if you specified a debug level of - 5 or higher! - - * Chances are that a `Subnet = ...' line in the host - configuration file of this tinc daemon is wrong. Change it - to a subnet that is accepted locally by another interface, or - if that is not the case, try changing the prefix length into - /32. - -*Network doesn't work, syslog shows only packets of length 46* - Jan 1 12:00:00 host tinc.net[1234]: Read packet of length 46 from tap device - Jan 1 12:00:00 host tinc.net[1234]: Trying to look up 0.0.192.168 in connection list failed! - - * Add the `ifconfig $INTERFACE -arp' to tinc-up. - -*Network address and prefix length do not match!* - * The Subnet field must contain a _network_ address. - - * If you only want to use one IP address, set the netmask to - /32. - -*This is a bug: net.c:253: 24: Some error* - * This is something that should not have happened. Please - report this, and tell us exactly what went wrong before you - got this message. In normal operation, these errors should - not occur. - -*Error reading RSA key file `rsa_key.priv': No such file or directory* - * You must specify the complete pathname. Specifying a - relative path does not make sense here. tinc changes its - directory to / when starting (to avoid keeping a mount point - busy); and even if we built in a default directory to look - for these files, the key files are bound to be in a different - directory. - - -File: tinc.info, Node: Technical information, Next: About us, Prev: Running tinc, Up: Top - -Technical information -********************* - -* Menu: - -* The connection:: -* The meta-protocol:: -* Security:: - - -File: tinc.info, Node: The connection, Next: The meta-protocol, Prev: Technical information, Up: Technical information - -The connection -============== - - tinc is a daemon that takes VPN data and transmit that to another -host computer over the existing Internet infrastructure. - -* Menu: - -* The UDP tunnel:: -* The meta-connection:: - diff --git a/doc/tinc.info-2 b/doc/tinc.info-2 deleted file mode 100644 index c76d214..0000000 --- a/doc/tinc.info-2 +++ /dev/null @@ -1,520 +0,0 @@ -This is tinc.info, produced by makeinfo version 4.1 from tinc.texi. - -INFO-DIR-SECTION Networking tools -START-INFO-DIR-ENTRY -* tinc: (tinc). The tinc Manual. -END-INFO-DIR-ENTRY - - This is the info manual for tinc, a Virtual Private Network daemon. - - Copyright (C) 1998-2002 Ivo Timmermans , -Guus Sliepen and Wessel Dankers -. - - $Id: tinc.texi,v 1.8.4.28 2002/04/09 11:43:29 guus Exp $ - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided that the -entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - - -File: tinc.info, Node: The UDP tunnel, Next: The meta-connection, Prev: The connection, Up: The connection - -The UDP tunnel --------------- - - The data itself is read from a character device file, the so-called -_virtual network device_. This device is associated with a network -interface. Any data sent to this interface can be read from the device, -and any data written to the device gets sent from the interface. Data -to and from the device is formatted as if it were a normal Ethernet -card, so a frame is preceded by two MAC addresses and a _frame type_ -field. - - So when tinc reads an Ethernet frame from the device, it determines -its type. When tinc is in it's default routing mode, it can handle IPv4 -and IPv6 packets. Depending on the Subnet lines, it will send the -packets off to their destination. In the `switch' and `hub' mode, tinc -will use broadcasts and MAC address discovery to deduce the destination -of the packets. Since the latter modes only depend on the link layer -information, any protocol that runs over Ethernet is supported (for -instance IPX and Appletalk). - - After the destination has been determined, a sequence number will be -added to the packet. The packet will then be encrypted and a message -authentication code will be appended. - - When that is done, time has come to actually transport the packet to -the destination computer. We do this by sending the packet over an UDP -connection to the destination host. This is called _encapsulating_, -the VPN packet (though now encrypted) is encapsulated in another IP -datagram. - - When the destination receives this packet, the same thing happens, -only in reverse. So it checks the message authentication code, -decrypts the contents of the UDP datagram, checks the sequence number -and writes the decrypted information to its own virtual network device. - - To let the kernel on the receiving end accept the packet, the -destination MAC address must match that of the virtual network -interface. If tinc is in it's default routing mode, ARP does not work, -so the correct destination MAC cannot be set by the sending daemons. -tinc solves this by always overwriting the destination MAC address with -fe:fd:0:0:0:0. That is also the reason why you must set the MAC address -of your tap interface to that address. - - -File: tinc.info, Node: The meta-connection, Prev: The UDP tunnel, Up: The connection - -The meta-connection -------------------- - - Having only an UDP connection available is not enough. Though -suitable for transmitting data, we want to be able to reliably send -other information, such as routing and session key information to -somebody. - - TCP is a better alternative, because it already contains protection -against information being lost, unlike UDP. - - So we establish two connections. One for the encrypted VPN data, -and one for other information, the meta-data. Hence, we call the second -connection the meta-connection. We can now be sure that the -meta-information doesn't get lost on the way to another computer. - - Like with any communication, we must have a protocol, so that -everybody knows what everything stands for, and how she should react. -Because we have two connections, we also have two protocols. The -protocol used for the UDP data is the "data-protocol," the other one is -the "meta-protocol." - - The reason we don't use TCP for both protocols is that UDP is much -better for encapsulation, even while it is less reliable. The real -problem is that when TCP would be used to encapsulate a TCP stream -that's on the private network, for every packet sent there would be -three ACKs sent instead of just one. Furthermore, if there would be a -timeout, both TCP streams would sense the timeout, and both would start -re-sending packets. - - -File: tinc.info, Node: The meta-protocol, Next: Security, Prev: The connection, Up: Technical information - -The meta-protocol -================= - - The meta protocol is used to tie all tinc daemons together, and -exchange information about which tinc daemon serves which virtual -subnet. - - The meta protocol consists of requests that can be sent to the other -side. Each request has a unique number and several parameters. All -requests are represented in the standard ASCII character set. It is -possible to use tools such as telnet or netcat to connect to a tinc -daemon and to read and write requests by hand, provided that one -understands the numeric codes sent. - - The authentication scheme is described in *Note Authentication -protocol::. After a successful authentication, the server and the -client will exchange all the information about other tinc daemons and -subnets they know of, so that both sides (and all the other tinc -daemons behind them) have their information synchronised. - - daemon message - -------------------------------------------------------------------------- - origin ADD_EDGE node1 12.23.34.45 655 node2 21.32.43.54 655 222 0 - | | | \___________________/ | +-> options - | | | | +----> weight - | | | +----------------> see below - | | +--> UDP port - | +----------> real address - +------------------> name of node on one side of the edge - - origin ADD_SUBNET node 192.168.1.0/24 - | | +--> prefixlength - | +--------> IPv4 network address - +------------------> owner of this subnet - -------------------------------------------------------------------------- - - In case a connection between two daemons is closed or broken, -DEL_EDGE messages are sent to inform the other daemons of that fact. -Each daemon will calculate a new route to the the daemons, or mark them -unreachable if there isn't any. - - The keys used to encrypt VPN packets are not sent out directly. This -is because it would generate a lot of traffic on VPNs with many -daemons, and chances are that not every tinc daemon will ever send a -packet to every other daemon. Instead, if a daemon needs a key it sends -a request for it via the meta connection of the nearest hop in the -direction of the destination. If any hop on the way has already learned -the key, it will act as a proxy and forward its copy back to the -requester. - - daemon message - -------------------------------------------------------------------------- - daemon REQ_KEY origin destination - | +--> name of the tinc daemon it wants the key from - +----------> name of the daemon that wants the key - - daemon ANS_KEY origin destination 4ae0b0a82d6e0078 91 64 4 - | | \______________/ | | +--> MAC length - | | | | +-----> digest algorithm - | | | +--------> cipher algorithm - | | +--> 128 bits key - | +--> name of the daemon that wants the key - +----------> name of the daemon that uses this key - - daemon KEY_CHANGED origin - +--> daemon that has changed it's packet key - -------------------------------------------------------------------------- - - There is also a mechanism to check if hosts are still alive. Since -network failures or a crash can cause a daemon to be killed without -properly shutting down the TCP connection, this is necessary to keep an -up to date connection list. PINGs are sent at regular intervals, except -when there is also some other traffic. A little bit of salt (random -data) is added with each PING and PONG message, to make sure that long -sequences of PING/PONG messages without any other traffic won't result -in known plaintext. - - daemon message - -------------------------------------------------------------------------- - origin PING - dest. PONG - -------------------------------------------------------------------------- - - This basically covers what is sent over the meta connection by tinc. - - -File: tinc.info, Node: Security, Prev: The meta-protocol, Up: Technical information - -About tinc's encryption and other security-related issues. -========================================================== - - tinc got its name from "TINC," short for _There Is No Cabal_; the -alleged Cabal was/is an organisation that was said to keep an eye on the -entire Internet. As this is exactly what you _don't_ want, we named -the tinc project after TINC. - - But in order to be "immune" to eavesdropping, you'll have to encrypt -your data. Because tinc is a _Secure_ VPN (SVPN) daemon, it does -exactly that: encrypt. tinc by default uses blowfish encryption with -128 bit keys in CBC mode, 32 bit sequence numbers and 4 byte long -message authentication codes to make sure eavesdroppers cannot get and -cannot change any information at all from the packets they can -intercept. The encryption algorithm and message authentication -algorithm can be changed in the configuration. The length of the message -authentication codes is also adjustable. The length of the key for the -encryption algorithm is always the default length used by OpenSSL. - -* Menu: - -* Authentication protocol:: -* Encryption of network packets:: - - -File: tinc.info, Node: Authentication protocol, Next: Encryption of network packets, Prev: Security, Up: Security - -Authentication protocol ------------------------ - - A new scheme for authentication in tinc has been devised, which -offers some improvements over the protocol used in 1.0pre2 and 1.0pre3. -Explanation is below. - - daemon message - -------------------------------------------------------------------------- - client - - server - - client ID client 12 - | +---> version - +-------> name of tinc daemon - - server ID server 12 - | +---> version - +-------> name of tinc daemon - - client META_KEY 5f0823a93e35b69e...7086ec7866ce582b - \_________________________________/ - +-> RSAKEYLEN bits totally random string S1, - encrypted with server's public RSA key - - server META_KEY 6ab9c1640388f8f0...45d1a07f8a672630 - \_________________________________/ - +-> RSAKEYLEN bits totally random string S2, - encrypted with client's public RSA key - - From now on: - - the client will symmetrically encrypt outgoing traffic using S1 - - the server will symmetrically encrypt outgoing traffic using S2 - - client CHALLENGE da02add1817c1920989ba6ae2a49cecbda0 - \_________________________________/ - +-> CHALLEN bits totally random string H1 - - server CHALLENGE 57fb4b2ccd70d6bb35a64c142f47e61d57f - \_________________________________/ - +-> CHALLEN bits totally random string H2 - - client CHAL_REPLY 816a86 - +-> 160 bits SHA1 of H2 - - server CHAL_REPLY 928ffe - +-> 160 bits SHA1 of H1 - - After the correct challenge replies are received, both ends have proved - their identity. Further information is exchanged. - - client ACK 655 12.23.34.45 123 0 - | | | +-> options - | | +----> estimated weight - | +------------> IP address of server as seen by client - +--------------------> UDP port of client - - server ACK 655 21.32.43.54 321 0 - | | | +-> options - | | +----> estimated weight - | +------------> IP address of client as seen by server - +--------------------> UDP port of server - -------------------------------------------------------------------------- - - This new scheme has several improvements, both in efficiency and -security. - - First of all, the server sends exactly the same kind of messages -over the wire as the client. The previous versions of tinc first -authenticated the client, and then the server. This scheme even allows -both sides to send their messages simultaneously, there is no need to -wait for the other to send something first. This means that any -calculations that need to be done upon sending or receiving a message -can also be done in parallel. This is especially important when doing -RSA encryption/decryption. Given that these calculations are the main -part of the CPU time spent for the authentication, speed is improved by -a factor 2. - - Second, only one RSA encrypted message is sent instead of two. This -reduces the amount of information attackers can see (and thus use for a -cryptographic attack). It also improves speed by a factor two, making -the total speedup a factor 4. - - Third, and most important: The symmetric cipher keys are exchanged -first, the challenge is done afterwards. In the previous authentication -scheme, because a man-in-the-middle could pass the challenge/chal_reply -phase (by just copying the messages between the two real tinc daemons), -but no information was exchanged that was really needed to read the -rest of the messages, the challenge/chal_reply phase was of no real -use. The man-in-the-middle was only stopped by the fact that only after -the ACK messages were encrypted with the symmetric cipher. Potentially, -it could even send it's own symmetric key to the server (if it knew the -server's public key) and read some of the metadata the server would -send it (it was impossible for the mitm to read actual network packets -though). The new scheme however prevents this. - - This new scheme makes sure that first of all, symmetric keys are -exchanged. The rest of the messages are then encrypted with the -symmetric cipher. Then, each side can only read received messages if -they have their private key. The challenge is there to let the other -side know that the private key is really known, because a challenge -reply can only be sent back if the challenge is decrypted correctly, -and that can only be done with knowledge of the private key. - - Fourth: the first thing that is send via the symmetric cipher -encrypted connection is a totally random string, so that there is no -known plaintext (for an attacker) in the beginning of the encrypted -stream. - - -File: tinc.info, Node: Encryption of network packets, Prev: Authentication protocol, Up: Security - -Encryption of network packet ----------------------------- - - A data packet can only be sent if the encryption key is known to both -parties, and the connection is activated. If the encryption key is not -known, a request is sent to the destination using the meta connection -to retrieve it. The packet is stored in a queue while waiting for the -key to arrive. - - The UDP packet containing the network packet from the VPN has the -following layout: - - ... | IP header | UDP header | seqno | VPN packet | MAC | UDP trailer - \___________________/\_____/ - | | - V +---> digest algorithm - Encrypted with symmetric cipher - - So, the entire VPN packet is encrypted using a symmetric cipher. A -32 bits sequence number is added in front of the actual VPN packet, to -act as a unique IV for each packet and to prevent replay attacks. A -message authentication code is added to the UDP packet to prevent -alteration of packets. By default the first 4 bytes of the digest are -used for this, but this can be changed using the MACLength -configuration variable. - - -File: tinc.info, Node: About us, Next: Concept Index, Prev: Technical information, Up: Top - -About us -******** - -* Menu: - -* Contact Information:: -* Authors:: - - -File: tinc.info, Node: Contact Information, Next: Authors, Prev: About us, Up: About us - -Contact information -=================== - - tinc's website is at , this server is -located in the Netherlands. - - We have an IRC channel on the Open Projects IRC network. Connect to -irc.openprojects.net (http://openprojects.nu/services/irc.html), and -join channel #tinc. - - -File: tinc.info, Node: Authors, Prev: Contact Information, Up: About us - -Authors -======= - -Ivo Timmermans (zarq) () - Main coder/hacker and maintainer of the package. - -Guus Sliepen (guus) () - Originator of it all, co-author. - -Wessel Dankers (Ubiq) () - For the name `tinc' and various suggestions. - - We have received a lot of valuable input from users. With their -help, tinc has become the flexible and robust tool that it is today. -We have composed a list of contributions, in the file called `THANKS' in -the source distribution. - - -File: tinc.info, Node: Concept Index, Prev: About us, Up: Top - -Concept Index -************* - -* Menu: - -* ACK: Authentication protocol. -* ADD_EDGE: The meta-protocol. -* ADD_SUBNET: The meta-protocol. -* Address: Host configuration variables. -* AddressFamily: Main configuration variables. -* ANS_KEY: The meta-protocol. -* arp <1>: Error messages. -* arp: Network interfaces. -* authentication: Authentication protocol. -* binary package: Building and installing tinc. -* BindToInterface: Main configuration variables. -* Cabal: Security. -* CHAL_REPLY: Authentication protocol. -* CHALLENGE: Authentication protocol. -* CIDR notation: Host configuration variables. -* Cipher: Host configuration variables. -* client: How connections work. -* command line: Runtime options. -* Compression: Host configuration variables. -* connection: The connection. -* ConnectTo: Main configuration variables. -* daemon: Running tinc. -* data-protocol: The meta-connection. -* Debian: Configuring the kernel. -* debug level: Runtime options. -* DEL_EDGE: The meta-protocol. -* Device: Main configuration variables. -* device files: Device files. -* Digest: Host configuration variables. -* encapsulating: The UDP tunnel. -* encryption: Encryption of network packets. -* ethertap: Configuring the kernel. -* example: Example configuration. -* frame type: The UDP tunnel. -* FreeBSD: Supported platforms. -* hardware address: Network interfaces. -* Hostnames: Main configuration variables. -* hub: Main configuration variables. -* ID: Authentication protocol. -* ifconfig: Network interfaces. -* IndirectData: Host configuration variables. -* Interface: Main configuration variables. -* IRC: Contact Information. -* Kernel-HOWTO: Configuring the kernel. -* key generation: Generating keypairs. -* KEY_CHANGED: The meta-protocol. -* KeyExpire: Main configuration variables. -* libraries: Libraries. -* license: OpenSSL. -* Linux: Supported platforms. -* MAC address: Network interfaces. -* MACExpire: Main configuration variables. -* MACLength: Host configuration variables. -* meta-protocol: The meta-connection. -* META_KEY: Authentication protocol. -* Mode: Main configuration variables. -* multiple networks: Multiple networks. -* Name: Main configuration variables. -* netlink_dev: Configuring the kernel. -* netmask: Network interfaces. -* netname: Multiple networks. -* Network Administrators Guide: Configuration introduction. -* OpenBSD: Supported platforms. -* OpenSSL: OpenSSL. -* options: Runtime options. -* PEM format: Host configuration variables. -* PING: The meta-protocol. -* PingTimeout: Main configuration variables. -* platforms: Supported platforms. -* PONG: The meta-protocol. -* Port: Host configuration variables. -* port numbers: Other files. -* PriorityInheritance: Main configuration variables. -* private: VPNs. -* PrivateKey: Main configuration variables. -* PrivateKeyFile: Main configuration variables. -* PublicKey: Host configuration variables. -* PublicKeyFile: Host configuration variables. -* RedHat: Configuring the kernel. -* release: Supported platforms. -* REQ_KEY: The meta-protocol. -* requirements: Libraries. -* router: Main configuration variables. -* runtime options: Runtime options. -* scalability: tinc. -* server: How connections work. -* Solaris: Supported platforms. -* Subnet: Host configuration variables. -* SVPN: Security. -* switch: Main configuration variables. -* TCP: The meta-connection. -* TCPonly: Host configuration variables. -* TINC: Security. -* tinc: Introduction. -* tinc-up: Network interfaces. -* tincd: tinc. -* Traditional VPNs: tinc. -* tun: Configuring the kernel. -* UDP <1>: Encryption of network packets. -* UDP: The UDP tunnel. -* virtual: VPNs. -* virtual network device: The UDP tunnel. -* VPN: VPNs. -* vpnd: tinc. -* website: Contact Information. -* zlib: zlib. - - diff --git a/doc/tinc.texi b/doc/tinc.texi index 5ce852e..7514cc4 100644 --- a/doc/tinc.texi +++ b/doc/tinc.texi @@ -1,24 +1,26 @@ \input texinfo @c -*-texinfo-*- -@c $Id: tinc.texi,v 1.8.4.28 2002/04/09 11:43:29 guus Exp $ +@c $Id: tinc.texi 1416 2004-11-10 23:21:41Z guus $ @c %**start of header @setfilename tinc.info @settitle tinc Manual @setchapternewpage odd @c %**end of header +@include tincinclude.texi + @ifinfo @dircategory Networking tools @direntry * tinc: (tinc). The tinc Manual. @end direntry -This is the info manual for tinc, a Virtual Private Network daemon. +This is the info manual for @value{PACKAGE} version @value{VERSION}, a Virtual Private Network daemon. -Copyright @copyright{} 1998-2002 Ivo Timmermans -, Guus Sliepen and -Wessel Dankers . +Copyright @copyright{} 1998-2004 Ivo Timmermans +, Guus Sliepen and +Wessel Dankers . -$Id: tinc.texi,v 1.8.4.28 2002/04/09 11:43:29 guus Exp $ +$Id: tinc.texi 1416 2004-11-10 23:21:41Z guus $ Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are @@ -39,11 +41,13 @@ permission notice identical to this one. @page @vskip 0pt plus 1filll @cindex copyright -Copyright @copyright{} 1998-2002 Ivo Timmermans -, Guus Sliepen and -Wessel Dankers . +This is the info manual for @value{PACKAGE} version @value{VERSION}, a Virtual Private Network daemon. -$Id: tinc.texi,v 1.8.4.28 2002/04/09 11:43:29 guus Exp $ +Copyright @copyright{} 1998-2004 Ivo Timmermans +, Guus Sliepen and +Wessel Dankers . + +$Id: tinc.texi 1416 2004-11-10 23:21:41Z guus $ Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are @@ -56,29 +60,30 @@ permission notice identical to this one. @end titlepage +@ifinfo @c ================================================================== -@node Top, Introduction, (dir), (dir) +@node Top +@top Top @menu -* Introduction:: Introduction +* Introduction:: * Preparations:: * Installation:: * Configuration:: * Running tinc:: * Technical information:: +* Platform specific information:: * About us:: * Concept Index:: All used terms explained @end menu - - -@contents +@end ifinfo @c ================================================================== -@node Introduction, Preparations, Top, Top +@node Introduction @chapter Introduction @cindex tinc -tinc is a Virtual Private Network (VPN) daemon that uses tunneling and +Tinc is a Virtual Private Network (VPN) daemon that uses tunneling and encryption to create a secure private network between hosts on the Internet. @@ -92,13 +97,13 @@ configure your computer to use tinc, as well as the configuration process of tinc itself. @menu -* VPNs:: Virtual Private Networks in general -* tinc:: about tinc +* Virtual Private Networks:: +* tinc:: About tinc * Supported platforms:: @end menu @c ================================================================== -@node VPNs, tinc, Introduction, Introduction +@node Virtual Private Networks @section Virtual Private Networks @cindex VPN @@ -136,7 +141,7 @@ through the VPN. This is what tinc was made for. @c ================================================================== -@node tinc, Supported platforms, VPNs, Introduction +@node tinc @section tinc @cindex vpnd @@ -144,22 +149,22 @@ I really don't quite remember what got us started, but it must have been Guus' idea. He wrote a simple implementation (about 50 lines of C) that used the ethertap device that Linux knows of since somewhere about kernel 2.1.60. It didn't work immediately and he improved it a -bit. At this stage, the project was still simply called @samp{vpnd}. +bit. At this stage, the project was still simply called "vpnd". Since then, a lot has changed---to say the least. @cindex tincd -tinc now supports encryption, it consists of a single daemon (tincd) for +Tinc now supports encryption, it consists of a single daemon (tincd) for both the receiving and sending end, it has become largely runtime-configurable---in short, it has become a full-fledged professional package. -@cindex Traditional VPNs +@cindex traditional VPNs @cindex scalability -tinc also allows more than two sites to connect to eachother and form a single VPN. +Tinc also allows more than two sites to connect to eachother and form a single VPN. Traditionally VPNs are created by making tunnels, which only have two endpoints. Larger VPNs with more sites are created by adding more tunnels. -tinc takes another approach: only endpoints are specified, +Tinc takes another approach: only endpoints are specified, the software itself will take care of creating the tunnels. This allows for easier configuration and improved scalability. @@ -173,12 +178,12 @@ available too. @c ================================================================== -@node Supported platforms, , tinc, Introduction +@node Supported platforms @section Supported platforms @cindex platforms -tinc has been verified to work under Linux, FreeBSD, OpenBSD and Solaris, with -various hardware architectures. These are some of the platforms +Tinc has been verified to work under Linux, FreeBSD, OpenBSD, NetBSD, MacOS/X (Darwin), Solaris, and Windows (both natively and in a Cygwin environment), +with various hardware architectures. These are some of the platforms that are supported by the universal tun/tap device driver or other virtual network device drivers. Without such a driver, tinc will most likely compile and run, but it will not be able to send or receive data @@ -187,53 +192,7 @@ packets. @cindex release For an up to date list of supported platforms, please check the list on our website: -@uref{http://tinc.nl.linux.org/platforms.html}. - - -@c ================================================================== -@subsection Linux - -@cindex Linux -tinc was first written for Linux running on an intel x86 processor, so -this is the best supported platform. The protocol however, and actually -anything about tinc, has been rewritten to support random byte ordering -and arbitrary word length. So in theory it should run on other -processors that Linux runs on. It has already been verified to run on -alpha and sparc processors as well. - -tinc uses the ethertap device or the universal tun/tap driver. The former is provided in the standard kernel -from version 2.1.60 up to 2.3.x, but has been replaced in favour of the tun/tap driver in kernel versions 2.4.0 and later. - - -@c ================================================================== -@subsection FreeBSD - -@cindex FreeBSD -tinc on FreeBSD relies on the universal tun/tap driver for its data -acquisition from the kernel. Therefore, tinc will work on the same platforms -as this driver. These are: FreeBSD 3.x, 4.x, 5.x. - - -@c ================================================================== -@subsection OpenBSD - -@cindex OpenBSD -tinc on OpenBSD relies on the tun driver for its data -acquisition from the kernel. It has been verified to work under at least OpenBSD 2.9. - -Tunneling IPv6 packets may not work on OpenBSD. - - -@c ================================================================== -@subsection Solaris - -@cindex Solaris -tinc on Solaris relies on the universal tun/tap driver for its data -acquisition from the kernel. Therefore, tinc will work on the same platforms -as this driver. These are: Solaris 8 (SunOS 5.8). - -IPv6 packets cannot be tunneled on Solaris. - +@uref{http://www.tinc-vpn.org/platforms}. @c @c @@ -249,7 +208,7 @@ IPv6 packets cannot be tunneled on Solaris. @c @c ================================================================== -@node Preparations, Installation, Introduction, Top +@node Preparations @chapter Preparations This chapter contains information on how to prepare your system to @@ -262,43 +221,29 @@ support tinc. @c ================================================================== -@node Configuring the kernel, Libraries, Preparations, Preparations +@node Configuring the kernel @section Configuring the kernel -@cindex RedHat -@cindex Debian -@cindex netlink_dev -@cindex tun -@cindex ethertap -If you are running Linux, chances are good that your kernel already supports -all the devices that tinc needs for proper operation. For example, the -standard kernel from Redhat Linux already has support for ethertap and netlink -compiled in. Debian users can use the modconf utility to select the modules. -If your Linux distribution supports this method of selecting devices, look out -for something called `ethertap', and `netlink_dev' if it is using a kernel -version prior to 2.4.0. In that case you will need both these devices. If you -are using kernel 2.4.0 or later, you need to select `tun'. - -@cindex Kernel-HOWTO -If you can install these devices in a similar manner, you may skip this section. -Otherwise, you will have to recompile the kernel in order to turn on the required features. -If you are unfamiliar with the process of configuring and compiling a new kernel, -you should read the @uref{http://howto.linuxberg.com/LDP/HOWTO/Kernel-HOWTO.html, Kernel HOWTO} first. - @menu * Configuration of Linux kernels 2.1.60 up to 2.4.0:: * Configuration of Linux kernels 2.4.0 and higher:: * Configuration of FreeBSD kernels:: * Configuration of OpenBSD kernels:: +* Configuration of NetBSD kernels:: * Configuration of Solaris kernels:: +* Configuration of Darwin (MacOS/X) kernels:: +* Configuration of Windows:: @end menu @c ================================================================== -@node Configuration of Linux kernels 2.1.60 up to 2.4.0, Configuration of Linux kernels 2.4.0 and higher, Configuring the kernel, Configuring the kernel +@node Configuration of Linux kernels 2.1.60 up to 2.4.0 @subsection Configuration of Linux kernels 2.1.60 up to 2.4.0 -Here are the options you have to turn on when configuring a new kernel: +@cindex ethertap +For kernels up to 2.4.0, you need a kernel that supports the ethertap device. +Most distributions come with kernels that already support this. +If not, here are the options you have to turn on when configuring a new kernel: @example Code maturity level options @@ -332,9 +277,12 @@ Add as much alias/options lines as necessary. @c ================================================================== -@node Configuration of Linux kernels 2.4.0 and higher, Configuration of FreeBSD kernels, Configuration of Linux kernels 2.1.60 up to 2.4.0, Configuring the kernel +@node Configuration of Linux kernels 2.4.0 and higher @subsection Configuration of Linux kernels 2.4.0 and higher +@cindex Universal tun/tap +For kernels 2.4.0 and higher, you need a kernel that supports the Universal tun/tap device. +Most distributions come with kernels that already support this. Here are the options you have to turn on when configuring a new kernel: @example @@ -361,58 +309,91 @@ alias char-major-10-200 tun @c ================================================================== -@node Configuration of FreeBSD kernels, Configuration of OpenBSD kernels, Configuration of Linux kernels 2.4.0 and higher, Configuring the kernel +@node Configuration of FreeBSD kernels @subsection Configuration of FreeBSD kernels -This section will contain information on how to configure your FreeBSD -kernel to support the universal tun/tap device. For 4.1 and higher -versions, this is included in the default kernel configuration, for earlier -systems (4.0 and earlier), you need to install the universal tun/tap driver -yourself. - -Unfortunately somebody still has to write the text. +For FreeBSD version 4.1 and higher, tun and tap drivers are included in the default kernel configuration. +Using tap devices is recommended. @c ================================================================== -@node Configuration of OpenBSD kernels, Configuration of Solaris kernels, Configuration of FreeBSD kernels, Configuring the kernel +@node Configuration of OpenBSD kernels @subsection Configuration of OpenBSD kernels -This section will contain information on how to configure your OpenBSD -kernel to support the tun device. For 2.9 and 3.0 systems, -this is included in the default kernel configuration. - -Unfortunately somebody still has to write the text. +For OpenBSD version 2.9 and higher, +the tun driver is included in the default kernel configuration. +There is also a kernel patch from @uref{http://diehard.n-r-g.com/stuff/openbsd/} +which adds a tap device to OpenBSD. +This should work with tinc. @c ================================================================== -@node Configuration of Solaris kernels, , Configuration of OpenBSD kernels, Configuring the kernel +@node Configuration of NetBSD kernels +@subsection Configuration of NetBSD kernels + +For NetBSD version 1.5.2 and higher, +the tun driver is included in the default kernel configuration. + +Tunneling IPv6 may not work on NetBSD's tun device. + + +@c ================================================================== +@node Configuration of Solaris kernels @subsection Configuration of Solaris kernels -This section will contain information on how to configure your Solaris -kernel to support the universal tun/tap device. For Solaris 8 (SunOS 5.8), -this is included in the default kernel configuration. - -Unfortunately somebody still has to write the text. +For Solaris 8 (SunOS 5.8) and higher, +the tun driver may or may not be included in the default kernel configuration. +If it isn't, the source can be downloaded from @uref{http://vtun.sourceforge.net/tun/}. +For x86 and sparc64 architectures, precompiled versions can be found at @uref{http://www.monkey.org/~dugsong/fragroute/}. +If the @file{net/if_tun.h} header file is missing, install it from the source package. @c ================================================================== -@node Libraries, , Configuring the kernel, Preparations +@node Configuration of Darwin (MacOS/X) kernels +@subsection Configuration of Darwin (MacOS/X) kernels + +Tinc on Darwin relies on a tunnel driver for its data acquisition from the kernel. +Tinc supports either the driver from @uref{http://www-user.rhrk.uni-kl.de/~nissler/tuntap/}, +which supports both tun and tap style devices, +and also the driver from from @uref{http://chrisp.de/en/projects/tunnel.html}. +The former driver is recommended. +The tunnel driver must be loaded before starting tinc with the following command: + +@example +kmodload tunnel +@end example + + +@c ================================================================== +@node Configuration of Windows +@subsection Configuration of Windows + +You will need to install the latest TAP-Win32 driver from OpenVPN. +You can download it from @uref{http://openvpn.sourceforge.net}. +Using the Network Connections control panel, +configure the TAP-Win32 network interface in the same way as you would do from the tinc-up script, +as explained in the rest of the documentation. + + +@c ================================================================== +@node Libraries @section Libraries @cindex requirements @cindex libraries -Before you can configure or build tinc, you need to have the OpenSSL -library installed on your system. If you try to configure tinc without -having installed it, configure will give you an error message, and stop. +Before you can configure or build tinc, you need to have the OpenSSL, +zlib and lzo libraries installed on your system. If you try to configure tinc without +having them installed, configure will give you an error message, and stop. @menu * OpenSSL:: * zlib:: +* lzo:: @end menu @c ================================================================== -@node OpenSSL, zlib, Libraries, Libraries +@node OpenSSL @subsection OpenSSL @cindex OpenSSL @@ -449,10 +430,12 @@ to let configure know where they are, by passing configure one of the @subsubheading License @cindex license +The complete source code of tinc is covered by the GNU GPL version 2. Since the license under which OpenSSL is distributed is not directly compatible with the terms of the GNU GPL -@uref{http://www.openssl.org/support/faq.html#LEGAL2}, therefore we -include an addition to the GPL (see also the file COPYING.README): +@uref{http://www.openssl.org/support/faq.html#LEGAL2}, we +include an exemption to the GPL (see also the file COPYING.README) to allow +everyone to create a statically or dynamically linked executable: @quotation This program is released under the GPL with the additional exemption @@ -461,9 +444,20 @@ provide binary packages linked to the OpenSSL libraries, provided that all other requirements of the GPL are met. @end quotation +Since the LZO library used by tinc is also covered by the GPL, +we also present the following exemption: + +@quotation +Hereby I grant a special exception to the tinc VPN project +(http://www.tinc-vpn.org/) to link the LZO library with the OpenSSL library +(http://www.openssl.org). + +Markus F.X.J. Oberhumer +@end quotation + @c ================================================================== -@node zlib, , OpenSSL, Libraries +@node zlib @subsection zlib @cindex zlib @@ -485,6 +479,28 @@ make sure you build development and runtime libraries (which is the default). +@c ================================================================== +@node lzo +@subsection lzo + +@cindex lzo +Another form of compression is offered using the lzo library. + +If this library is not installed, you wil get an error when configuring +tinc for build. Support for running tinc without having lzo +installed @emph{may} be added in the future. + +You can use your operating system's package manager to install this if +available. Make sure you install the development AND runtime versions +of this package. + +If you have to install lzo manually, you can get the source code +from @url{http://www.oberhumer.com/opensource/lzo/}. Instructions on how to configure, +build and install this package are included within the package. Please +make sure you build development and runtime libraries (which is the +default). + + @c @c @c @@ -495,7 +511,7 @@ default). @c @c ================================================================== -@node Installation, Configuration, Preparations, Top +@node Installation @chapter Installation If you use Debian, you may want to install one of the @@ -505,13 +521,13 @@ system startup scripts and sample configurations. If you cannot use one of the precompiled packages, or you want to compile tinc for yourself, you can use the source. The source is distributed under the GNU General Public License (GPL). Download the source from the -@uref{http://tinc.nl.linux.org/download.html, download page}, which has +@uref{http://www.tinc-vpn.org/download, download page}, which has the checksums of these files listed; you may wish to check these with md5sum before continuing. -tinc comes in a convenient autoconf/automake package, which you can just +Tinc comes in a convenient autoconf/automake package, which you can just treat the same as any other package. Which is just untar it, type -`configure' and then `make'. +`./configure' and then `make'. More detailed instructions are in the file @file{INSTALL}, which is included in the source distribution. @@ -522,7 +538,7 @@ included in the source distribution. @c ================================================================== -@node Building and installing tinc, System files, Installation, Installation +@node Building and installing tinc @section Building and installing tinc Detailed instructions on configuring the source, building tinc and installing tinc @@ -533,9 +549,50 @@ If you happen to have a binary package for tinc for your distribution, you can use the package management tools of that distribution to install tinc. The documentation that comes along with your distribution will tell you how to do that. +@menu +* Darwin (MacOS/X) build environment:: +* Cygwin (Windows) build environment:: +* MinGW (Windows) build environment:: +@end menu + @c ================================================================== -@node System files, , Building and installing tinc, Installation +@node Darwin (MacOS/X) build environment +@subsection Darwin (MacOS/X) build environment + +In order to build tinc on Darwin, you need to install the MacOS/X Developer Tools +from @uref{http://developer.apple.com/tools/macosxtools.html} and +a recent version of Fink from @uref{http://fink.sourceforge.net/}. + +After installation use fink to download and install the following packages: +autoconf25, automake, dlcompat, m4, openssl, zlib and lzo. + +@c ================================================================== +@node Cygwin (Windows) build environment +@subsection Cygwin (Windows) build environment + +If Cygwin hasn't already been installed, install it directly from +@uref{http://www.cygwin.com/}. + +When tinc is compiled in a Cygwin environment, it can only be run in this environment, +but all programs, including those started outside the Cygwin environment, will be able to use the VPN. +It will also support all features. + +@c ================================================================== +@node MinGW (Windows) build environment +@subsection MinGW (Windows) build environment + +You will need to install the MinGW environment from @uref{http://www.mingw.org}. + +When tinc is compiled using MinGW it runs natively under Windows, +it is not necessary to keep MinGW installed. + +When detaching, tinc will install itself as a service, +which will be restarted automatically after reboots. + + +@c ================================================================== +@node System files @section System files Before you can run tinc, you must make sure you have all the needed @@ -548,7 +605,7 @@ files on your system. @c ================================================================== -@node Device files, Other files, System files, System files +@node Device files @subsection Device files @cindex device files @@ -565,12 +622,9 @@ ethertap devices: @example mknod -m 600 /dev/tap0 c 36 16 -chown 0.0 /dev/tap0 mknod -m 600 /dev/tap1 c 36 17 -chown 0.0 /dev/tap0 ... mknod -m 600 /dev/tap@emph{N} c 36 @emph{N+16} -chown 0.0 /dev/tap@emph{N} @end example There is a maximum of 16 ethertap devices. @@ -580,19 +634,18 @@ following device file (unless it already exist): @example mknod -m 600 /dev/tun c 10 200 -chown 0.0 /dev/tun @end example If you use Linux, and you run the new 2.4 kernel using the devfs filesystem, then the tun/tap device will probably be automatically generated as -@file{/dev/misc/net/tun}. +@file{/dev/net/tun}. Unlike the ethertap device, you do not need multiple device files if you are planning to run multiple tinc daemons. @c ================================================================== -@node Other files, , Device files, System files +@node Other files @subsection Other files @subsubheading @file{/etc/networks} @@ -614,7 +667,7 @@ number 655 is registered with the IANA. @example tinc 655/tcp TINC tinc 655/udp TINC -# Ivo Timmermans +# Ivo Timmermans @end example @@ -630,7 +683,7 @@ tinc 655/udp TINC @c ================================================================== -@node Configuration, Running tinc, Installation, Top +@node Configuration @chapter Configuration @menu @@ -644,10 +697,9 @@ tinc 655/udp TINC @end menu @c ================================================================== -@node Configuration introduction, Multiple networks, Configuration, Configuration +@node Configuration introduction @section Configuration introduction -@cindex Network Administrators Guide Before actually starting to configure tinc and editing files, make sure you have read this entire section so you know what to expect. Then, make it clear to yourself how you want to organize your VPN: @@ -656,9 +708,11 @@ What IP addresses/subnets do they have? What is the network mask of the entire VPN? Do you need special firewall rules? Do you have to set up masquerading or forwarding rules? +Do you want to run tinc in router mode or switch mode? These questions can only be answered by yourself, you will not find the answers in this documentation. Make sure you have an adequate understanding of networks in general. +@cindex Network Administrators Guide A good resource on networking is the @uref{http://www.linuxdoc.org/LDP/nag2/, Linux Network Administrators Guide}. @@ -671,14 +725,14 @@ These steps are described in the subsections below. @c ================================================================== -@node Multiple networks, How connections work, Configuration introduction, Configuration +@node Multiple networks @section Multiple networks @cindex multiple networks @cindex netname In order to allow you to run more than one tinc daemon on one computer, for instance if your computer is part of more than one VPN, -you can assign a ``netname'' to your VPN. +you can assign a @var{netname} to your VPN. It is not required if you only run one tinc daemon, it doesn't even have to be the same on all the sites of your VPN, but it is recommended that you choose one anyway. @@ -688,14 +742,14 @@ This means that you call tincd with the -n argument, which will assign a netname to this daemon. The effect of this is that the daemon will set its configuration -``root'' to /etc/tinc/netname/, where netname is your argument to the -n -option. You'll notice that it appears in syslog as ``tinc.netname''. +root to @file{@value{sysconfdir}/tinc/@var{netname}/}, where @var{netname} is your argument to the -n +option. You'll notice that it appears in syslog as @file{tinc.@var{netname}}. However, it is not strictly necessary that you call tinc with the -n option. In this case, the network name would just be empty, and it will -be used as such. tinc now looks for files in /etc/tinc/, instead of -/etc/tinc/netname/; the configuration file should be /etc/tinc/tinc.conf, -and the host configuration files are now expected to be in /etc/tinc/hosts/. +be used as such. tinc now looks for files in @file{@value{sysconfdir}/tinc/}, instead of +@file{@value{sysconfdir}/tinc/@var{netname}/}; the configuration file should be @file{@value{sysconfdir}/tinc/tinc.conf}, +and the host configuration files are now expected to be in @file{@value{sysconfdir}/tinc/hosts/}. But it is highly recommended that you use this feature of tinc, because it will be so much clearer whom your daemon talks to. Hence, we will @@ -703,13 +757,13 @@ assume that you use it. @c ================================================================== -@node How connections work, Configuration files, Multiple networks, Configuration +@node How connections work @section How connections work When tinc starts up, it parses the command-line options and then -reads in the configuration file. -If it sees a `ConnectTo' value pointing to another tinc daemon in the file, -it will try to connect to that other one. +reads in the configuration file tinc.conf. +If it sees one or more `ConnectTo' values pointing to other tinc daemons in that file, +it will try to connect to those other daemons. Whether this succeeds or not and whether `ConnectTo' is specified or not, tinc will listen for incoming connection from other deamons. If you did specify a `ConnectTo' value and the other side is not responding, @@ -717,23 +771,23 @@ tinc will keep retrying. This means that once started, tinc will stay running until you tell it to stop, and failures to connect to other tinc daemons will not stop your tinc daemon for trying again later. -This means you don't have to intervene if there are any network problems. +This means you don't have to intervene if there are temporary network problems. @cindex client @cindex server There is no real distinction between a server and a client in tinc. If you wish, you can view a tinc daemon without a `ConnectTo' value as a server, and one which does specify such a value as a client. -It does not matter if two tinc daemons have a `ConnectTo' value pointing to eachother however. +It does not matter if two tinc daemons have a `ConnectTo' value pointing to each other however. @c ================================================================== -@node Configuration files, Generating keypairs, How connections work, Configuration +@node Configuration files @section Configuration files The actual configuration of the daemon is done in the file -@file{/etc/tinc/netname/tinc.conf} and at least one other file in the directory -@file{/etc/tinc/netname/hosts/}. +@file{@value{sysconfdir}/tinc/@var{netname}/tinc.conf} and at least one other file in the directory +@file{@value{sysconfdir}/tinc/@var{netname}/hosts/}. These file consists of comments (lines started with a #) or assignments in the form of @@ -749,29 +803,37 @@ out, remember to replace it with at least one space character. In this section all valid variables are listed in alphabetical order. The default value is given between parentheses, -other comments are between square brackets and -required directives are given in @strong{bold}. +other comments are between square brackets. @menu * Main configuration variables:: * Host configuration variables:: +* Scripts:: * How to configure:: @end menu @c ================================================================== -@node Main configuration variables, Host configuration variables, Configuration files, Configuration files +@node Main configuration variables @subsection Main configuration variables @table @asis @cindex AddressFamily -@item AddressFamily = (ipv4) [experimental] +@item AddressFamily = (any) This option affects the address family of listening and outgoing sockets. -If "any" is selected, then depending on the operating system +If any is selected, then depending on the operating system both IPv4 and IPv6 or just IPv6 listening sockets will be created. +@cindex BindToAddress +@item BindToAddress = <@var{address}> [experimental] +If your computer has more than one IPv4 or IPv6 address, tinc +will by default listen on all of them for incoming connections. +It is possible to bind only to a single address with this variable. + +This option may not work on all platforms. + @cindex BindToInterface -@item BindToInterface = [experimental] +@item BindToInterface = <@var{interface}> [experimental] If you have more than one network interface in your computer, tinc will by default listen on all of them for incoming connections. It is possible to bind tinc to a single interface like eth0 or ppp0 with this @@ -779,22 +841,35 @@ variable. This option may not work on all platforms. -@cindex ConnectTo -@item @strong{ConnectTo = } -Specifies which host to connect to on startup. Multiple ConnectTo -variables may be specified, if connecting to the first one fails then -tinc will try the next one, and so on. It is possible to specify -hostnames for dynamic IP addresses (like those given on dyndns.org), -tinc will not cache the resolved IP address. +@cindex BlockingTCP +@item BlockingTCP = (no) [experimental] +This options selects whether TCP connections, when established, should use blocking writes. +When turned off, tinc will never block when a TCP connection becomes congested, +but will have to terminate that connection instead. +If turned on, tinc will not terminate connections but will block, +thereby unable to process data to/from other connections. +Turn this option on if you also use TCPOnly and tinc terminates connections frequently. -If you don't specify a host with ConnectTo, regardless of whether a -value for ConnectPort is given, tinc won't connect at all, and will -instead just listen for incoming connections. +@cindex ConnectTo +@item ConnectTo = <@var{name}> +Specifies which other tinc daemon to connect to on startup. +Multiple ConnectTo variables may be specified, +in which case outgoing connections to each specified tinc daemon are made. +The names should be known to this tinc daemon +(i.e., there should be a host configuration file for the name on the ConnectTo line). + +If you don't specify a host with ConnectTo, +tinc won't try to connect to other daemons at all, +and will instead just listen for incoming connections. @cindex Device -@item @strong{Device = } (/dev/tap0 or /dev/misc/net/tun) -The virtual network device to use. Note that you can only use one device per -daemon. See also @ref{Device files}. +@item Device = <@var{device}> (@file{/dev/tap0}, @file{/dev/net/tun} or other depending on platform) +The virtual network device to use. +Tinc will automatically detect what kind of device it is. +Note that you can only use one device per daemon. +Under Windows, use @var{Interface} instead of @var{Device}. +Note that you can only use one device per daemon. +See also @ref{Device files}. @cindex Hostnames @item Hostnames = (no) @@ -807,10 +882,11 @@ This does not affect resolving hostnames to IP addresses from the configuration file. @cindex Interface -@item Interface = +@item Interface = <@var{interface}> Defines the name of the interface corresponding to the virtual network device. -Depending on the operating system and the type of device this may or may not actually set the name. -Currently this option only affects the Linux tun/tap device. +Depending on the operating system and the type of device this may or may not actually set the name of the interface. +Under Windows, this variable is used to select which network interface will be used. +If you specified a Device, this variable is almost always already correctly set. @cindex Mode @item Mode = (router) @@ -823,6 +899,8 @@ In this mode Subnet variables in the host configuration files will be used to form a routing table. Only unicast packets of routable protocols (IPv4 and IPv6) are supported in this mode. +This is the default mode, and unless you really know you need another mode, don't change it. + @cindex switch @item switch In this mode the MAC addresses of the packets on the VPN will be used to @@ -830,6 +908,8 @@ dynamically create a routing table just like an Ethernet switch does. Unicast, multicast and broadcast packets of every protocol that runs over Ethernet are supported in this mode at the cost of frequent broadcast ARP requests and routing table updates. +This mode is primarily useful if you want to bridge Ethernet segments. + @cindex hub @item hub This mode is almost the same as the switch mode, but instead @@ -838,23 +918,23 @@ while no routing table is managed. @end table @cindex KeyExpire -@item KeyExpire = (3600) +@item KeyExpire = <@var{seconds}> (3600) This option controls the time the encryption keys used to encrypt the data are valid. It is common practice to change keys at regular intervals to make it even harder for crackers, even though it is thought to be nearly impossible to crack a single key. @cindex MACExpire -@item MACExpire = (600) +@item MACExpire = <@var{seconds}> (600) This option controls the amount of time MAC addresses are kept before they are removed. This only has effect when Mode is set to "switch". @cindex Name -@item @strong{Name = } +@item Name = <@var{name}> [required] This is a symbolic name for this connection. It can be anything @cindex PingTimeout -@item PingTimeout = (60) +@item PingTimeout = <@var{seconds}> (60) The number of seconds of inactivity that tinc will wait before sending a probe to the other end. If that other end doesn't answer within that same amount of seconds, the connection is terminated, and the others @@ -866,47 +946,56 @@ When this option is enabled the value of the TOS field of tunneled IPv4 packets will be inherited by the UDP packets that are sent out. @cindex PrivateKey -@item PrivateKey = [obsolete] +@item PrivateKey = <@var{key}> [obsolete] This is the RSA private key for tinc. However, for safety reasons it is advised to store private keys of any kind in separate files. This prevents accidental eavesdropping if you are editting the configuration file. @cindex PrivateKeyFile -@item @strong{PrivateKeyFile = } [recommended] +@item PrivateKeyFile = <@var{path}> (@file{@value{sysconfdir}/tinc/@var{netname}/rsa_key.priv}) This is the full path name of the RSA private key file that was -generated by ``tincd --generate-keys''. It must be a full path, not a +generated by @samp{tincd --generate-keys}. It must be a full path, not a relative directory. Note that there must be exactly one of PrivateKey or PrivateKeyFile specified in the configuration file. +@cindex TunnelServer +@item TunnelServer = (no) [experimental] +When this option is enabled tinc will no longer forward information between other tinc daemons, +and will only allow nodes and subnets on the VPN which are present in the +@file{@value{sysconfdir}/tinc/@var{netname}/hosts/} directory. + @end table @c ================================================================== -@node Host configuration variables, How to configure, Main configuration variables, Configuration files +@node Host configuration variables @subsection Host configuration variables @table @asis @cindex Address -@item @strong{Address = } [recommended] +@item Address = <@var{IP address}|@var{hostname}> [recommended] This variable is only required if you want to connect to this host. It must resolve to the external IP address where the host can be reached, not the one that is internal to the VPN. @cindex Cipher -@item Cipher = (blowfish) +@item Cipher = <@var{cipher}> (blowfish) The symmetric cipher algorithm used to encrypt UDP packets. Any cipher supported by OpenSSL is recognized. +Furthermore, specifying "none" will turn off packet encryption. +It is best to use only those ciphers which support CBC mode. @cindex Compression -@item Compression = (0) +@item Compression = <@var{level}> (0) This option sets the level of compression used for UDP packets. -Possible values are 0 (off), 1 (fast) and any integer up to 9 (best). +Possible values are 0 (off), 1 (fast zlib) and any integer up to 9 (best zlib), +10 (fast lzo) and 11 (best lzo). @cindex Digest -@item Digest = (sha1) +@item Digest = <@var{digest}> (sha1) The digest algorithm used to authenticate UDP packets. Any digest supported by OpenSSL is recognized. Furthermore, specifying "none" will turn off packet authentication. @@ -920,26 +1009,24 @@ make a connection from the outside to your tinc daemon. Otherwise, it is best to leave this option out or set it to no. @cindex MACLength -@item MACLength = (4) +@item MACLength = <@var{bytes}> (4) The length of the message authentication code used to authenticate UDP packets. Can be anything from 0 up to the length of the digest produced by the digest algorithm. @cindex Port -@item Port = (655) -Connect to the upstream host (given with the ConnectTo directive) on -port port. port may be given in decimal (default), octal (when preceded -by a single zero) o hexadecimal (prefixed with 0x). port is the port -number for both the UDP and the TCP (meta) connections. +@item Port = <@var{port}> (655) +This is the port this tinc daemon listens on. +You can use decimal portnumbers or symbolic names (as listed in @file{/etc/services}). @cindex PublicKey -@item PublicKey = [obsolete] +@item PublicKey = <@var{key}> [obsolete] This is the RSA public key for this host. @cindex PublicKeyFile -@item PublicKeyFile = [obsolete] +@item PublicKeyFile = <@var{path}> [obsolete] This is the full path name of the RSA public key file that was generated -by ``tincd --generate-keys''. It must be a full path, not a relative +by @samp{tincd --generate-keys}. It must be a full path, not a relative directory. @cindex PEM format @@ -951,9 +1038,9 @@ in each host configuration file, if you want to be able to establish a connection with that host. @cindex Subnet -@item Subnet = +@item Subnet = <@var{address}[/@var{prefixlength}]> The subnet which this tinc daemon will serve. -tinc tries to look up which other daemon it should send a packet to by searching the appropiate subnet. +Tinc tries to look up which other daemon it should send a packet to by searching the appropiate subnet. If the packet matches a subnet, it will be sent to the daemon who has this subnet in his host configuration file. Multiple subnet lines can be specified for each daemon. @@ -970,7 +1057,7 @@ IPv6 subnets are notated like fec0:0:0:1:0:0:0:0/64. MAC addresses are notated like 0:1a:2b:3c:4d:5e. @cindex CIDR notation -prefixlength is the number of bits set to 1 in the netmask part; for +Prefixlength is the number of bits set to 1 in the netmask part; for example: netmask 255.255.255.0 would become /24, 255.255.252.0 becomes /22. This conforms to standard CIDR notation as described in @uref{ftp://ftp.isi.edu/in-notes/rfc1519.txt, RFC1519} @@ -986,18 +1073,86 @@ Setting this options also implicitly sets IndirectData. @c ================================================================== -@node How to configure, , Host configuration variables, Configuration files +@node Scripts +@subsection Scripts + +@cindex scripts +Apart from reading the server and host configuration files, +tinc can also run scripts at certain moments. +Under Windows (not Cygwin), the scripts should have the extension .bat. + +@table @file +@cindex tinc-up +@item @value{sysconfdir}/tinc/@var{netname}/tinc-up +This is the most important script. +If it is present it will be executed right after the tinc daemon has been +started and has connected to the virtual network device. +It should be used to set up the corresponding network interface, +but can also be used to start other things. +Under Windows you can use the Network Connections control panel instead of creating this script. + +@cindex tinc-down +@item @value{sysconfdir}/tinc/@var{netname}/tinc-down +This script is started right before the tinc daemon quits. + +@item @value{sysconfdir}/tinc/@var{netname}/hosts/@var{host}-up +This script is started when the tinc daemon with name @var{host} becomes reachable. + +@item @value{sysconfdir}/tinc/@var{netname}/hosts/@var{host}-down +This script is started when the tinc daemon with name @var{host} becomes unreachable. +@end table + +@cindex environment variables +The scripts are started without command line arguments, +but can make use of certain environment variables. +Under UNIX like operating systems the names of environment variables must be preceded by a $ in scripts. +Under Windows, in @file{.bat} files, they have to be put between % signs. + +@table @env +@cindex NETNAME +@item NETNAME +If a netname was specified, this environment variable contains it. + +@cindex NAME +@item NAME +Contains the name of this tinc daemon. + +@cindex DEVICE +@item DEVICE +Contains the name of the virtual network device that tinc uses. + +@cindex INTERFACE +@item INTERFACE +Contains the name of the virtual network interface that tinc uses. +This should be used for commands like ifconfig. + +@cindex NODE +@item NODE +When a host becomes (un)reachable, this is set to its name. + +@cindex REMOTEADDRESS +@item REMOTEADDRESS +When a host becomes (un)reachable, this is set to its real address. + +@cindex REMOTEPORT +@item REMOTEPORT +When a host becomes (un)reachable, +this is set to the port number it uses for communication with other tinc daemons. +@end table + + +@c ================================================================== +@node How to configure @subsection How to configure @subsubheading Step 1. Creating the main configuration file -The main configuration file will be called @file{/etc/tinc/netname/tinc.conf}. +The main configuration file will be called @file{@value{sysconfdir}/tinc/@var{netname}/tinc.conf}. Adapt the following example to create a basic configuration file: @example -Name = @emph{yourname} -Device = @emph{/dev/tap0} -PrivateKeyFile = /etc/tinc/@emph{netname}/rsa_key.priv +Name = @var{yourname} +Device = @file{/dev/tap0} @end example Then, if you know to which other tinc daemon(s) yours is going to connect, @@ -1006,12 +1161,12 @@ add `ConnectTo' values. @subsubheading Step 2. Creating your host configuration file If you added a line containing `Name = yourname' in the main configuarion file, -you will need to create a host configuration file @file{/etc/tinc/netname/hosts/yourname}. +you will need to create a host configuration file @file{@value{sysconfdir}/tinc/@var{netname}/hosts/yourname}. Adapt the following example to create a host configuration file: @example -Address = @emph{your.real.hostname.org} -Subnet = @emph{192.168.1.0/24} +Address = your.real.hostname.org +Subnet = 192.168.1.0/24 @end example You can also use an IP address instead of a hostname. @@ -1021,7 +1176,7 @@ You might also need to add a `Port' if you want your tinc daemon to run on a dif @c ================================================================== -@node Generating keypairs, Network interfaces, Configuration files, Configuration +@node Generating keypairs @section Generating keypairs @cindex key generation @@ -1029,15 +1184,15 @@ Now that you have already created the main configuration file and your host conf you can easily create a public/private keypair by entering the following command: @example -tincd -n @emph{netname} -K +tincd -n @var{netname} -K @end example -tinc will generate a public and a private key and ask you where to put them. +Tinc will generate a public and a private key and ask you where to put them. Just press enter to accept the defaults. @c ================================================================== -@node Network interfaces, Example configuration, Generating keypairs, Configuration +@node Network interfaces @section Network interfaces Before tinc can start transmitting data over the tunnel, it must @@ -1046,38 +1201,25 @@ set up the virtual network interface. First, decide which IP addresses you want to have associated with these devices, and what network mask they must have. -tinc will open a virtual network device (@file{/dev/tun}, @file{/dev/tap0} or similar), -which will also create a network interface called something like `tun0', `tap0', or, -if you are using the Linux tun/tap driver, the network interface will by default have the same name as the netname. +Tinc will open a virtual network device (@file{/dev/tun}, @file{/dev/tap0} or similar), +which will also create a network interface called something like @samp{tun0}, @samp{tap0}. +If you are using the Linux tun/tap driver, the network interface will by default have the same name as the @var{netname}. +Under Windows you can change the name of the network interface from the Network Connections control panel. @cindex tinc-up You can configure the network interface by putting ordinary ifconfig, route, and other commands -to a script named @file{/etc/tinc/netname/tinc-up}. When tinc starts, this script -will be executed. When tinc exits, it will execute the script named -@file{/etc/tinc/netname/tinc-down}, but normally you don't need to create that script. +to a script named @file{@value{sysconfdir}/tinc/@var{netname}/tinc-up}. +When tinc starts, this script will be executed. When tinc exits, it will execute the script named +@file{@value{sysconfdir}/tinc/@var{netname}/tinc-down}, but normally you don't need to create that script. An example @file{tinc-up} script: @example #!/bin/sh -ifconfig $INTERFACE hw ether fe:fd:0:0:0:0 ifconfig $INTERFACE 192.168.1.1 netmask 255.255.0.0 -ifconfig $INTERFACE -arp @end example -@cindex MAC address -@cindex hardware address -The first line sets up the MAC address of the network interface. -Due to the nature of how Ethernet and tinc work, it has to be set to fe:fd:0:0:0:0 -for tinc to work in it's normal mode. -If you configured tinc to work in `switch' or `hub' mode, the hardware address should instead -be set to a unique address instead of fe:fd:0:0:0:0. - -You can use the environment variable $INTERFACE to get the name of the interface. -However, this might not be reliable. If in doubt, use the name of the interface explicitly. - -@cindex ifconfig -The next line gives the interface an IP address and a netmask. +This script gives the interface an IP address and a netmask. The kernel will also automatically add a route to this interface, so normally you don't need to add route commands to the @file{tinc-up} script. The kernel will also bring the interface up after this command. @@ -1085,14 +1227,13 @@ The kernel will also bring the interface up after this command. The netmask is the mask of the @emph{entire} VPN network, not just your own subnet. -@cindex arp -The last line tells the kernel not to use ARP on that interface. -Again this has to do with how Ethernet and tinc work. -Use this option only if you are running tinc under Linux and are using tinc's normal routing mode. +The exact syntax of the ifconfig and route commands differs from platform to platform. +You can look up the commands for setting addresses and adding routes in @ref{Platform specific information}, +but it is best to consult the manpages of those utilities on your platform. @c ================================================================== -@node Example configuration, , Network interfaces, Configuration +@node Example configuration @section Example configuration @@ -1112,9 +1253,9 @@ C: net 10.3.0.0 mask 255.255.0.0 gateway 10.3.69.254 internet IP 3.4.5.6 D: net 10.4.0.0 mask 255.255.0.0 gateway 10.4.3.32 internet IP 4.5.6.7 @end example -``gateway'' is the VPN IP address of the machine that is running the -tincd. ``internet IP'' is the IP address of the firewall, which does not -need to run tincd, but it must do a port forwarding of TCP&UDP on port +Here, ``gateway'' is the VPN IP address of the machine that is running the +tincd, and ``internet IP'' is the IP address of the firewall, which does not +need to run tincd, but it must do a port forwarding of TCP and UDP on port 655 (unless otherwise configured). In this example, it is assumed that eth0 is the interface that points to @@ -1128,68 +1269,62 @@ for this particular VPN. @emph{BranchA} would be configured like this: -In @file{/etc/tinc/company/tinc-up}: +In @file{@value{sysconfdir}/tinc/company/tinc-up}: @example # Real interface of internal network: -# ifconfig eth0 10.1.54.1 netmask 255.255.0.0 broadcast 10.1.255.255 +# ifconfig eth0 10.1.54.1 netmask 255.255.0.0 -ifconfig tap0 hw ether fe:fd:0:0:0:0 -ifconfig tap0 10.1.54.1 netmask 255.0.0.0 -ifconfig tap0 -arp +ifconfig $INTERFACE 10.1.54.1 netmask 255.0.0.0 @end example -and in @file{/etc/tinc/company/tinc.conf}: +and in @file{@value{sysconfdir}/tinc/company/tinc.conf}: @example Name = BranchA -PrivateKey = /etc/tinc/company/rsa_key.priv Device = /dev/tap0 @end example -On all hosts, /etc/tinc/company/hosts/BranchA contains: +On all hosts, @file{@value{sysconfdir}/tinc/company/hosts/BranchA} contains: @example Subnet = 10.1.0.0/16 Address = 1.2.3.4 -Note that the IP addresses of eth0 and tap0 are the same. -This is quite possible, if you make sure that the netmasks of the interfaces are different. -It is in fact recommended to give give both real internal network interfaces and tap interfaces the same IP address, -since that will make things a lot easier to remember and set up. - -----BEGIN RSA PUBLIC KEY----- ... -----END RSA PUBLIC KEY----- @end example +Note that the IP addresses of eth0 and tap0 are the same. +This is quite possible, if you make sure that the netmasks of the interfaces are different. +It is in fact recommended to give give both real internal network interfaces and tap interfaces the same IP address, +since that will make things a lot easier to remember and set up. + @subsubheading For Branch B -In @file{/etc/tinc/company/tinc-up}: +In @file{@value{sysconfdir}/tinc/company/tinc-up}: @example # Real interface of internal network: -# ifconfig eth0 10.2.43.8 netmask 255.255.0.0 broadcast 10.2.255.255 +# ifconfig eth0 10.2.43.8 netmask 255.255.0.0 -ifconfig tap0 hw ether fe:fd:0:0:0:0 -ifconfig tap0 10.2.1.12 netmask 255.0.0.0 -ifconfig tap0 -arp +ifconfig $INTERFACE 10.2.1.12 netmask 255.0.0.0 @end example -and in @file{/etc/tinc/company/tinc.conf}: +and in @file{@value{sysconfdir}/tinc/company/tinc.conf}: @example Name = BranchB ConnectTo = BranchA -PrivateKey = /etc/tinc/company/rsa_key.priv @end example Note here that the internal address (on eth0) doesn't have to be the same as on the tap0 device. Also, ConnectTo is given so that no-one can connect to this node. -On all hosts, in @file{/etc/tinc/company/hosts/BranchB}: +On all hosts, in @file{@value{sysconfdir}/tinc/company/hosts/BranchB}: @example Subnet = 10.2.0.0/16 @@ -1203,18 +1338,16 @@ Address = 2.3.4.5 @subsubheading For Branch C -In @file{/etc/tinc/company/tinc-up}: +In @file{@value{sysconfdir}/tinc/company/tinc-up}: @example # Real interface of internal network: -# ifconfig eth0 10.3.69.254 netmask 255.255.0.0 broadcast 10.3.255.255 +# ifconfig eth0 10.3.69.254 netmask 255.255.0.0 -ifconfig tap1 hw ether fe:fd:0:0:0:0 -ifconfig tap1 10.3.69.254 netmask 255.0.0.0 -ifconfig tap1 -arp +ifconfig $INTERFACE 10.3.69.254 netmask 255.0.0.0 @end example -and in @file{/etc/tinc/company/tinc.conf}: +and in @file{@value{sysconfdir}/tinc/company/tinc.conf}: @example Name = BranchC @@ -1226,7 +1359,7 @@ C already has another daemon that runs on port 655, so they have to reserve another port for tinc. It knows the portnumber it has to listen on from it's own host configuration file. -On all hosts, in @file{/etc/tinc/company/hosts/BranchC}: +On all hosts, in @file{@value{sysconfdir}/tinc/company/hosts/BranchC}: @example Address = 3.4.5.6 @@ -1241,24 +1374,21 @@ Port = 2000 @subsubheading For Branch D -In @file{/etc/tinc/company/tinc-up}: +In @file{@value{sysconfdir}/tinc/company/tinc-up}: @example # Real interface of internal network: -# ifconfig eth0 10.4.3.32 netmask 255.255.0.0 broadcast 10.4.255.255 +# ifconfig eth0 10.4.3.32 netmask 255.255.0.0 -ifconfig company hw ether fe:fd:0:0:0:0 -ifconfig company 10.4.3.32 netmask 255.0.0.0 -ifconfig company -arp +ifconfig $INTERFACE 10.4.3.32 netmask 255.0.0.0 @end example -and in @file{/etc/tinc/company/tinc.conf}: +and in @file{@value{sysconfdir}/tinc/company/tinc.conf}: @example Name = BranchD ConnectTo = BranchC -Device = /dev/misc/net/tun -PrivateKeyFile = /etc/tinc/company/rsa_key.priv +Device = /dev/net/tun @end example D will be connecting to C, which has a tincd running for this network on @@ -1267,7 +1397,7 @@ Also note that since D uses the tun/tap driver, the network interface will not be called `tun' or `tap0' or something like that, but will have the same name as netname. -On all hosts, in @file{/etc/tinc/company/hosts/BranchD}: +On all hosts, in @file{@value{sysconfdir}/tinc/company/hosts/BranchD}: @example Subnet = 10.4.0.0/16 @@ -1286,8 +1416,8 @@ A, B, C and D all have generated a public/private keypair with the following com tincd -n company -K @end example -The private key is stored in @file{/etc/tinc/company/rsa_key.priv}, -the public key is put into the host configuration file in the @file{/etc/tinc/company/hosts/} directory. +The private key is stored in @file{@value{sysconfdir}/tinc/company/rsa_key.priv}, +the public key is put into the host configuration file in the @file{@value{sysconfdir}/tinc/company/hosts/} directory. During key generation, tinc automatically guesses the right filenames based on the -n option and the Name directive in the @file{tinc.conf} file (if it is available). @@ -1300,89 +1430,204 @@ their daemons, tinc will try connecting until they are available. @c ================================================================== -@node Running tinc, Technical information, Configuration, Top +@node Running tinc @chapter Running tinc If everything else is done, you can start tinc by typing the following command: @example -tincd -n @emph{netname} +tincd -n @var{netname} @end example @cindex daemon -tinc will detach from the terminal and continue to run in the background like a good daemon. +Tinc will detach from the terminal and continue to run in the background like a good daemon. If there are any problems however you can try to increase the debug level and look in the syslog to find out what the problems are. @menu * Runtime options:: +* Signals:: +* Debug levels:: +* Solving problems:: * Error messages:: +* Sending bug reports:: @end menu @c ================================================================== -@node Runtime options, Error messages, , Running tinc +@node Runtime options @section Runtime options Besides the settings in the configuration file, tinc also accepts some command line options. -This list is a longer version of that in the manpage. The latter is -generated automatically, so may be more up-to-date. - @cindex command line @cindex runtime options @cindex options @c from the manpage -@table @samp -@item --bypass-security -Disables encryption and authentication. -Only useful for debugging. - -@item -c, --config=PATH -Read configuration options from the directory PATH. The default is -@file{/etc/tinc/netname/}. - -@cindex debug level -@item -d, --debug=LEVEL -Set debug level to LEVEL. The higher the debug level, the more gets -logged. Everything goes via syslog. - -@item -K, --generate-keys[=BITS] -Generate public/private keypair of BITS length. If BITS is not specified, -1024 is the default. tinc will ask where you want to store the files, -but will default to the configuration directory (you can use the -c or -n option -in combination with -K). After that, tinc will quit. - -@item --help -Display a short reminder of these runtime options and terminate. - -@item -k, --kill[=SIGNAL] -Attempt to kill a running tincd (optionally with the specified SIGNAL instead of SIGTERM) and exit. -Use it in conjunction with the -n option to make sure you kill the right tinc daemon. - -@item -n, --net=NETNAME -Connect to net NETNAME. @xref{Multiple networks}. +@table @option +@item -c, --config=@var{path} +Read configuration options from the directory @var{path}. The default is +@file{@value{sysconfdir}/tinc/@var{netname}/}. @item -D, --no-detach Don't fork and detach. This will also disable the automatic restart mechanism for fatal errors. +@cindex debug level +@item -d, --debug=@var{level} +Set debug level to @var{level}. The higher the debug level, the more gets +logged. Everything goes via syslog. + +@item -k, --kill[=@var{signal}] +Attempt to kill a running tincd (optionally with the specified @var{signal} instead of SIGTERM) and exit. +Use it in conjunction with the -n option to make sure you kill the right tinc daemon. +Under native Windows the optional argument is ignored, +the service will always be stopped and removed. + +@item -n, --net=@var{netname} +Use configuration for net @var{netname}. @xref{Multiple networks}. + +@item -K, --generate-keys[=@var{bits}] +Generate public/private keypair of @var{bits} length. If @var{bits} is not specified, +1024 is the default. tinc will ask where you want to store the files, +but will default to the configuration directory (you can use the -c or -n option +in combination with -K). After that, tinc will quit. + +@item -L, --mlock +Lock tinc into main memory. +This will prevent sensitive data like shared private keys to be written to the system swap files/partitions. + +@item --logfile[=@var{file}] +Write log entries to a file instead of to the system logging facility. +If @var{file} is omitted, the default is @file{@value{localstatedir}/log/tinc.@var{netname}.log}. + +@item --pidfile=@var{file} +Write PID to @var{file} instead of @file{@value{localstatedir}/run/tinc.@var{netname}.pid}. + +@item --bypass-security +Disables encryption and authentication. +Only useful for debugging. + +@item --help +Display a short reminder of these runtime options and terminate. + @item --version Output version information and exit. @end table +@c ================================================================== +@node Signals +@section Signals + +@cindex signals +You can also send the following signals to a running tincd process: + +@c from the manpage +@table @samp + +@item ALRM +Forces tinc to try to connect to all uplinks immediately. +Usually tinc attempts to do this itself, +but increases the time it waits between the attempts each time it failed, +and if tinc didn't succeed to connect to an uplink the first time after it started, +it defaults to the maximum time of 15 minutes. + +@item HUP +Partially rereads configuration files. +Connections to hosts whose host config file are removed are closed. +New outgoing connections specified in @file{tinc.conf} will be made. + +@item INT +Temporarily increases debug level to 5. +Send this signal again to revert to the original level. + +@item USR1 +Dumps the connection list to syslog. + +@item USR2 +Dumps virtual network device statistics, all known nodes, edges and subnets to syslog. + +@item WINCH +Purges all information remembered about unreachable nodes. + +@end table @c ================================================================== -@node Error messages, , Runtime options, Running tinc +@node Debug levels +@section Debug levels + +@cindex debug levels +The tinc daemon can send a lot of messages to the syslog. +The higher the debug level, the more messages it will log. +Each level inherits all messages of the previous level: + +@c from the manpage +@table @samp + +@item 0 +This will log a message indicating tinc has started along with a version number. +It will also log any serious error. + +@item 1 +This will log all connections that are made with other tinc daemons. + +@item 2 +This will log status and error messages from scripts and other tinc daemons. + +@item 3 +This will log all requests that are exchanged with other tinc daemons. These include +authentication, key exchange and connection list updates. + +@item 4 +This will log a copy of everything received on the meta socket. + +@item 5 +This will log all network traffic over the virtual private network. + +@end table + +@c ================================================================== +@node Solving problems +@section Solving problems + +If tinc starts without problems, but if the VPN doesn't work, you will have to find the cause of the problem. +The first thing to do is to start tinc with a high debug level in the foreground, +so you can directly see everything tinc logs: + +@example +tincd -n @var{netname} -d5 -D +@end example + +If tinc does not log any error messages, then you might want to check the following things: + +@itemize +@item @file{tinc-up} script +Does this script contain the right commands? +Normally you must give the interface the address of this host on the VPN, and the netmask must be big enough so that the entire VPN is covered. + +@item Subnet +Does the Subnet (or Subnets) in the host configuration file of this host match the portion of the VPN that belongs to this host? + +@item Firewalls and NATs +Do you have a firewall or a NAT device (a masquerading firewall or perhaps an ADSL router that performs masquerading)? +If so, check that it allows TCP and UDP traffic on port 655. +If it masquerades and the host running tinc is behind it, make sure that it forwards TCP and UDP traffic to port 655 to the host running tinc. +You can add @samp{TCPOnly = yes} to your host config file to force tinc to only use a single TCP connection, +this works through most firewalls and NATs. + +@end itemize + + +@c ================================================================== +@node Error messages @section Error messages -What follows is a list of the most common error messages you can see -when configuring tinc. Most of these messages are visible in the syslog -only, so keep an eye on it! +What follows is a list of the most common error messages you might find in the logs. +Some of them will only be visible if the debug level is high enough. -@table @strong +@table @samp @item Could not open /dev/tap0: No such device @itemize @@ -1390,11 +1635,57 @@ only, so keep an eye on it! @item You forgot to compile `Netlink device emulation' in the kernel. @end itemize -@item Can't write to /dev/misc/net/tun: No such device +@item Can't write to /dev/net/tun: No such device @itemize @item You forgot to `modprobe tun'. @item You forgot to compile `Universal TUN/TAP driver' in the kernel. +@item The tun device is located somewhere else in @file{/dev/}. +@end itemize + +@item Network address and prefix length do not match! + +@itemize +@item The Subnet field must contain a @emph{network} address, trailing bits should be 0. +@item If you only want to use one IP address, set the netmask to /32. +@end itemize + +@item Error reading RSA key file `rsa_key.priv': No such file or directory + +@itemize +@item You forgot to create a public/private keypair. +@item Specify the complete pathname to the private key file with the @samp{PrivateKeyFile} option. +@end itemize + +@item Warning: insecure file permissions for RSA private key file `rsa_key.priv'! + +@itemize +@item The private key file is readable by users other than root. +Use chmod to correct the file permissions. +@end itemize + +@item Creating metasocket failed: Address family not supported + +@itemize +@item By default tinc tries to create both IPv4 and IPv6 sockets. +On some platforms this might not be implemented. +If the logs show @samp{Ready} later on, then at least one metasocket was created, +and you can ignore this message. +You can add @samp{AddressFamily = ipv4} to @file{tinc.conf} to prevent this from happening. +@end itemize + +@item Cannot route packet: unknown IPv4 destination 1.2.3.4 + +@itemize +@item You try to send traffic to a host on the VPN for which no Subnet is known. +@item If it is a broadcast address (ending in .255), it probably is a samba server or a Windows host sending broadcast packets. +You can ignore it. +@end itemize + +@item Cannot route packet: ARP request for unknown address 1.2.3.4 + +@itemize +@item You try to send traffic to a host on the VPN for which no Subnet is known. @end itemize @item Packet with destination 1.2.3.4 is looping back to us! @@ -1408,51 +1699,55 @@ just as large as the prefix of the virtual network interface. The latter should cases be larger. Rethink your configuration. Note that you will only see this message if you specified a debug level of 5 or higher! -@item Chances are that a `Subnet = ...' line in the host configuration file of this tinc daemon is wrong. +@item Chances are that a @samp{Subnet = ...} line in the host configuration file of this tinc daemon is wrong. Change it to a subnet that is accepted locally by another interface, or if that is not the case, try changing the prefix length into /32. @end itemize -@item Network doesn't work, syslog shows only packets of length 46 +@item Node foo (1.2.3.4) is not reachable -@cindex arp -@example -Jan 1 12:00:00 host tinc.net[1234]: Read packet of length 46 from tap device -Jan 1 12:00:00 host tinc.net[1234]: Trying to look up 0.0.192.168 in connection list failed! -@end example @itemize -@item Add the `ifconfig $INTERFACE -arp' to tinc-up. +@item Node foo does not have a connection anymore, its tinc daemon is not running or its connection to the Internet is broken. @end itemize -@item Network address and prefix length do not match! +@item Received UDP packet from unknown source 1.2.3.4 (port 12345) @itemize -@item The Subnet field must contain a @emph{network} address. -@item If you only want to use one IP address, set the netmask to /32. +@item If you see this only sporadically, it is harmless and caused by a node sending packets using an old key. +@item If you see this often and another node is not reachable anymore, then a NAT (masquerading firewall) is changing the source address of UDP packets. +You can add @samp{TCPOnly = yes} to host configuration files to force all VPN traffic to go over a TCP connection. @end itemize -@item This is a bug: net.c:253: 24: Some error +@item Got bad/bogus/unauthorized REQUEST from foo (1.2.3.4 port 12345) @itemize -@item This is something that should not have happened. -Please report this, and tell us exactly what went wrong before you got -this message. In normal operation, these errors should not occur. -@end itemize - -@item Error reading RSA key file `rsa_key.priv': No such file or directory - -@itemize -@item You must specify the complete pathname. -Specifying a relative path does not make sense here. tinc changes its -directory to / when starting (to avoid keeping a mount point busy); and -even if we built in a default directory to look for these files, the key -files are bound to be in a different directory. +@item Node foo does not have the right public/private keypair. +Generate new keypairs and distribute them again. +@item An attacker tries to gain access to your VPN. +@item A network error caused corruption of metadata sent from foo. @end itemize @end table @c ================================================================== -@node Technical information, About us, Running tinc, Top +@node Sending bug reports +@section Sending bug reports + +If you really can't find the cause of a problem, or if you suspect tinc is not working right, +you can send us a bugreport, see @ref{Contact information}. +Be sure to include the following information in your bugreport: + +@itemize +@item A clear description of what you are trying to achieve and what the problem is. +@item What platform (operating system, version, hardware architecture) and which version of tinc you use. +@item If compiling tinc fails, a copy of @file{config.log} and the error messages you get. +@item Otherwise, a copy of @file{tinc.conf}, @file{tinc-up} and all files in the @file{hosts/} directory. +@item The output of the commands @samp{ifconfig -a} and @samp{route -n} (or @samp{netstat -rn} if that doesn't work). +@item The output of any command that fails to work as it should (like ping or traceroute). +@end itemize + +@c ================================================================== +@node Technical information @chapter Technical information @@ -1464,11 +1759,11 @@ files are bound to be in a different directory. @c ================================================================== -@node The connection, The meta-protocol, Technical information, Technical information +@node The connection @section The connection @cindex connection -tinc is a daemon that takes VPN data and transmit that to another host +Tinc is a daemon that takes VPN data and transmit that to another host computer over the existing Internet infrastructure. @menu @@ -1478,7 +1773,7 @@ computer over the existing Internet infrastructure. @c ================================================================== -@node The UDP tunnel, The meta-connection, The connection, The connection +@node The UDP tunnel @subsection The UDP tunnel @cindex virtual network device @@ -1486,22 +1781,25 @@ computer over the existing Internet infrastructure. The data itself is read from a character device file, the so-called @emph{virtual network device}. This device is associated with a network interface. Any data sent to this interface can be read from the device, -and any data written to the device gets sent from the interface. Data to -and from the device is formatted as if it were a normal Ethernet card, -so a frame is preceded by two MAC addresses and a @emph{frame type} -field. +and any data written to the device gets sent from the interface. +There are two possible types of virtual network devices: +`tun' style, which are point-to-point devices which can only handle IPv4 and/or IPv6 packets, +and `tap' style, which are Ethernet devices and handle complete Ethernet frames. So when tinc reads an Ethernet frame from the device, it determines its type. When tinc is in it's default routing mode, it can handle IPv4 and IPv6 -packets. Depending on the Subnet lines, it will send the packets off to their destination. +packets. Depending on the Subnet lines, it will send the packets off to their destination IP address. In the `switch' and `hub' mode, tinc will use broadcasts and MAC address discovery to deduce the destination of the packets. Since the latter modes only depend on the link layer information, any protocol that runs over Ethernet is supported (for instance IPX and Appletalk). +However, only `tap' style devices provide this information. -After the destination has been determined, a sequence number will be added to the packet. -The packet will then be encrypted and a message authentication -code will be appended. +After the destination has been determined, +the packet will be compressed (optionally), +a sequence number will be added to the packet, +the packet will then be encrypted +and a message authentication code will be appended. @cindex encapsulating @cindex UDP @@ -1516,20 +1814,27 @@ in reverse. So it checks the message authentication code, decrypts the contents checks the sequence number and writes the decrypted information to its own virtual network device. -To let the kernel on the receiving end accept the packet, the destination MAC -address must match that of the virtual network interface. -If tinc is in it's default routing mode, ARP does not work, so the correct destination MAC cannot be set -by the sending daemons. -tinc solves this by always overwriting the -destination MAC address with fe:fd:0:0:0:0. That is also the reason why you must -set the MAC address of your tap interface to that address. +If the virtual network device is a `tun' device (a point-to-point tunnel), +there is no problem for the kernel to accept a packet. +However, if it is a `tap' device (this is the only available type on FreeBSD), +the destination MAC address must match that of the virtual network interface. +If tinc is in it's default routing mode, ARP does not work, so the correct destination MAC +can not be known by the sending host. +Tinc solves this by letting the receiving end detect the MAC address of its own virtual network interface +and overwriting the destination MAC address of the received packet. + +In switch or hub modes ARP does work so the sender already knows the correct destination MAC address. +In those modes every interface should have a unique MAC address, so make sure they are not the same. +Because switch and hub modes rely on MAC addresses to function correctly, +these modes cannot be used on the following operating systems which don't have a `tap' style virtual network device: +OpenBSD, NetBSD, Darwin and Solaris. @c ================================================================== -@node The meta-connection, , The UDP tunnel, The connection +@node The meta-connection @subsection The meta-connection -Having only an UDP connection available is not enough. Though suitable +Having only a UDP connection available is not enough. Though suitable for transmitting data, we want to be able to reliably send other information, such as routing and session key information to somebody. @@ -1560,7 +1865,7 @@ start re-sending packets. @c ================================================================== -@node The meta-protocol, Security, The connection, Technical information +@node The meta-protocol @section The meta-protocol The meta protocol is used to tie all tinc daemons together, and @@ -1571,7 +1876,8 @@ The meta protocol consists of requests that can be sent to the other side. Each request has a unique number and several parameters. All requests are represented in the standard ASCII character set. It is possible to use tools such as telnet or netcat to connect to a tinc -daemon and to read and write requests by hand, provided that one +daemon started with the --bypass-security option +and to read and write requests by hand, provided that one understands the numeric codes sent. The authentication scheme is described in @ref{Authentication protocol}. After a @@ -1583,57 +1889,89 @@ synchronised. @cindex ADD_EDGE @cindex ADD_SUBNET @example -daemon message --------------------------------------------------------------------------- -origin ADD_EDGE node1 12.23.34.45 655 node2 21.32.43.54 655 222 0 - | | | \___________________/ | +-> options - | | | | +----> weight - | | | +----------------> see below - | | +--> UDP port - | +----------> real address - +------------------> name of node on one side of the edge +message +------------------------------------------------------------------ +ADD_EDGE node1 node2 21.32.43.54 655 222 0 + | | | | | +-> options + | | | | +----> weight + | | | +--------> UDP port of node2 + | | +----------------> real address of node2 + | +-------------------------> name of destination node + +-------------------------------> name of source node -origin ADD_SUBNET node 192.168.1.0/24 - | | +--> prefixlength - | +--------> IPv4 network address - +------------------> owner of this subnet --------------------------------------------------------------------------- +ADD_SUBNET node 192.168.1.0/24 + | | +--> prefixlength + | +--------> network address + +------------------> owner of this subnet +------------------------------------------------------------------ @end example +The ADD_EDGE messages are to inform other tinc daemons that a connection between +two nodes exist. The address of the destination node is available so that +VPN packets can be sent directly to that node. + +The ADD_SUBNET messages inform other tinc daemons that certain subnets belong +to certain nodes. tinc will use it to determine to which node a VPN packet has +to be sent. + @cindex DEL_EDGE +@cindex DEL_SUBNET +@example +message +------------------------------------------------------------------ +DEL_EDGE node1 node2 + | +----> name of destination node + +----------> name of source node + +DEL_SUBNET node 192.168.1.0/24 + | | +--> prefixlength + | +--------> network address + +------------------> owner of this subnet +------------------------------------------------------------------ +@end example + In case a connection between two daemons is closed or broken, DEL_EDGE messages are sent to inform the other daemons of that fact. Each daemon will calculate a new route to the the daemons, or mark them unreachable if there isn't any. +@cindex REQ_KEY +@cindex ANS_KEY +@cindex KEY_CHANGED +@example +message +------------------------------------------------------------------ +REQ_KEY origin destination + | +--> name of the tinc daemon it wants the key from + +----------> name of the daemon that wants the key + +ANS_KEY origin destination 4ae0b0a82d6e0078 91 64 4 + | | \______________/ | | +--> MAC length + | | | | +-----> digest algorithm + | | | +--------> cipher algorithm + | | +--> 128 bits key + | +--> name of the daemon that wants the key + +----------> name of the daemon that uses this key + +KEY_CHANGED origin + +--> daemon that has changed it's packet key +------------------------------------------------------------------ +@end example + The keys used to encrypt VPN packets are not sent out directly. This is because it would generate a lot of traffic on VPNs with many daemons, and chances are that not every tinc daemon will ever send a packet to every other daemon. Instead, if a daemon needs a key it sends a request for it via the meta connection of the nearest hop in the direction of the -destination. If any hop on the way has already learned the key, it will -act as a proxy and forward its copy back to the requester. +destination. -@cindex REQ_KEY -@cindex ANS_KEY -@cindex KEY_CHANGED +@cindex PING +@cindex PONG @example daemon message --------------------------------------------------------------------------- -daemon REQ_KEY origin destination - | +--> name of the tinc daemon it wants the key from - +----------> name of the daemon that wants the key - -daemon ANS_KEY origin destination 4ae0b0a82d6e0078 91 64 4 - | | \______________/ | | +--> MAC length - | | | | +-----> digest algorithm - | | | +--------> cipher algorithm - | | +--> 128 bits key - | +--> name of the daemon that wants the key - +----------> name of the daemon that uses this key - -daemon KEY_CHANGED origin - +--> daemon that has changed it's packet key --------------------------------------------------------------------------- +------------------------------------------------------------------ +origin PING +dest. PONG +------------------------------------------------------------------ @end example There is also a mechanism to check if hosts are still alive. Since network @@ -1644,27 +1982,16 @@ is also some other traffic. A little bit of salt (random data) is added with each PING and PONG message, to make sure that long sequences of PING/PONG messages without any other traffic won't result in known plaintext. -@cindex PING -@cindex PONG -@example -daemon message --------------------------------------------------------------------------- -origin PING -dest. PONG --------------------------------------------------------------------------- -@end example - -This basically covers what is sent over the meta connection by -tinc. +This basically covers what is sent over the meta connection by tinc. @c ================================================================== -@node Security, , The meta-protocol, Technical information -@section About tinc's encryption and other security-related issues. +@node Security +@section Security @cindex TINC @cindex Cabal -tinc got its name from ``TINC,'' short for @emph{There Is No Cabal}; the +Tinc got its name from ``TINC,'' short for @emph{There Is No Cabal}; the alleged Cabal was/is an organisation that was said to keep an eye on the entire Internet. As this is exactly what you @emph{don't} want, we named the tinc project after TINC. @@ -1673,7 +2000,7 @@ the tinc project after TINC. But in order to be ``immune'' to eavesdropping, you'll have to encrypt your data. Because tinc is a @emph{Secure} VPN (SVPN) daemon, it does exactly that: encrypt. -tinc by default uses blowfish encryption with 128 bit keys in CBC mode, 32 bit +Tinc by default uses blowfish encryption with 128 bit keys in CBC mode, 32 bit sequence numbers and 4 byte long message authentication codes to make sure eavesdroppers cannot get and cannot change any information at all from the packets they can intercept. The encryption algorithm and message authentication @@ -1684,11 +2011,12 @@ encryption algorithm is always the default length used by OpenSSL. @menu * Authentication protocol:: * Encryption of network packets:: +* Security issues:: @end menu @c ================================================================== -@node Authentication protocol, Encryption of network packets, Security, Security +@node Authentication protocol @subsection Authentication protocol @cindex authentication @@ -1747,17 +2075,15 @@ server CHAL_REPLY 928ffe After the correct challenge replies are received, both ends have proved their identity. Further information is exchanged. -client ACK 655 12.23.34.45 123 0 - | | | +-> options - | | +----> estimated weight - | +------------> IP address of server as seen by client - +--------------------> UDP port of client +client ACK 655 123 0 + | | +-> options + | +----> estimated weight + +--------> listening port of client -server ACK 655 21.32.43.54 321 0 - | | | +-> options - | | +----> estimated weight - | +------------> IP address of client as seen by server - +--------------------> UDP port of server +server ACK 655 321 0 + | | +-> options + | +----> estimated weight + +--------> listening port of server -------------------------------------------------------------------------- @end example @@ -1798,14 +2124,14 @@ known, because a challenge reply can only be sent back if the challenge is decrypted correctly, and that can only be done with knowledge of the private key. -Fourth: the first thing that is send via the symmetric cipher encrypted +Fourth: the first thing that is sent via the symmetric cipher encrypted connection is a totally random string, so that there is no known plaintext (for an attacker) in the beginning of the encrypted stream. @c ================================================================== -@node Encryption of network packets, , Authentication protocol, Security -@subsection Encryption of network packet +@node Encryption of network packets +@subsection Encryption of network packets @cindex encryption A data packet can only be sent if the encryption key is known to both @@ -1825,52 +2151,196 @@ The UDP packet containing the network packet from the VPN has the following layo Encrypted with symmetric cipher @end example -So, the entire VPN packet is encrypted using a symmetric cipher. A 32 bits -sequence number is added in front of the actual VPN packet, to act as a unique +So, the entire VPN packet is encrypted using a symmetric cipher, including a 32 bits +sequence number that is added in front of the actual VPN packet, to act as a unique IV for each packet and to prevent replay attacks. A message authentication code is added to the UDP packet to prevent alteration of packets. By default the first 4 bytes of the digest are used for this, but this can be changed using the MACLength configuration variable. @c ================================================================== -@node About us, Concept Index, Technical information, Top +@node Security issues +@subsection Security issues + +In August 2000, we discovered the existence of a security hole in all versions +of tinc up to and including 1.0pre2. This had to do with the way we exchanged +keys. Since then, we have been working on a new authentication scheme to make +tinc as secure as possible. The current version uses the OpenSSL library and +uses strong authentication with RSA keys. + +On the 29th of December 2001, Jerome Etienne posted a security analysis of tinc +1.0pre4. Due to a lack of sequence numbers and a message authentication code +for each packet, an attacker could possibly disrupt certain network services or +launch a denial of service attack by replaying intercepted packets. The current +version adds sequence numbers and message authentication codes to prevent such +attacks. + +On the 15th of September 2003, Peter Gutmann posted a security analysis of tinc +1.0.1. He argues that the 32 bit sequence number used by tinc is not a good IV, +that tinc's default length of 4 bytes for the MAC is too short, and he doesn't +like tinc's use of RSA during authentication. We do not know of a security hole +in this version of tinc, but tinc's security is not as strong as TLS or IPsec. +We will address these issues in tinc 2.0. + +Cryptography is a hard thing to get right. We cannot make any +guarantees. Time, review and feedback are the only things that can +prove the security of any cryptographic product. If you wish to review +tinc or give us feedback, you are stronly encouraged to do so. + + +@c ================================================================== +@node Platform specific information +@chapter Platform specific information + +@menu +* Interface configuration:: +* Routes:: +@end menu + +@c ================================================================== +@node Interface configuration +@section Interface configuration + +When configuring an interface, one normally assigns it an address and a +netmask. The address uniquely identifies the host on the network attached to +the interface. The netmask, combined with the address, forms a subnet. It is +used to add a route to the routing table instructing the kernel to send all +packets which fall into that subnet to that interface. Because all packets for +the entire VPN should go to the virtual network interface used by tinc, the +netmask should be such that it encompasses the entire VPN. + +For IPv4 addresses: + +@multitable {Darwin (MacOS/X)} {ifconfig route add -bla network address netmask netmask prefixlength interface} +@item Linux +@tab @code{ifconfig} @var{interface} @var{address} @code{netmask} @var{netmask} +@item Linux iproute2 +@tab @code{ip addr add} @var{address}@code{/}@var{prefixlength} @code{dev} @var{interface} +@item FreeBSD +@tab @code{ifconfig} @var{interface} @var{address} @code{netmask} @var{netmask} +@item OpenBSD +@tab @code{ifconfig} @var{interface} @var{address} @code{netmask} @var{netmask} +@item NetBSD +@tab @code{ifconfig} @var{interface} @var{address} @code{netmask} @var{netmask} +@item Solaris +@tab @code{ifconfig} @var{interface} @var{address} @code{netmask} @var{netmask} +@item Darwin (MacOS/X) +@tab @code{ifconfig} @var{interface} @var{address} @code{netmask} @var{netmask} +@item Windows +@tab @code{netsh interface ip set address} @var{interface} @code{static} @var{address} @var{netmask} +@end multitable + + +For IPv6 addresses: + +@multitable {Darwin (MacOS/X)} {ifconfig route add -bla network address netmask netmask prefixlength interface} +@item Linux +@tab @code{ifconfig} @var{interface} @code{add} @var{address}@code{/}@var{prefixlength} +@item FreeBSD +@tab @code{ifconfig} @var{interface} @code{inet6} @var{address} @code{prefixlen} @var{prefixlength} +@item OpenBSD +@tab @code{ifconfig} @var{interface} @code{inet6} @var{address} @code{prefixlen} @var{prefixlength} +@item NetBSD +@tab @code{ifconfig} @var{interface} @code{inet6} @var{address} @code{prefixlen} @var{prefixlength} +@item Solaris +@tab @code{ifconfig} @var{interface} @code{inet6 plumb up} +@item +@tab @code{ifconfig} @var{interface} @code{inet6 addif} @var{address} @var{address} +@item Darwin (MacOS/X) +@tab @code{ifconfig} @var{interface} @code{inet6} @var{address} @code{prefixlen} @var{prefixlength} +@item Windows +@tab @code{netsh interface ipv6 add address} @var{interface} @code{static} @var{address}/@var{prefixlength} +@end multitable + + +@c ================================================================== +@node Routes +@section Routes + +In some cases it might be necessary to add more routes to the virtual network +interface. There are two ways to indicate which interface a packet should go +to, one is to use the name of the interface itself, another way is to specify +the (local) address that is assigned to that interface (@var{local_address}). The +former way is unambiguous and therefore preferable, but not all platforms +support this. + +Adding routes to IPv4 subnets: + +@multitable {Darwin (MacOS/X)} {ifconfig route add -bla network address netmask netmask prefixlength interface} +@item Linux +@tab @code{route add -net} @var{network_address} @code{netmask} @var{netmask} @var{interface} +@item Linux iproute2 +@tab @code{ip route add} @var{network_address}@code{/}@var{prefixlength} @code{dev} @var{interface} +@item FreeBSD +@tab @code{route add} @var{network_address}@code{/}@var{prefixlength} @var{local_address} +@item OpenBSD +@tab @code{route add} @var{network_address}@code{/}@var{prefixlength} @var{local_address} +@item NetBSD +@tab @code{route add} @var{network_address}@code{/}@var{prefixlength} @var{local_address} +@item Solaris +@tab @code{route add} @var{network_address}@code{/}@var{prefixlength} @var{local_address} @code{-interface} +@item Darwin (MacOS/X) +@tab @code{route add} @var{network_address}@code{/}@var{prefixlength} @var{local_address} +@item Windows +@tab @code{netsh routing ip add persistentroute} @var{network_address} @var{netmask} @var{interface} @var{local_address} +@end multitable + +Adding routes to IPv6 subnets: + +@multitable {Darwin (MacOS/X)} {ifconfig route add -bla network address netmask netmask prefixlength interface} +@item Linux +@tab @code{route add -A inet6} @var{network_address}@code{/}@var{prefixlength} @var{interface} +@item Linux iproute2 +@tab @code{ip route add} @var{network_address}@code{/}@var{prefixlength} @code{dev} @var{interface} +@item FreeBSD +@tab @code{route add -inet6} @var{network_address}@code{/}@var{prefixlength} @var{local_address} +@item OpenBSD +@tab @code{route add -inet6} @var{network_address} @var{local_address} @code{-prefixlen} @var{prefixlength} +@item NetBSD +@tab @code{route add -inet6} @var{network_address} @var{local_address} @code{-prefixlen} @var{prefixlength} +@item Solaris +@tab @code{route add -inet6} @var{network_address}@code{/}@var{prefixlength} @var{local_address} @code{-interface} +@item Darwin (MacOS/X) +@tab ? +@item Windows +@tab @code{netsh interface ipv6 add route} @var{network address}/@var{prefixlength} @var{interface} +@end multitable + + +@c ================================================================== +@node About us @chapter About us @menu -* Contact Information:: +* Contact information:: * Authors:: @end menu @c ================================================================== -@node Contact Information, Authors, About us, About us +@node Contact information @section Contact information @cindex website -tinc's website is at @url{http://tinc.nl.linux.org/}, +Tinc's website is at @url{http://www.tinc-vpn.org/}, this server is located in the Netherlands. @cindex IRC -We have an IRC channel on the Open Projects IRC network. Connect to -@uref{http://openprojects.nu/services/irc.html, irc.openprojects.net}, +We have an IRC channel on the FreeNode and OFTC IRC networks. Connect to +@uref{http://www.freenode.net/, irc.freenode.net} +or +@uref{http://www.oftc.net/, irc.oftc.net} and join channel #tinc. @c ================================================================== -@node Authors, , Contact Information, About us +@node Authors @section Authors @table @asis -@item Ivo Timmermans (zarq) (@email{itimmermans@@bigfoot.com}) -Main coder/hacker and maintainer of the package. - -@item Guus Sliepen (guus) (@email{guus@@sliepen.warande.net}) -Originator of it all, co-author. - -@item Wessel Dankers (Ubiq) (@email{wsl@@nl.linux.org}) -For the name `tinc' and various suggestions. - +@item Ivo Timmermans (zarq) (@email{ivo@@tinc-vpn.org}) +@item Guus Sliepen (guus) (@email{guus@@tinc-vpn.org}) @end table We have received a lot of valuable input from users. With their help, @@ -1880,8 +2350,7 @@ the source distribution. @c ================================================================== -@node Concept Index, , About us, Top -@c node-name, next, previous, up +@node Concept Index @unnumbered Concept Index @c ================================================================== diff --git a/doc/tincd.8 b/doc/tincd.8.in similarity index 66% rename from doc/tincd.8 rename to doc/tincd.8.in index 831bbb1..8d134d0 100644 --- a/doc/tincd.8 +++ b/doc/tincd.8.in @@ -1,22 +1,25 @@ .Dd 2002-03-25 .Dt TINCD 8 .\" Manual page created by: -.\" Ivo Timmermans -.\" Guus Sliepen +.\" Ivo Timmermans +.\" Guus Sliepen .Sh NAME .Nm tincd .Nd tinc VPN daemon .Sh SYNOPSIS .Nm -.Op Fl cdDkKn -.Op Fl -bypass-security +.Op Fl cdDkKnL .Op Fl -config Ns = Ns Ar DIR -.Op Fl -debug Ns = Ns Ar LEVEL -.Op Fl -generate-keys Ns Op = Ns Ar BITS -.Op Fl -help -.Op Fl -kill Ns = Ns Ar SIGNAL -.Op Fl -net Ns = Ns Ar NETNAME .Op Fl -no-detach +.Op Fl -debug Ns Op = Ns Ar LEVEL +.Op Fl -kill Ns Op = Ns Ar SIGNAL +.Op Fl -net Ns = Ns Ar NETNAME +.Op Fl -generate-keys Ns Op = Ns Ar BITS +.Op Fl -mlock +.Op Fl -logfile Ns Op = Ns Ar FILE +.Op Fl -pidfile Ns = Ns Ar FILE +.Op Fl -bypass-security +.Op Fl -help .Op Fl -version .Sh DESCRIPTION This is the daemon of tinc, a secure virtual private network (VPN) project. @@ -31,37 +34,61 @@ If that succeeds, it will detach from the controlling terminal and continue in the background, accepting and setting up connections to other tinc daemons that are part of the virtual private network. +Under Windows (not Cygwin) tinc will install itself as a service, +which will be restarted automatically after reboots. .Sh OPTIONS .Bl -tag -width indent -.It Fl -bypass-security -Disables encryption and authentication. -Only useful for debugging. .It Fl c, -config Ns = Ns Ar DIR -Read configuration options from -.Ar DIR . +Read configuration files from +.Ar DIR +instead of +.Pa @sysconfdir@/tinc/ . +.It Fl D, -no-detach +Don't fork and detach. +This will also disable the automatic restart mechanism for fatal errors. +If not mentioned otherwise, this will show log messages on the standard error output. .It Fl d, -debug Ns Op = Ns Ar LEVEL Increase debug level or set it to .Ar LEVEL (see below). -.It Fl K, -generate-keys Ns Op = Ns Ar BITS -Generate public/private RSA keypair and exit. -If -.Ar BITS -is omitted, the default length will be 1024 bits. -.It Fl -help -Display short list of options. .It Fl k, -kill Ns Op = Ns Ar SIGNAL Attempt to kill a running .Nm (optionally with the specified .Ar SIGNAL instead of SIGTERM) and exit. +Under Windows (not Cygwin) the optional argument is ignored, +the service will always be stopped and removed. .It Fl n, -net Ns = Ns Ar NETNAME Connect to net .Ar NETNAME . -.It Fl D, -no-detach -Don't fork and detach. -This will also disable the automatic restart mechanism for fatal errors. +.It Fl K, -generate-keys Ns Op = Ns Ar BITS +Generate public/private RSA keypair and exit. +If +.Ar BITS +is omitted, the default length will be 1024 bits. +When saving keys to existing files, tinc will not delete the old keys, +you have to remove them manually. +.It Fl L, -mlock +Lock tinc into main memory. +This will prevent sensitive data like shared private keys to be written to the system swap files/partitions. +.It Fl -logfile Ns Op = Ns Ar FILE +Write log entries to a file instead of to the system logging facility. +If +.Ar FILE +is omitted, the default is +.Pa @localstatedir@/log/tinc. Ns Ar NETNAME Ns Pa .log. +.It Fl -pidfile Ns = Ns Ar FILE +Write PID to +.Ar FILE +instead of +.Pa @localstatedir@/run/tinc. Ns Ar NETNAME Ns Pa .pid. +Under Windows this option will be ignored. +.It Fl -bypass-security +Disables encryption and authentication of the meta protocol. +Only useful for debugging. +.It Fl -help +Display short list of options. .It Fl -version Output version information and exit. .El @@ -80,7 +107,11 @@ and if didn't succeed to connect to an uplink the first time after it started, it defaults to the maximum time of 15 minutes. .It HUP -Closes all connections, rereads the configuration file and restarts the daemon. +Partially rereads configuration files. +Connections to hosts whose host config file are removed are closed. +New outgoing connections specified in +.Pa tinc.conf +will be made. .It INT Temporarily increases debug level to 5. Send this signal again to revert to the original level. @@ -101,11 +132,11 @@ Each level inherits all messages of the previous level: This will log a message indicating .Nm has started along with a version number. -It will also any serious error. +It will also log any serious error. .It 1 This will log all connections that are made with other tinc daemons. .It 2 -This will log status and error messages from other tinc daemons. +This will log status and error messages from scripts and other tinc daemons. .It 3 This will log all requests that are exchanged with other tinc daemons. These include authentication, key exchange and connection list updates. @@ -116,29 +147,11 @@ This will log all network traffic over the virtual private network. .El .Sh FILES .Bl -tag -width indent -.It Pa /etc/tinc/ Ns Ar NETNAME Ns Pa /tinc.conf -The configuration file for -.Nm . -.It Pa /etc/tinc/ Ns Ar NETNAME Ns Pa /tinc-up -Script which is executed as soon as the virtual network device has been allocated. -Purpose is to further configure that device. -.It Pa /etc/tinc/ Ns Ar NETNAME Ns Pa /tinc-down -Script which is executed when -.Nm -exits. -Purpose is to cleanly shut down the virtual network device before it will be deallocated. -.It Pa /etc/tinc/ Ns Ar NETNAME Ns Pa /hosts/* -The directory containing the host configuration files -used to authenticate other tinc daemons. -.It Pa /etc/tinc/ Ns Ar NETNAME Ns Pa /hosts/ Ns Ar NAME Ns Pa -up -Script which is executed as soon as host -.Ar NAME -becomes reachable. -.It Pa /etc/tinc/ Ns Ar NETNAME Ns Pa /hosts/ Ns Ar NAME Ns Pa -down -Script which is executed as soon as host -.Ar NAME -becomes unreachable. -.It Pa /var/run/tinc. Ns Ar NETNAME Ns Pa .pid +.It Pa @sysconfdir@/tinc/ +Directory containing the configuration files tinc uses. +For more information, see +.Xr tinc.conf 5 . +.It Pa @localstatedir@/run/tinc. Ns Ar NETNAME Ns Pa .pid The PID of the currently running .Nm is stored in this file. @@ -150,12 +163,12 @@ option may not work correctly. .Pp .Sy The cryptography in tinc is not well tested yet. Use it at your own risk! .Pp -If you find any bugs, report them to tinc@nl.linux.org. +If you find any bugs, report them to tinc@tinc-vpn.org. .Sh TODO A lot, especially security auditing. .Sh SEE ALSO .Xr tinc.conf 5 , -.Pa http://tinc.nl.linux.org/ , +.Pa http://www.tinc-vpn.org/ , .Pa http://www.cabal.org/ . .Pp The full documentation for tinc is maintained as a Texinfo manual. @@ -168,7 +181,7 @@ tinc comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions; see the file COPYING for details. .Sh AUTHORS -.An "Ivo Timmermans" Aq itimmermans@bigfoot.com -.An "Guus Sliepen" Aq guus@sliepen.warande.net +.An "Ivo Timmermans" Aq ivo@tinc-vpn.org +.An "Guus Sliepen" Aq guus@tinc-vpn.org .Pp And thanks to many others for their contributions to tinc! diff --git a/doc/tincinclude.texi.in b/doc/tincinclude.texi.in new file mode 100644 index 0000000..da4adc5 --- /dev/null +++ b/doc/tincinclude.texi.in @@ -0,0 +1,4 @@ +@set VERSION @VERSION@ +@set PACKAGE @PACKAGE@ +@set sysconfdir @sysconfdir@ +@set localstatedir @localstatedir@ diff --git a/have.h b/have.h new file mode 100644 index 0000000..45acb36 --- /dev/null +++ b/have.h @@ -0,0 +1,164 @@ +/* + have.h -- include headers which are known to exist + Copyright (C) 1998-2004 Ivo Timmermans + 2003-2004 Guus Sliepen + + 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 __TINC_HAVE_H__ +#define __TINC_HAVE_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_STDBOOL_H +#include +#endif + +#ifdef HAVE_TERMIOS_H +#include +#endif + +#ifdef HAVE_INTTYPES_H +#include +#endif + +/* Include system specific headers */ + +#ifdef HAVE_SYSLOG_H +#include +#endif + +#ifdef HAVE_SYS_TIME_H +#include +#endif + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_SYS_STAT_H +#include +#endif + +#ifdef HAVE_SYS_FILE_H +#include +#endif + +#ifdef HAVE_SYS_WAIT_H +#include +#endif + +#ifdef HAVE_SYS_IOCTL_H +#include +#endif + +#ifdef HAVE_SYS_PARAM_H +#include +#endif + +#ifdef HAVE_SYS_UIO_H +#include +#endif + +/* SunOS really wants sys/socket.h BEFORE net/if.h, + and FreeBSD wants these lines below the rest. */ + +#ifdef HAVE_NETDB_H +#include +#endif + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#ifdef HAVE_NET_IF_H +#include +#endif + +#ifdef HAVE_NET_IF_TYPES_H +#include +#endif + +#ifdef HAVE_NET_IF_TUN_H +#include +#endif + +#ifdef HAVE_NET_IF_TAP_H +#include +#endif + +#ifdef HAVE_NETINET_IN_SYSTM_H +#include +#endif + +#ifdef HAVE_NETINET_IN_H +#include +#endif + +#ifdef HAVE_ARPA_INET_H +#include +#endif + +#ifdef HAVE_NETINET_IP_H +#include +#endif + +#ifdef HAVE_NETINET_TCP_H +#include +#endif + +#ifdef HAVE_NETINET_IN6_H +#include +#endif + +#ifdef HAVE_NETINET_IP6_H +#include +#endif + +#ifdef HAVE_NET_ETHERNET_H +#include +#endif + +#ifdef HAVE_NET_IF_ARP_H +#include +#endif + +#ifdef HAVE_NETINET_IP_ICMP_H +#include +#endif + +#ifdef HAVE_NETINET_ICMP6_H +#include +#endif + +#ifdef HAVE_NETINET_IF_ETHER_H +#include +#endif + +#ifdef HAVE_MINGW +#include +#include +#endif + +#endif /* __TINC_SYSTEM_H__ */ diff --git a/install-sh b/install-sh index e9de238..e4160c9 100755 --- a/install-sh +++ b/install-sh @@ -1,19 +1,38 @@ #!/bin/sh -# # install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). + +scriptversion=2004-04-01.17 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. # -# Copyright 1991 by the Massachusetts Institute of Technology +# Copyright (C) 1994 X Consortium # -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it @@ -23,13 +42,11 @@ # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. - # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" - # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" @@ -41,211 +58,268 @@ stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" -transformbasename="" -transform_arg="" +transformbasename= +transform_arg= instcmd="$mvprog" chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" +chowncmd= +chgrpcmd= +stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" -src="" -dst="" -dir_arg="" +src= +dst= +dir_arg= -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; +usage="Usage: $0 [OPTION]... SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 -d DIRECTORIES... - -d) dir_arg=true - shift - continue;; +In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default. +In the second, create the directory path DIR. - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; +Options: +-b=TRANSFORMBASENAME +-c copy source (using $cpprog) instead of moving (using $mvprog). +-d create directories instead of installing files. +-g GROUP $chgrp installed files to GROUP. +-m MODE $chmod installed files to MODE. +-o USER $chown installed files to USER. +-s strip installed files (using $stripprog). +-t=TRANSFORM +--help display this help and exit. +--version display version info and exit. - -o) chowncmd="$chownprog $2" - shift - shift - continue;; +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG +" - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; +while test -n "$1"; do + case $1 in + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; - -s) stripcmd="$stripprog" - shift - continue;; + -c) instcmd=$cpprog + shift + continue;; - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; + -d) dir_arg=true + shift + continue;; - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; + --help) echo "$usage"; exit 0;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + --version) echo "$0 $scriptversion"; exit 0;; + + *) # When -d is used, all remaining arguments are directories to create. + test -n "$dir_arg" && break + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done + break;; + esac +done + +if test -z "$1"; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src ;; + esac + + if test -n "$dir_arg"; then + dst=$src + src= + + if test -d "$dst"; then + instcmd=: + chmodcmd= + else + instcmd=$mkdirprog + fi + else + # Waiting for this to be detected by the "$instcmd $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dstarg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dstarg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst ;; esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + dst=$dst/`basename "$src"` + fi + fi + + # This sed command emulates the dirname command. + dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + + # Make sure that the destination directory exists. + + # Skip lots of stat calls in the usual case. + if test ! -d "$dstdir"; then + defaultIFS=' + ' + IFS="${IFS-$defaultIFS}" + + oIFS=$IFS + # Some sh's can't handle IFS=/ for some reason. + IFS='%' + set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` + IFS=$oIFS + + pathcomp= + + while test $# -ne 0 ; do + pathcomp=$pathcomp$1 + shift + if test ! -d "$pathcomp"; then + $mkdirprog "$pathcomp" || lasterr=$? + # mkdir can fail with a `File exist' error in case several + # install-sh are creating the directory concurrently. This + # is OK. + test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; } + fi + pathcomp=$pathcomp/ + done + fi + + if test -n "$dir_arg"; then + $doit $instcmd "$dst" \ + && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } + + else + # If we're going to rename the final executable, determine the name now. + if test -z "$transformarg"; then + dstfile=`basename "$dst"` + else + dstfile=`basename "$dst" $transformbasename \ + | sed $transformarg`$transformbasename + fi + + # don't allow the sed command to completely eliminate the filename. + test -z "$dstfile" && dstfile=`basename "$dst"` + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 + trap '(exit $?); exit' 1 2 13 15 + + # Move or copy the file name to the temp name + $doit $instcmd "$src" "$dsttmp" && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $instcmd $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + + # Now rename the file to the real destination. + { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ + || { + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + if test -f "$dstdir/$dstfile"; then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ + || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + || { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + } + } + fi || { (exit 1); exit; } done -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi +# The final little trick to "correctly" pass the exit status to the exit trap. +{ + (exit 0); exit +} -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - chmodcmd="" - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/intl/ChangeLog b/intl/ChangeLog deleted file mode 100644 index 84e2b37..0000000 --- a/intl/ChangeLog +++ /dev/null @@ -1,4 +0,0 @@ -2001-09-13 GNU - - * Version 0.10.40 released. - diff --git a/intl/Makefile.in b/intl/Makefile.in deleted file mode 100644 index 19ed4a7..0000000 --- a/intl/Makefile.in +++ /dev/null @@ -1,313 +0,0 @@ -# Makefile for directory with message catalog handling in GNU NLS Utilities. -# Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU Library General Public License as published -# by the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Library General Public License for more details. -# -# You should have received a copy of the GNU Library 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. - -PACKAGE = @PACKAGE@ -VERSION = @VERSION@ - -SHELL = /bin/sh - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -top_builddir = .. -VPATH = @srcdir@ - -prefix = @prefix@ -exec_prefix = @exec_prefix@ -transform = @program_transform_name@ -libdir = @libdir@ -includedir = @includedir@ -datadir = @datadir@ -localedir = $(datadir)/locale -gettextsrcdir = $(datadir)/gettext/intl -aliaspath = $(localedir) -subdir = intl - -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac` - -l = @INTL_LIBTOOL_SUFFIX_PREFIX@ - -AR = ar -CC = @CC@ -LIBTOOL = @LIBTOOL@ -RANLIB = @RANLIB@ -YACC = @INTLBISON@ -y -d -YFLAGS = --name-prefix=__gettext - -DEFS = -DLOCALEDIR=\"$(localedir)\" -DLOCALE_ALIAS_PATH=\"$(aliaspath)\" \ --DLIBDIR=\"$(libdir)\" @DEFS@ -CPPFLAGS = @CPPFLAGS@ -CFLAGS = @CFLAGS@ -LDFLAGS = @LDFLAGS@ - -COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) - -HEADERS = $(COMHDRS) libgnuintl.h libgettext.h loadinfo.h -COMHDRS = gettext.h gettextP.h hash-string.h -SOURCES = $(COMSRCS) intl-compat.c -COMSRCS = bindtextdom.c dcgettext.c dgettext.c gettext.c \ -finddomain.c loadmsgcat.c localealias.c textdomain.c l10nflist.c \ -explodename.c dcigettext.c dcngettext.c dngettext.c ngettext.c plural.y \ -localcharset.c -OBJECTS = @INTLOBJS@ bindtextdom.$lo dcgettext.$lo dgettext.$lo gettext.$lo \ -finddomain.$lo loadmsgcat.$lo localealias.$lo textdomain.$lo l10nflist.$lo \ -explodename.$lo dcigettext.$lo dcngettext.$lo dngettext.$lo ngettext.$lo \ -plural.$lo localcharset.$lo -GETTOBJS = intl-compat.$lo -DISTFILES.common = Makefile.in \ -config.charset locale.alias ref-add.sin ref-del.sin $(HEADERS) $(SOURCES) -DISTFILES.generated = plural.c -DISTFILES.normal = VERSION -DISTFILES.gettext = COPYING.LIB-2 COPYING.LIB-2.1 libintl.glibc -DISTFILES.obsolete = xopen-msg.sed linux-msg.sed po2tbl.sed.in cat-compat.c - -# Libtool's library version information for libintl. -# Before making a gettext release, the gettext maintainer must change this -# according to the libtool documentation, section "Library interface versions". -# Maintainers of other packages that include the intl directory must *not* -# change these values. -LTV_CURRENT=1 -LTV_REVISION=1 -LTV_AGE=0 - -.SUFFIXES: -.SUFFIXES: .c .y .o .lo .sin .sed -.c.o: - $(COMPILE) $< -.c.lo: - $(LIBTOOL) --mode=compile $(COMPILE) $< - -.y.c: - $(YACC) $(YFLAGS) --output $@ $< - rm -f $*.h - -.sin.sed: - sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $< > t-$@ - mv t-$@ $@ - -INCLUDES = -I.. -I. -I$(top_srcdir)/intl - -all: all-@USE_INCLUDED_LIBINTL@ -all-yes: libintl.$la libintl.h charset.alias ref-add.sed ref-del.sed -all-no: all-no-@BUILD_INCLUDED_LIBINTL@ -all-no-yes: libgnuintl.$la -all-no-no: - -libintl.a libgnuintl.a: $(OBJECTS) - rm -f $@ - $(AR) cru $@ $(OBJECTS) - $(RANLIB) $@ - -libintl.la libgnuintl.la: $(OBJECTS) - $(LIBTOOL) --mode=link \ - $(CC) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) $(LDFLAGS) -o $@ \ - $(OBJECTS) @LIBICONV@ \ - -version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \ - -rpath $(libdir) \ - -no-undefined - -libintl.h: libgnuintl.h - cp $(srcdir)/libgnuintl.h libintl.h - -charset.alias: config.charset - $(SHELL) $(srcdir)/config.charset '@host@' > t-$@ - mv t-$@ $@ - -check: all - -# This installation goal is only used in GNU gettext. Packages which -# only use the library should use install instead. - -# We must not install the libintl.h/libintl.a files if we are on a -# system which has the GNU gettext() function in its C library or in a -# separate library. -# If you want to use the one which comes with this version of the -# package, you have to use `configure --with-included-gettext'. -install: install-exec install-data -install-exec: all - if test "$(PACKAGE)" = "gettext" \ - && test '@INTLOBJS@' = '$(GETTOBJS)'; then \ - $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \ - $(INSTALL_DATA) libintl.h $(DESTDIR)$(includedir)/libintl.h; \ - $(LIBTOOL) --mode=install \ - $(INSTALL_DATA) libintl.$la $(DESTDIR)$(libdir)/libintl.$la; \ - else \ - : ; \ - fi - if test '@USE_INCLUDED_LIBINTL@' = yes; then \ - $(mkinstalldirs) $(DESTDIR)$(libdir); \ - temp=$(DESTDIR)$(libdir)/t-charset.alias; \ - dest=$(DESTDIR)$(libdir)/charset.alias; \ - if test -f $(DESTDIR)$(libdir)/charset.alias; then \ - orig=$(DESTDIR)$(libdir)/charset.alias; \ - sed -f ref-add.sed $$orig > $$temp; \ - $(INSTALL_DATA) $$temp $$dest; \ - rm -f $$temp; \ - else \ - if test @GLIBC21@ = no; then \ - orig=charset.alias; \ - sed -f ref-add.sed $$orig > $$temp; \ - $(INSTALL_DATA) $$temp $$dest; \ - rm -f $$temp; \ - fi; \ - fi; \ - $(mkinstalldirs) $(DESTDIR)$(localedir); \ - test -f $(DESTDIR)$(localedir)/locale.alias \ - && orig=$(DESTDIR)$(localedir)/locale.alias \ - || orig=$(srcdir)/locale.alias; \ - temp=$(DESTDIR)$(localedir)/t-locale.alias; \ - dest=$(DESTDIR)$(localedir)/locale.alias; \ - sed -f ref-add.sed $$orig > $$temp; \ - $(INSTALL_DATA) $$temp $$dest; \ - rm -f $$temp; \ - else \ - : ; \ - fi -install-data: all - if test "$(PACKAGE)" = "gettext"; then \ - $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ - $(INSTALL_DATA) VERSION $(DESTDIR)$(gettextsrcdir)/VERSION; \ - $(INSTALL_DATA) ChangeLog.inst $(DESTDIR)$(gettextsrcdir)/ChangeLog; \ - dists="COPYING.LIB-2 COPYING.LIB-2.1 $(DISTFILES.common)"; \ - for file in $$dists; do \ - $(INSTALL_DATA) $(srcdir)/$$file \ - $(DESTDIR)$(gettextsrcdir)/$$file; \ - done; \ - chmod a+x $(DESTDIR)$(gettextsrcdir)/config.charset; \ - dists="$(DISTFILES.generated)"; \ - for file in $$dists; do \ - if test -f $$file; then dir=.; else dir=$(srcdir); fi; \ - $(INSTALL_DATA) $$dir/$$file \ - $(DESTDIR)$(gettextsrcdir)/$$file; \ - done; \ - dists="$(DISTFILES.obsolete)"; \ - for file in $$dists; do \ - rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ - done; \ - else \ - : ; \ - fi - -# Define this as empty until I found a useful application. -installcheck: - -uninstall: - if test "$(PACKAGE)" = "gettext" \ - && test '@INTLOBJS@' = '$(GETTOBJS)'; then \ - rm -f $(DESTDIR)$(includedir)/libintl.h; \ - $(LIBTOOL) --mode=uninstall \ - rm -f $(DESTDIR)$(libdir)/libintl.$la; \ - else \ - : ; \ - fi - if test '@USE_INCLUDED_LIBINTL@' = yes; then \ - if test -f $(DESTDIR)$(libdir)/charset.alias; then \ - temp=$(DESTDIR)$(libdir)/t-charset.alias; \ - dest=$(DESTDIR)$(libdir)/charset.alias; \ - sed -f ref-del.sed $$dest > $$temp; \ - if grep '^# Packages using this file: $$' $$temp > /dev/null; then \ - rm -f $$dest; \ - else \ - $(INSTALL_DATA) $$temp $$dest; \ - fi; \ - rm -f $$temp; \ - fi; \ - if test -f $(DESTDIR)$(localedir)/locale.alias; then \ - temp=$(DESTDIR)$(localedir)/t-locale.alias; \ - dest=$(DESTDIR)$(localedir)/locale.alias; \ - sed -f ref-del.sed $$dest > $$temp; \ - if grep '^# Packages using this file: $$' $$temp > /dev/null; then \ - rm -f $$dest; \ - else \ - $(INSTALL_DATA) $$temp $$dest; \ - fi; \ - rm -f $$temp; \ - fi; \ - else \ - : ; \ - fi - if test "$(PACKAGE)" = "gettext"; then \ - for file in VERSION ChangeLog COPYING.LIB-2 COPYING.LIB-2.1 $(DISTFILES.common) $(DISTFILES.generated); do \ - rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ - done; \ - else \ - : ; \ - fi - -info dvi: - -$(OBJECTS): ../config.h libgnuintl.h -bindtextdom.$lo finddomain.$lo loadmsgcat.$lo: gettextP.h gettext.h loadinfo.h -dcgettext.$lo: gettextP.h gettext.h hash-string.h loadinfo.h - -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) - here=`pwd`; cd $(srcdir) && etags -o $$here/TAGS $(HEADERS) $(SOURCES) - -id: ID - -ID: $(HEADERS) $(SOURCES) - here=`pwd`; cd $(srcdir) && mkid -f$$here/ID $(HEADERS) $(SOURCES) - - -mostlyclean: - rm -f *.a *.la *.o *.lo core core.* - rm -f libintl.h charset.alias ref-add.sed ref-del.sed - rm -f -r .libs _libs - -clean: mostlyclean - -distclean: clean - rm -f Makefile ID TAGS - if test "$(PACKAGE)" = gettext; then \ - rm -f ChangeLog.inst $(DISTFILES.normal); \ - else \ - : ; \ - fi - -maintainer-clean: distclean - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - - -# GNU gettext needs not contain the file `VERSION' but contains some -# other files which should not be distributed in other packages. -distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) -dist distdir: Makefile - if test "$(PACKAGE)" = gettext; then \ - additional="$(DISTFILES.gettext)"; \ - else \ - additional="$(DISTFILES.normal)"; \ - fi; \ - $(MAKE) $(DISTFILES.common) $(DISTFILES.generated) $$additional; \ - for file in ChangeLog $(DISTFILES.common) $(DISTFILES.generated) $$additional; do \ - if test -f $$file; then dir=.; else dir=$(srcdir); fi; \ - ln $$dir/$$file $(distdir) 2> /dev/null \ - || cp -p $$dir/$$file $(distdir); \ - done - -Makefile: Makefile.in ../config.status - cd .. \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - -# Tell versions [3.59,3.63) of GNU make not to export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/intl/VERSION b/intl/VERSION deleted file mode 100644 index cb8a01a..0000000 --- a/intl/VERSION +++ /dev/null @@ -1 +0,0 @@ -GNU gettext library from gettext-0.10.40 diff --git a/intl/bindtextdom.c b/intl/bindtextdom.c deleted file mode 100644 index c6a9bd1..0000000 --- a/intl/bindtextdom.c +++ /dev/null @@ -1,369 +0,0 @@ -/* Implementation of the bindtextdomain(3) function - Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include - -#ifdef _LIBC -# include -#else -# include "libgnuintl.h" -#endif -#include "gettextP.h" - -#ifdef _LIBC -/* We have to handle multi-threaded applications. */ -# include -#else -/* Provide dummy implementation if this is outside glibc. */ -# define __libc_rwlock_define(CLASS, NAME) -# define __libc_rwlock_wrlock(NAME) -# define __libc_rwlock_unlock(NAME) -#endif - -/* The internal variables in the standalone libintl.a must have different - names than the internal variables in GNU libc, otherwise programs - using libintl.a cannot be linked statically. */ -#if !defined _LIBC -# define _nl_default_dirname _nl_default_dirname__ -# define _nl_domain_bindings _nl_domain_bindings__ -#endif - -/* Some compilers, like SunOS4 cc, don't have offsetof in . */ -#ifndef offsetof -# define offsetof(type,ident) ((size_t)&(((type*)0)->ident)) -#endif - -/* @@ end of prolog @@ */ - -/* Contains the default location of the message catalogs. */ -extern const char _nl_default_dirname[]; - -/* List with bindings of specific domains. */ -extern struct binding *_nl_domain_bindings; - -/* Lock variable to protect the global data in the gettext implementation. */ -__libc_rwlock_define (extern, _nl_state_lock) - - -/* Names for the libintl functions are a problem. They must not clash - with existing names and they should follow ANSI C. But this source - code is also used in GNU C Library where the names have a __ - prefix. So we have to make a difference here. */ -#ifdef _LIBC -# define BINDTEXTDOMAIN __bindtextdomain -# define BIND_TEXTDOMAIN_CODESET __bind_textdomain_codeset -# ifndef strdup -# define strdup(str) __strdup (str) -# endif -#else -# define BINDTEXTDOMAIN bindtextdomain__ -# define BIND_TEXTDOMAIN_CODESET bind_textdomain_codeset__ -#endif - -/* Prototypes for local functions. */ -static void set_binding_values PARAMS ((const char *domainname, - const char **dirnamep, - const char **codesetp)); - -/* Specifies the directory name *DIRNAMEP and the output codeset *CODESETP - to be used for the DOMAINNAME message catalog. - If *DIRNAMEP or *CODESETP is NULL, the corresponding attribute is not - modified, only the current value is returned. - If DIRNAMEP or CODESETP is NULL, the corresponding attribute is neither - modified nor returned. */ -static void -set_binding_values (domainname, dirnamep, codesetp) - const char *domainname; - const char **dirnamep; - const char **codesetp; -{ - struct binding *binding; - int modified; - - /* Some sanity checks. */ - if (domainname == NULL || domainname[0] == '\0') - { - if (dirnamep) - *dirnamep = NULL; - if (codesetp) - *codesetp = NULL; - return; - } - - __libc_rwlock_wrlock (_nl_state_lock); - - modified = 0; - - for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next) - { - int compare = strcmp (domainname, binding->domainname); - if (compare == 0) - /* We found it! */ - break; - if (compare < 0) - { - /* It is not in the list. */ - binding = NULL; - break; - } - } - - if (binding != NULL) - { - if (dirnamep) - { - const char *dirname = *dirnamep; - - if (dirname == NULL) - /* The current binding has be to returned. */ - *dirnamep = binding->dirname; - else - { - /* The domain is already bound. If the new value and the old - one are equal we simply do nothing. Otherwise replace the - old binding. */ - char *result = binding->dirname; - if (strcmp (dirname, result) != 0) - { - if (strcmp (dirname, _nl_default_dirname) == 0) - result = (char *) _nl_default_dirname; - else - { -#if defined _LIBC || defined HAVE_STRDUP - result = strdup (dirname); -#else - size_t len = strlen (dirname) + 1; - result = (char *) malloc (len); - if (__builtin_expect (result != NULL, 1)) - memcpy (result, dirname, len); -#endif - } - - if (__builtin_expect (result != NULL, 1)) - { - if (binding->dirname != _nl_default_dirname) - free (binding->dirname); - - binding->dirname = result; - modified = 1; - } - } - *dirnamep = result; - } - } - - if (codesetp) - { - const char *codeset = *codesetp; - - if (codeset == NULL) - /* The current binding has be to returned. */ - *codesetp = binding->codeset; - else - { - /* The domain is already bound. If the new value and the old - one are equal we simply do nothing. Otherwise replace the - old binding. */ - char *result = binding->codeset; - if (result == NULL || strcmp (codeset, result) != 0) - { -#if defined _LIBC || defined HAVE_STRDUP - result = strdup (codeset); -#else - size_t len = strlen (codeset) + 1; - result = (char *) malloc (len); - if (__builtin_expect (result != NULL, 1)) - memcpy (result, codeset, len); -#endif - - if (__builtin_expect (result != NULL, 1)) - { - if (binding->codeset != NULL) - free (binding->codeset); - - binding->codeset = result; - binding->codeset_cntr++; - modified = 1; - } - } - *codesetp = result; - } - } - } - else if ((dirnamep == NULL || *dirnamep == NULL) - && (codesetp == NULL || *codesetp == NULL)) - { - /* Simply return the default values. */ - if (dirnamep) - *dirnamep = _nl_default_dirname; - if (codesetp) - *codesetp = NULL; - } - else - { - /* We have to create a new binding. */ - size_t len = strlen (domainname) + 1; - struct binding *new_binding = - (struct binding *) malloc (offsetof (struct binding, domainname) + len); - - if (__builtin_expect (new_binding == NULL, 0)) - goto failed; - - memcpy (new_binding->domainname, domainname, len); - - if (dirnamep) - { - const char *dirname = *dirnamep; - - if (dirname == NULL) - /* The default value. */ - dirname = _nl_default_dirname; - else - { - if (strcmp (dirname, _nl_default_dirname) == 0) - dirname = _nl_default_dirname; - else - { - char *result; -#if defined _LIBC || defined HAVE_STRDUP - result = strdup (dirname); - if (__builtin_expect (result == NULL, 0)) - goto failed_dirname; -#else - size_t len = strlen (dirname) + 1; - result = (char *) malloc (len); - if (__builtin_expect (result == NULL, 0)) - goto failed_dirname; - memcpy (result, dirname, len); -#endif - dirname = result; - } - } - *dirnamep = dirname; - new_binding->dirname = (char *) dirname; - } - else - /* The default value. */ - new_binding->dirname = (char *) _nl_default_dirname; - - new_binding->codeset_cntr = 0; - - if (codesetp) - { - const char *codeset = *codesetp; - - if (codeset != NULL) - { - char *result; - -#if defined _LIBC || defined HAVE_STRDUP - result = strdup (codeset); - if (__builtin_expect (result == NULL, 0)) - goto failed_codeset; -#else - size_t len = strlen (codeset) + 1; - result = (char *) malloc (len); - if (__builtin_expect (result == NULL, 0)) - goto failed_codeset; - memcpy (result, codeset, len); -#endif - codeset = result; - new_binding->codeset_cntr++; - } - *codesetp = codeset; - new_binding->codeset = (char *) codeset; - } - else - new_binding->codeset = NULL; - - /* Now enqueue it. */ - if (_nl_domain_bindings == NULL - || strcmp (domainname, _nl_domain_bindings->domainname) < 0) - { - new_binding->next = _nl_domain_bindings; - _nl_domain_bindings = new_binding; - } - else - { - binding = _nl_domain_bindings; - while (binding->next != NULL - && strcmp (domainname, binding->next->domainname) > 0) - binding = binding->next; - - new_binding->next = binding->next; - binding->next = new_binding; - } - - modified = 1; - - /* Here we deal with memory allocation failures. */ - if (0) - { - failed_codeset: - if (new_binding->dirname != _nl_default_dirname) - free (new_binding->dirname); - failed_dirname: - free (new_binding); - failed: - if (dirnamep) - *dirnamep = NULL; - if (codesetp) - *codesetp = NULL; - } - } - - /* If we modified any binding, we flush the caches. */ - if (modified) - ++_nl_msg_cat_cntr; - - __libc_rwlock_unlock (_nl_state_lock); -} - -/* Specify that the DOMAINNAME message catalog will be found - in DIRNAME rather than in the system locale data base. */ -char * -BINDTEXTDOMAIN (domainname, dirname) - const char *domainname; - const char *dirname; -{ - set_binding_values (domainname, &dirname, NULL); - return (char *) dirname; -} - -/* Specify the character encoding in which the messages from the - DOMAINNAME message catalog will be returned. */ -char * -BIND_TEXTDOMAIN_CODESET (domainname, codeset) - const char *domainname; - const char *codeset; -{ - set_binding_values (domainname, NULL, &codeset); - return (char *) codeset; -} - -#ifdef _LIBC -/* Aliases for function names in GNU C Library. */ -weak_alias (__bindtextdomain, bindtextdomain); -weak_alias (__bind_textdomain_codeset, bind_textdomain_codeset); -#endif diff --git a/intl/config.charset b/intl/config.charset deleted file mode 100755 index f4f2611..0000000 --- a/intl/config.charset +++ /dev/null @@ -1,438 +0,0 @@ -#! /bin/sh -# Output a system dependent table of character encoding aliases. -# -# Copyright (C) 2000-2001 Free Software Foundation, Inc. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU Library General Public License as published -# by the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Library General Public License for more details. -# -# You should have received a copy of the GNU Library 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. -# -# The table consists of lines of the form -# ALIAS CANONICAL -# -# ALIAS is the (system dependent) result of "nl_langinfo (CODESET)". -# ALIAS is compared in a case sensitive way. -# -# CANONICAL is the GNU canonical name for this character encoding. -# It must be an encoding supported by libiconv. Support by GNU libc is -# also desirable. CANONICAL is case insensitive. Usually an upper case -# MIME charset name is preferred. -# The current list of GNU canonical charset names is as follows. -# -# name used by which systems a MIME name? -# ASCII, ANSI_X3.4-1968 glibc solaris freebsd -# ISO-8859-1 glibc aix hpux irix osf solaris freebsd yes -# ISO-8859-2 glibc aix hpux irix osf solaris freebsd yes -# ISO-8859-3 glibc yes -# ISO-8859-4 osf solaris freebsd yes -# ISO-8859-5 glibc aix hpux irix osf solaris freebsd yes -# ISO-8859-6 glibc aix hpux solaris yes -# ISO-8859-7 glibc aix hpux irix osf solaris yes -# ISO-8859-8 glibc aix hpux osf solaris yes -# ISO-8859-9 glibc aix hpux irix osf solaris yes -# ISO-8859-13 glibc -# ISO-8859-15 glibc aix osf solaris freebsd -# KOI8-R glibc solaris freebsd yes -# KOI8-U glibc freebsd yes -# CP437 dos -# CP775 dos -# CP850 aix osf dos -# CP852 dos -# CP855 dos -# CP856 aix -# CP857 dos -# CP861 dos -# CP862 dos -# CP864 dos -# CP865 dos -# CP866 freebsd dos -# CP869 dos -# CP874 win32 dos -# CP922 aix -# CP932 aix win32 dos -# CP943 aix -# CP949 osf win32 dos -# CP950 win32 dos -# CP1046 aix -# CP1124 aix -# CP1129 aix -# CP1250 win32 -# CP1251 glibc win32 -# CP1252 aix win32 -# CP1253 win32 -# CP1254 win32 -# CP1255 win32 -# CP1256 win32 -# CP1257 win32 -# GB2312 glibc aix hpux irix solaris freebsd yes -# EUC-JP glibc aix hpux irix osf solaris freebsd yes -# EUC-KR glibc aix hpux irix osf solaris freebsd yes -# EUC-TW glibc aix hpux irix osf solaris -# BIG5 glibc aix hpux osf solaris freebsd yes -# BIG5-HKSCS glibc -# GBK aix osf win32 dos -# GB18030 glibc -# SHIFT_JIS hpux osf solaris freebsd yes -# JOHAB glibc win32 -# TIS-620 glibc aix hpux osf solaris -# VISCII glibc yes -# HP-ROMAN8 hpux -# HP-ARABIC8 hpux -# HP-GREEK8 hpux -# HP-HEBREW8 hpux -# HP-TURKISH8 hpux -# HP-KANA8 hpux -# DEC-KANJI osf -# DEC-HANYU osf -# UTF-8 glibc aix hpux osf solaris yes -# -# Note: Names which are not marked as being a MIME name should not be used in -# Internet protocols for information interchange (mail, news, etc.). -# -# Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications -# must understand both names and treat them as equivalent. -# -# The first argument passed to this file is the canonical host specification, -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM - -host="$1" -os=`echo "$host" | sed -e 's/^[^-]*-[^-]*-\(.*\)$/\1/'` -echo "# This file contains a table of character encoding aliases," -echo "# suitable for operating system '${os}'." -echo "# It was automatically generated from config.charset." -# List of references, updated during installation: -echo "# Packages using this file: " -case "$os" in - linux* | *-gnu*) - # With glibc-2.1 or newer, we don't need any canonicalization, - # because glibc has iconv and both glibc and libiconv support all - # GNU canonical names directly. Therefore, the Makefile does not - # need to install the alias file at all. - # The following applies only to glibc-2.0.x and older libcs. - echo "ISO_646.IRV:1983 ASCII" - ;; - aix*) - echo "ISO8859-1 ISO-8859-1" - echo "ISO8859-2 ISO-8859-2" - echo "ISO8859-5 ISO-8859-5" - echo "ISO8859-6 ISO-8859-6" - echo "ISO8859-7 ISO-8859-7" - echo "ISO8859-8 ISO-8859-8" - echo "ISO8859-9 ISO-8859-9" - echo "ISO8859-15 ISO-8859-15" - echo "IBM-850 CP850" - echo "IBM-856 CP856" - echo "IBM-921 ISO-8859-13" - echo "IBM-922 CP922" - echo "IBM-932 CP932" - echo "IBM-943 CP943" - echo "IBM-1046 CP1046" - echo "IBM-1124 CP1124" - echo "IBM-1129 CP1129" - echo "IBM-1252 CP1252" - echo "IBM-eucCN GB2312" - echo "IBM-eucJP EUC-JP" - echo "IBM-eucKR EUC-KR" - echo "IBM-eucTW EUC-TW" - echo "big5 BIG5" - echo "GBK GBK" - echo "TIS-620 TIS-620" - echo "UTF-8 UTF-8" - ;; - hpux*) - echo "iso88591 ISO-8859-1" - echo "iso88592 ISO-8859-2" - echo "iso88595 ISO-8859-5" - echo "iso88596 ISO-8859-6" - echo "iso88597 ISO-8859-7" - echo "iso88598 ISO-8859-8" - echo "iso88599 ISO-8859-9" - echo "iso885915 ISO-8859-15" - echo "roman8 HP-ROMAN8" - echo "arabic8 HP-ARABIC8" - echo "greek8 HP-GREEK8" - echo "hebrew8 HP-HEBREW8" - echo "turkish8 HP-TURKISH8" - echo "kana8 HP-KANA8" - echo "tis620 TIS-620" - echo "big5 BIG5" - echo "eucJP EUC-JP" - echo "eucKR EUC-KR" - echo "eucTW EUC-TW" - echo "hp15CN GB2312" - #echo "ccdc ?" # what is this? - echo "SJIS SHIFT_JIS" - echo "utf8 UTF-8" - ;; - irix*) - echo "ISO8859-1 ISO-8859-1" - echo "ISO8859-2 ISO-8859-2" - echo "ISO8859-5 ISO-8859-5" - echo "ISO8859-7 ISO-8859-7" - echo "ISO8859-9 ISO-8859-9" - echo "eucCN GB2312" - echo "eucJP EUC-JP" - echo "eucKR EUC-KR" - echo "eucTW EUC-TW" - ;; - osf*) - echo "ISO8859-1 ISO-8859-1" - echo "ISO8859-2 ISO-8859-2" - echo "ISO8859-4 ISO-8859-4" - echo "ISO8859-5 ISO-8859-5" - echo "ISO8859-7 ISO-8859-7" - echo "ISO8859-8 ISO-8859-8" - echo "ISO8859-9 ISO-8859-9" - echo "ISO8859-15 ISO-8859-15" - echo "cp850 CP850" - echo "big5 BIG5" - echo "dechanyu DEC-HANYU" - echo "dechanzi GB2312" - echo "deckanji DEC-KANJI" - echo "deckorean EUC-KR" - echo "eucJP EUC-JP" - echo "eucKR EUC-KR" - echo "eucTW EUC-TW" - echo "GBK GBK" - echo "KSC5601 CP949" - echo "sdeckanji EUC-JP" - echo "SJIS SHIFT_JIS" - echo "TACTIS TIS-620" - echo "UTF-8 UTF-8" - ;; - solaris*) - echo "646 ASCII" - echo "ISO8859-1 ISO-8859-1" - echo "ISO8859-2 ISO-8859-2" - echo "ISO8859-4 ISO-8859-4" - echo "ISO8859-5 ISO-8859-5" - echo "ISO8859-6 ISO-8859-6" - echo "ISO8859-7 ISO-8859-7" - echo "ISO8859-8 ISO-8859-8" - echo "ISO8859-9 ISO-8859-9" - echo "ISO8859-15 ISO-8859-15" - echo "koi8-r KOI8-R" - echo "BIG5 BIG5" - echo "gb2312 GB2312" - echo "cns11643 EUC-TW" - echo "5601 EUC-KR" - echo "eucJP EUC-JP" - echo "PCK SHIFT_JIS" - echo "TIS620.2533 TIS-620" - #echo "sun_eu_greek ?" # what is this? - echo "UTF-8 UTF-8" - ;; - freebsd*) - # FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore - # localcharset.c falls back to using the full locale name - # from the environment variables. - echo "C ASCII" - echo "US-ASCII ASCII" - for l in la_LN lt_LN; do - echo "$l.ASCII ASCII" - done - for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \ - fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \ - lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do - echo "$l.ISO_8859-1 ISO-8859-1" - echo "$l.DIS_8859-15 ISO-8859-15" - done - for l in cs_CZ hr_HR hu_HU la_LN lt_LN pl_PL sl_SI; do - echo "$l.ISO_8859-2 ISO-8859-2" - done - for l in la_LN lt_LT; do - echo "$l.ISO_8859-4 ISO-8859-4" - done - for l in ru_RU ru_SU; do - echo "$l.KOI8-R KOI8-R" - echo "$l.ISO_8859-5 ISO-8859-5" - echo "$l.CP866 CP866" - done - echo "uk_UA.KOI8-U KOI8-U" - echo "zh_TW.BIG5 BIG5" - echo "zh_TW.Big5 BIG5" - echo "zh_CN.EUC GB2312" - echo "ja_JP.EUC EUC-JP" - echo "ja_JP.SJIS SHIFT_JIS" - echo "ja_JP.Shift_JIS SHIFT_JIS" - echo "ko_KR.EUC EUC-KR" - ;; - beos*) - # BeOS has a single locale, and it has UTF-8 encoding. - echo "* UTF-8" - ;; - msdosdjgpp*) - # DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore - # localcharset.c falls back to using the full locale name - # from the environment variables. - echo "#" - echo "# The encodings given here may not all be correct." - echo "# If you find that the encoding given for your language and" - echo "# country is not the one your DOS machine actually uses, just" - echo "# correct it in this file, and send a mail to" - echo "# Juan Manuel Guerrero " - echo "# and Bruno Haible ." - echo "#" - echo "C ASCII" - # ISO-8859-1 languages - echo "ca CP850" - echo "ca_ES CP850" - echo "da CP865" # not CP850 ?? - echo "da_DK CP865" # not CP850 ?? - echo "de CP850" - echo "de_AT CP850" - echo "de_CH CP850" - echo "de_DE CP850" - echo "en CP850" - echo "en_AU CP850" # not CP437 ?? - echo "en_CA CP850" - echo "en_GB CP850" - echo "en_NZ CP437" - echo "en_US CP437" - echo "en_ZA CP850" # not CP437 ?? - echo "es CP850" - echo "es_AR CP850" - echo "es_BO CP850" - echo "es_CL CP850" - echo "es_CO CP850" - echo "es_CR CP850" - echo "es_CU CP850" - echo "es_DO CP850" - echo "es_EC CP850" - echo "es_ES CP850" - echo "es_GT CP850" - echo "es_HN CP850" - echo "es_MX CP850" - echo "es_NI CP850" - echo "es_PA CP850" - echo "es_PY CP850" - echo "es_PE CP850" - echo "es_SV CP850" - echo "es_UY CP850" - echo "es_VE CP850" - echo "et CP850" - echo "et_EE CP850" - echo "eu CP850" - echo "eu_ES CP850" - echo "fi CP850" - echo "fi_FI CP850" - echo "fr CP850" - echo "fr_BE CP850" - echo "fr_CA CP850" - echo "fr_CH CP850" - echo "fr_FR CP850" - echo "ga CP850" - echo "ga_IE CP850" - echo "gd CP850" - echo "gd_GB CP850" - echo "gl CP850" - echo "gl_ES CP850" - echo "id CP850" # not CP437 ?? - echo "id_ID CP850" # not CP437 ?? - echo "is CP861" # not CP850 ?? - echo "is_IS CP861" # not CP850 ?? - echo "it CP850" - echo "it_CH CP850" - echo "it_IT CP850" - echo "lt CP775" - echo "lt_LT CP775" - echo "lv CP775" - echo "lv_LV CP775" - echo "nb CP865" # not CP850 ?? - echo "nb_NO CP865" # not CP850 ?? - echo "nl CP850" - echo "nl_BE CP850" - echo "nl_NL CP850" - echo "nn CP865" # not CP850 ?? - echo "nn_NO CP865" # not CP850 ?? - echo "no CP865" # not CP850 ?? - echo "no_NO CP865" # not CP850 ?? - echo "pt CP850" - echo "pt_BR CP850" - echo "pt_PT CP850" - echo "sv CP850" - echo "sv_SE CP850" - # ISO-8859-2 languages - echo "cs CP852" - echo "cs_CZ CP852" - echo "hr CP852" - echo "hr_HR CP852" - echo "hu CP852" - echo "hu_HU CP852" - echo "pl CP852" - echo "pl_PL CP852" - echo "ro CP852" - echo "ro_RO CP852" - echo "sk CP852" - echo "sk_SK CP852" - echo "sl CP852" - echo "sl_SI CP852" - echo "sq CP852" - echo "sq_AL CP852" - echo "sr CP852" # CP852 or CP866 or CP855 ?? - echo "sr_YU CP852" # CP852 or CP866 or CP855 ?? - # ISO-8859-3 languages - echo "mt CP850" - echo "mt_MT CP850" - # ISO-8859-5 languages - echo "be CP866" - echo "be_BE CP866" - echo "bg CP866" # not CP855 ?? - echo "bg_BG CP866" # not CP855 ?? - echo "mk CP866" # not CP855 ?? - echo "mk_MK CP866" # not CP855 ?? - echo "ru KOI8-R" # not CP866 ?? - echo "ru_RU KOI8-R" # not CP866 ?? - # ISO-8859-6 languages - echo "ar CP864" - echo "ar_AE CP864" - echo "ar_DZ CP864" - echo "ar_EG CP864" - echo "ar_IQ CP864" - echo "ar_IR CP864" - echo "ar_JO CP864" - echo "ar_KW CP864" - echo "ar_MA CP864" - echo "ar_OM CP864" - echo "ar_QA CP864" - echo "ar_SA CP864" - echo "ar_SY CP864" - # ISO-8859-7 languages - echo "el CP869" - echo "el_GR CP869" - # ISO-8859-8 languages - echo "he CP862" - echo "he_IL CP862" - # ISO-8859-9 languages - echo "tr CP857" - echo "tr_TR CP857" - # Japanese - echo "ja CP932" - echo "ja_JP CP932" - # Chinese - echo "zh_CN GBK" - echo "zh_TW CP950" # not CP938 ?? - # Korean - echo "kr CP949" # not CP934 ?? - echo "kr_KR CP949" # not CP934 ?? - # Thai - echo "th CP874" - echo "th_TH CP874" - # Other - echo "eo CP850" - echo "eo_EO CP850" - ;; -esac diff --git a/intl/dcgettext.c b/intl/dcgettext.c deleted file mode 100644 index b7c9652..0000000 --- a/intl/dcgettext.c +++ /dev/null @@ -1,58 +0,0 @@ -/* Implementation of the dcgettext(3) function. - Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "gettextP.h" -#ifdef _LIBC -# include -#else -# include "libgnuintl.h" -#endif - -/* @@ end of prolog @@ */ - -/* Names for the libintl functions are a problem. They must not clash - with existing names and they should follow ANSI C. But this source - code is also used in GNU C Library where the names have a __ - prefix. So we have to make a difference here. */ -#ifdef _LIBC -# define DCGETTEXT __dcgettext -# define DCIGETTEXT __dcigettext -#else -# define DCGETTEXT dcgettext__ -# define DCIGETTEXT dcigettext__ -#endif - -/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY - locale. */ -char * -DCGETTEXT (domainname, msgid, category) - const char *domainname; - const char *msgid; - int category; -{ - return DCIGETTEXT (domainname, msgid, NULL, 0, 0, category); -} - -#ifdef _LIBC -/* Alias for function name in GNU C Library. */ -weak_alias (__dcgettext, dcgettext); -#endif diff --git a/intl/dcigettext.c b/intl/dcigettext.c deleted file mode 100644 index 6acde19..0000000 --- a/intl/dcigettext.c +++ /dev/null @@ -1,1259 +0,0 @@ -/* Implementation of the internal dcigettext function. - Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library 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. */ - -/* Tell glibc's to provide a prototype for mempcpy(). - This must come before because may include - , and once has been included, it's too late. */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - -#ifdef __GNUC__ -# define alloca __builtin_alloca -# define HAVE_ALLOCA 1 -#else -# if defined HAVE_ALLOCA_H || defined _LIBC -# include -# else -# ifdef _AIX - #pragma alloca -# else -# ifndef alloca -char *alloca (); -# endif -# endif -# endif -#endif - -#include -#ifndef errno -extern int errno; -#endif -#ifndef __set_errno -# define __set_errno(val) errno = (val) -#endif - -#include -#include - -#include -#if !HAVE_STRCHR && !defined _LIBC -# ifndef strchr -# define strchr index -# endif -#endif - -#if defined HAVE_UNISTD_H || defined _LIBC -# include -#endif - -#include - -#if defined HAVE_SYS_PARAM_H || defined _LIBC -# include -#endif - -#include "gettextP.h" -#ifdef _LIBC -# include -#else -# include "libgnuintl.h" -#endif -#include "hash-string.h" - -/* Thread safetyness. */ -#ifdef _LIBC -# include -#else -/* Provide dummy implementation if this is outside glibc. */ -# define __libc_lock_define_initialized(CLASS, NAME) -# define __libc_lock_lock(NAME) -# define __libc_lock_unlock(NAME) -# define __libc_rwlock_define_initialized(CLASS, NAME) -# define __libc_rwlock_rdlock(NAME) -# define __libc_rwlock_unlock(NAME) -#endif - -/* Alignment of types. */ -#if defined __GNUC__ && __GNUC__ >= 2 -# define alignof(TYPE) __alignof__ (TYPE) -#else -# define alignof(TYPE) \ - ((int) &((struct { char dummy1; TYPE dummy2; } *) 0)->dummy2) -#endif - -/* The internal variables in the standalone libintl.a must have different - names than the internal variables in GNU libc, otherwise programs - using libintl.a cannot be linked statically. */ -#if !defined _LIBC -# define _nl_default_default_domain _nl_default_default_domain__ -# define _nl_current_default_domain _nl_current_default_domain__ -# define _nl_default_dirname _nl_default_dirname__ -# define _nl_domain_bindings _nl_domain_bindings__ -#endif - -/* Some compilers, like SunOS4 cc, don't have offsetof in . */ -#ifndef offsetof -# define offsetof(type,ident) ((size_t)&(((type*)0)->ident)) -#endif - -/* @@ end of prolog @@ */ - -#ifdef _LIBC -/* Rename the non ANSI C functions. This is required by the standard - because some ANSI C functions will require linking with this object - file and the name space must not be polluted. */ -# define getcwd __getcwd -# ifndef stpcpy -# define stpcpy __stpcpy -# endif -# define tfind __tfind -#else -# if !defined HAVE_GETCWD -char *getwd (); -# define getcwd(buf, max) getwd (buf) -# else -char *getcwd (); -# endif -# ifndef HAVE_STPCPY -static char *stpcpy PARAMS ((char *dest, const char *src)); -# endif -# ifndef HAVE_MEMPCPY -static void *mempcpy PARAMS ((void *dest, const void *src, size_t n)); -# endif -#endif - -/* Amount to increase buffer size by in each try. */ -#define PATH_INCR 32 - -/* The following is from pathmax.h. */ -/* Non-POSIX BSD systems might have gcc's limits.h, which doesn't define - PATH_MAX but might cause redefinition warnings when sys/param.h is - later included (as on MORE/BSD 4.3). */ -#if defined _POSIX_VERSION || (defined HAVE_LIMITS_H && !defined __GNUC__) -# include -#endif - -#ifndef _POSIX_PATH_MAX -# define _POSIX_PATH_MAX 255 -#endif - -#if !defined PATH_MAX && defined _PC_PATH_MAX -# define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 : pathconf ("/", _PC_PATH_MAX)) -#endif - -/* Don't include sys/param.h if it already has been. */ -#if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN -# include -#endif - -#if !defined PATH_MAX && defined MAXPATHLEN -# define PATH_MAX MAXPATHLEN -#endif - -#ifndef PATH_MAX -# define PATH_MAX _POSIX_PATH_MAX -#endif - -/* Pathname support. - ISSLASH(C) tests whether C is a directory separator character. - IS_ABSOLUTE_PATH(P) tests whether P is an absolute path. If it is not, - it may be concatenated to a directory pathname. - IS_PATH_WITH_DIR(P) tests whether P contains a directory specification. - */ -#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__ - /* Win32, OS/2, DOS */ -# define ISSLASH(C) ((C) == '/' || (C) == '\\') -# define HAS_DEVICE(P) \ - ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \ - && (P)[1] == ':') -# define IS_ABSOLUTE_PATH(P) (ISSLASH ((P)[0]) || HAS_DEVICE (P)) -# define IS_PATH_WITH_DIR(P) \ - (strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P)) -#else - /* Unix */ -# define ISSLASH(C) ((C) == '/') -# define IS_ABSOLUTE_PATH(P) ISSLASH ((P)[0]) -# define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL) -#endif - -/* XPG3 defines the result of `setlocale (category, NULL)' as: - ``Directs `setlocale()' to query `category' and return the current - setting of `local'.'' - However it does not specify the exact format. Neither do SUSV2 and - ISO C 99. So we can use this feature only on selected systems (e.g. - those using GNU C Library). */ -#if defined _LIBC || (defined __GNU_LIBRARY__ && __GNU_LIBRARY__ >= 2) -# define HAVE_LOCALE_NULL -#endif - -/* This is the type used for the search tree where known translations - are stored. */ -struct known_translation_t -{ - /* Domain in which to search. */ - char *domainname; - - /* The category. */ - int category; - - /* State of the catalog counter at the point the string was found. */ - int counter; - - /* Catalog where the string was found. */ - struct loaded_l10nfile *domain; - - /* And finally the translation. */ - const char *translation; - size_t translation_length; - - /* Pointer to the string in question. */ - char msgid[ZERO]; -}; - -/* Root of the search tree with known translations. We can use this - only if the system provides the `tsearch' function family. */ -#if defined HAVE_TSEARCH || defined _LIBC -# include - -static void *root; - -# ifdef _LIBC -# define tsearch __tsearch -# endif - -/* Function to compare two entries in the table of known translations. */ -static int transcmp PARAMS ((const void *p1, const void *p2)); -static int -transcmp (p1, p2) - const void *p1; - const void *p2; -{ - const struct known_translation_t *s1; - const struct known_translation_t *s2; - int result; - - s1 = (const struct known_translation_t *) p1; - s2 = (const struct known_translation_t *) p2; - - result = strcmp (s1->msgid, s2->msgid); - if (result == 0) - { - result = strcmp (s1->domainname, s2->domainname); - if (result == 0) - /* We compare the category last (though this is the cheapest - operation) since it is hopefully always the same (namely - LC_MESSAGES). */ - result = s1->category - s2->category; - } - - return result; -} -#endif - -/* Name of the default domain used for gettext(3) prior any call to - textdomain(3). The default value for this is "messages". */ -const char _nl_default_default_domain[] = "messages"; - -/* Value used as the default domain for gettext(3). */ -const char *_nl_current_default_domain = _nl_default_default_domain; - -/* Contains the default location of the message catalogs. */ -const char _nl_default_dirname[] = LOCALEDIR; - -/* List with bindings of specific domains created by bindtextdomain() - calls. */ -struct binding *_nl_domain_bindings; - -/* Prototypes for local functions. */ -static char *plural_lookup PARAMS ((struct loaded_l10nfile *domain, - unsigned long int n, - const char *translation, - size_t translation_len)) - internal_function; -static unsigned long int plural_eval PARAMS ((struct expression *pexp, - unsigned long int n)) - internal_function; -static const char *category_to_name PARAMS ((int category)) internal_function; -static const char *guess_category_value PARAMS ((int category, - const char *categoryname)) - internal_function; - - -/* For those loosing systems which don't have `alloca' we have to add - some additional code emulating it. */ -#ifdef HAVE_ALLOCA -/* Nothing has to be done. */ -# define ADD_BLOCK(list, address) /* nothing */ -# define FREE_BLOCKS(list) /* nothing */ -#else -struct block_list -{ - void *address; - struct block_list *next; -}; -# define ADD_BLOCK(list, addr) \ - do { \ - struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \ - /* If we cannot get a free block we cannot add the new element to \ - the list. */ \ - if (newp != NULL) { \ - newp->address = (addr); \ - newp->next = (list); \ - (list) = newp; \ - } \ - } while (0) -# define FREE_BLOCKS(list) \ - do { \ - while (list != NULL) { \ - struct block_list *old = list; \ - list = list->next; \ - free (old); \ - } \ - } while (0) -# undef alloca -# define alloca(size) (malloc (size)) -#endif /* have alloca */ - - -#ifdef _LIBC -/* List of blocks allocated for translations. */ -typedef struct transmem_list -{ - struct transmem_list *next; - char data[ZERO]; -} transmem_block_t; -static struct transmem_list *transmem_list; -#else -typedef unsigned char transmem_block_t; -#endif - - -/* Names for the libintl functions are a problem. They must not clash - with existing names and they should follow ANSI C. But this source - code is also used in GNU C Library where the names have a __ - prefix. So we have to make a difference here. */ -#ifdef _LIBC -# define DCIGETTEXT __dcigettext -#else -# define DCIGETTEXT dcigettext__ -#endif - -/* Lock variable to protect the global data in the gettext implementation. */ -#ifdef _LIBC -__libc_rwlock_define_initialized (, _nl_state_lock) -#endif - -/* Checking whether the binaries runs SUID must be done and glibc provides - easier methods therefore we make a difference here. */ -#ifdef _LIBC -# define ENABLE_SECURE __libc_enable_secure -# define DETERMINE_SECURE -#else -# ifndef HAVE_GETUID -# define getuid() 0 -# endif -# ifndef HAVE_GETGID -# define getgid() 0 -# endif -# ifndef HAVE_GETEUID -# define geteuid() getuid() -# endif -# ifndef HAVE_GETEGID -# define getegid() getgid() -# endif -static int enable_secure; -# define ENABLE_SECURE (enable_secure == 1) -# define DETERMINE_SECURE \ - if (enable_secure == 0) \ - { \ - if (getuid () != geteuid () || getgid () != getegid ()) \ - enable_secure = 1; \ - else \ - enable_secure = -1; \ - } -#endif - -/* Look up MSGID in the DOMAINNAME message catalog for the current - CATEGORY locale and, if PLURAL is nonzero, search over string - depending on the plural form determined by N. */ -char * -DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category) - const char *domainname; - const char *msgid1; - const char *msgid2; - int plural; - unsigned long int n; - int category; -{ -#ifndef HAVE_ALLOCA - struct block_list *block_list = NULL; -#endif - struct loaded_l10nfile *domain; - struct binding *binding; - const char *categoryname; - const char *categoryvalue; - char *dirname, *xdomainname; - char *single_locale; - char *retval; - size_t retlen; - int saved_errno; -#if defined HAVE_TSEARCH || defined _LIBC - struct known_translation_t *search; - struct known_translation_t **foundp = NULL; - size_t msgid_len; -#endif - size_t domainname_len; - - /* If no real MSGID is given return NULL. */ - if (msgid1 == NULL) - return NULL; - - __libc_rwlock_rdlock (_nl_state_lock); - - /* If DOMAINNAME is NULL, we are interested in the default domain. If - CATEGORY is not LC_MESSAGES this might not make much sense but the - definition left this undefined. */ - if (domainname == NULL) - domainname = _nl_current_default_domain; - -#if defined HAVE_TSEARCH || defined _LIBC - msgid_len = strlen (msgid1) + 1; - - /* Try to find the translation among those which we found at - some time. */ - search = (struct known_translation_t *) - alloca (offsetof (struct known_translation_t, msgid) + msgid_len); - memcpy (search->msgid, msgid1, msgid_len); - search->domainname = (char *) domainname; - search->category = category; - - foundp = (struct known_translation_t **) tfind (search, &root, transcmp); - if (foundp != NULL && (*foundp)->counter == _nl_msg_cat_cntr) - { - /* Now deal with plural. */ - if (plural) - retval = plural_lookup ((*foundp)->domain, n, (*foundp)->translation, - (*foundp)->translation_length); - else - retval = (char *) (*foundp)->translation; - - __libc_rwlock_unlock (_nl_state_lock); - return retval; - } -#endif - - /* Preserve the `errno' value. */ - saved_errno = errno; - - /* See whether this is a SUID binary or not. */ - DETERMINE_SECURE; - - /* First find matching binding. */ - for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next) - { - int compare = strcmp (domainname, binding->domainname); - if (compare == 0) - /* We found it! */ - break; - if (compare < 0) - { - /* It is not in the list. */ - binding = NULL; - break; - } - } - - if (binding == NULL) - dirname = (char *) _nl_default_dirname; - else if (IS_ABSOLUTE_PATH (binding->dirname)) - dirname = binding->dirname; - else - { - /* We have a relative path. Make it absolute now. */ - size_t dirname_len = strlen (binding->dirname) + 1; - size_t path_max; - char *ret; - - path_max = (unsigned int) PATH_MAX; - path_max += 2; /* The getcwd docs say to do this. */ - - for (;;) - { - dirname = (char *) alloca (path_max + dirname_len); - ADD_BLOCK (block_list, dirname); - - __set_errno (0); - ret = getcwd (dirname, path_max); - if (ret != NULL || errno != ERANGE) - break; - - path_max += path_max / 2; - path_max += PATH_INCR; - } - - if (ret == NULL) - { - /* We cannot get the current working directory. Don't signal an - error but simply return the default string. */ - FREE_BLOCKS (block_list); - __libc_rwlock_unlock (_nl_state_lock); - __set_errno (saved_errno); - return (plural == 0 - ? (char *) msgid1 - /* Use the Germanic plural rule. */ - : n == 1 ? (char *) msgid1 : (char *) msgid2); - } - - stpcpy (stpcpy (strchr (dirname, '\0'), "/"), binding->dirname); - } - - /* Now determine the symbolic name of CATEGORY and its value. */ - categoryname = category_to_name (category); - categoryvalue = guess_category_value (category, categoryname); - - domainname_len = strlen (domainname); - xdomainname = (char *) alloca (strlen (categoryname) - + domainname_len + 5); - ADD_BLOCK (block_list, xdomainname); - - stpcpy (mempcpy (stpcpy (stpcpy (xdomainname, categoryname), "/"), - domainname, domainname_len), - ".mo"); - - /* Creating working area. */ - single_locale = (char *) alloca (strlen (categoryvalue) + 1); - ADD_BLOCK (block_list, single_locale); - - - /* Search for the given string. This is a loop because we perhaps - got an ordered list of languages to consider for the translation. */ - while (1) - { - /* Make CATEGORYVALUE point to the next element of the list. */ - while (categoryvalue[0] != '\0' && categoryvalue[0] == ':') - ++categoryvalue; - if (categoryvalue[0] == '\0') - { - /* The whole contents of CATEGORYVALUE has been searched but - no valid entry has been found. We solve this situation - by implicitly appending a "C" entry, i.e. no translation - will take place. */ - single_locale[0] = 'C'; - single_locale[1] = '\0'; - } - else - { - char *cp = single_locale; - while (categoryvalue[0] != '\0' && categoryvalue[0] != ':') - *cp++ = *categoryvalue++; - *cp = '\0'; - - /* When this is a SUID binary we must not allow accessing files - outside the dedicated directories. */ - if (ENABLE_SECURE && IS_PATH_WITH_DIR (single_locale)) - /* Ingore this entry. */ - continue; - } - - /* If the current locale value is C (or POSIX) we don't load a - domain. Return the MSGID. */ - if (strcmp (single_locale, "C") == 0 - || strcmp (single_locale, "POSIX") == 0) - { - FREE_BLOCKS (block_list); - __libc_rwlock_unlock (_nl_state_lock); - __set_errno (saved_errno); - return (plural == 0 - ? (char *) msgid1 - /* Use the Germanic plural rule. */ - : n == 1 ? (char *) msgid1 : (char *) msgid2); - } - - - /* Find structure describing the message catalog matching the - DOMAINNAME and CATEGORY. */ - domain = _nl_find_domain (dirname, single_locale, xdomainname, binding); - - if (domain != NULL) - { - retval = _nl_find_msg (domain, binding, msgid1, &retlen); - - if (retval == NULL) - { - int cnt; - - for (cnt = 0; domain->successor[cnt] != NULL; ++cnt) - { - retval = _nl_find_msg (domain->successor[cnt], binding, - msgid1, &retlen); - - if (retval != NULL) - { - domain = domain->successor[cnt]; - break; - } - } - } - - if (retval != NULL) - { - /* Found the translation of MSGID1 in domain DOMAIN: - starting at RETVAL, RETLEN bytes. */ - FREE_BLOCKS (block_list); - __set_errno (saved_errno); -#if defined HAVE_TSEARCH || defined _LIBC - if (foundp == NULL) - { - /* Create a new entry and add it to the search tree. */ - struct known_translation_t *newp; - - newp = (struct known_translation_t *) - malloc (offsetof (struct known_translation_t, msgid) - + msgid_len + domainname_len + 1); - if (newp != NULL) - { - newp->domainname = - mempcpy (newp->msgid, msgid1, msgid_len); - memcpy (newp->domainname, domainname, domainname_len + 1); - newp->category = category; - newp->counter = _nl_msg_cat_cntr; - newp->domain = domain; - newp->translation = retval; - newp->translation_length = retlen; - - /* Insert the entry in the search tree. */ - foundp = (struct known_translation_t **) - tsearch (newp, &root, transcmp); - if (foundp == NULL - || __builtin_expect (*foundp != newp, 0)) - /* The insert failed. */ - free (newp); - } - } - else - { - /* We can update the existing entry. */ - (*foundp)->counter = _nl_msg_cat_cntr; - (*foundp)->domain = domain; - (*foundp)->translation = retval; - (*foundp)->translation_length = retlen; - } -#endif - /* Now deal with plural. */ - if (plural) - retval = plural_lookup (domain, n, retval, retlen); - - __libc_rwlock_unlock (_nl_state_lock); - return retval; - } - } - } - /* NOTREACHED */ -} - - -char * -internal_function -_nl_find_msg (domain_file, domainbinding, msgid, lengthp) - struct loaded_l10nfile *domain_file; - struct binding *domainbinding; - const char *msgid; - size_t *lengthp; -{ - struct loaded_domain *domain; - size_t act; - char *result; - size_t resultlen; - - if (domain_file->decided == 0) - _nl_load_domain (domain_file, domainbinding); - - if (domain_file->data == NULL) - return NULL; - - domain = (struct loaded_domain *) domain_file->data; - - /* Locate the MSGID and its translation. */ - if (domain->hash_size > 2 && domain->hash_tab != NULL) - { - /* Use the hashing table. */ - nls_uint32 len = strlen (msgid); - nls_uint32 hash_val = hash_string (msgid); - nls_uint32 idx = hash_val % domain->hash_size; - nls_uint32 incr = 1 + (hash_val % (domain->hash_size - 2)); - - while (1) - { - nls_uint32 nstr = W (domain->must_swap, domain->hash_tab[idx]); - - if (nstr == 0) - /* Hash table entry is empty. */ - return NULL; - - /* Compare msgid with the original string at index nstr-1. - We compare the lengths with >=, not ==, because plural entries - are represented by strings with an embedded NUL. */ - if (W (domain->must_swap, domain->orig_tab[nstr - 1].length) >= len - && (strcmp (msgid, - domain->data + W (domain->must_swap, - domain->orig_tab[nstr - 1].offset)) - == 0)) - { - act = nstr - 1; - goto found; - } - - if (idx >= domain->hash_size - incr) - idx -= domain->hash_size - incr; - else - idx += incr; - } - /* NOTREACHED */ - } - else - { - /* Try the default method: binary search in the sorted array of - messages. */ - size_t top, bottom; - - bottom = 0; - top = domain->nstrings; - while (bottom < top) - { - int cmp_val; - - act = (bottom + top) / 2; - cmp_val = strcmp (msgid, (domain->data - + W (domain->must_swap, - domain->orig_tab[act].offset))); - if (cmp_val < 0) - top = act; - else if (cmp_val > 0) - bottom = act + 1; - else - goto found; - } - /* No translation was found. */ - return NULL; - } - - found: - /* The translation was found at index ACT. If we have to convert the - string to use a different character set, this is the time. */ - result = ((char *) domain->data - + W (domain->must_swap, domain->trans_tab[act].offset)); - resultlen = W (domain->must_swap, domain->trans_tab[act].length) + 1; - -#if defined _LIBC || HAVE_ICONV - if (domain->codeset_cntr - != (domainbinding != NULL ? domainbinding->codeset_cntr : 0)) - { - /* The domain's codeset has changed through bind_textdomain_codeset() - since the message catalog was initialized or last accessed. We - have to reinitialize the converter. */ - _nl_free_domain_conv (domain); - _nl_init_domain_conv (domain_file, domain, domainbinding); - } - - if ( -# ifdef _LIBC - domain->conv != (__gconv_t) -1 -# else -# if HAVE_ICONV - domain->conv != (iconv_t) -1 -# endif -# endif - ) - { - /* We are supposed to do a conversion. First allocate an - appropriate table with the same structure as the table - of translations in the file, where we can put the pointers - to the converted strings in. - There is a slight complication with plural entries. They - are represented by consecutive NUL terminated strings. We - handle this case by converting RESULTLEN bytes, including - NULs. */ - - if (domain->conv_tab == NULL - && ((domain->conv_tab = (char **) calloc (domain->nstrings, - sizeof (char *))) - == NULL)) - /* Mark that we didn't succeed allocating a table. */ - domain->conv_tab = (char **) -1; - - if (__builtin_expect (domain->conv_tab == (char **) -1, 0)) - /* Nothing we can do, no more memory. */ - goto converted; - - if (domain->conv_tab[act] == NULL) - { - /* We haven't used this string so far, so it is not - translated yet. Do this now. */ - /* We use a bit more efficient memory handling. - We allocate always larger blocks which get used over - time. This is faster than many small allocations. */ - __libc_lock_define_initialized (static, lock) -# define INITIAL_BLOCK_SIZE 4080 - static unsigned char *freemem; - static size_t freemem_size; - - const unsigned char *inbuf; - unsigned char *outbuf; - int malloc_count; -# ifndef _LIBC - transmem_block_t *transmem_list = NULL; -# endif - - __libc_lock_lock (lock); - - inbuf = (const unsigned char *) result; - outbuf = freemem + sizeof (size_t); - - malloc_count = 0; - while (1) - { - transmem_block_t *newmem; -# ifdef _LIBC - size_t non_reversible; - int res; - - if (freemem_size < sizeof (size_t)) - goto resize_freemem; - - res = __gconv (domain->conv, - &inbuf, inbuf + resultlen, - &outbuf, - outbuf + freemem_size - sizeof (size_t), - &non_reversible); - - if (res == __GCONV_OK || res == __GCONV_EMPTY_INPUT) - break; - - if (res != __GCONV_FULL_OUTPUT) - { - __libc_lock_unlock (lock); - goto converted; - } - - inbuf = result; -# else -# if HAVE_ICONV - const char *inptr = (const char *) inbuf; - size_t inleft = resultlen; - char *outptr = (char *) outbuf; - size_t outleft; - - if (freemem_size < sizeof (size_t)) - goto resize_freemem; - - outleft = freemem_size - sizeof (size_t); - if (iconv (domain->conv, - (ICONV_CONST char **) &inptr, &inleft, - &outptr, &outleft) - != (size_t) (-1)) - { - outbuf = (unsigned char *) outptr; - break; - } - if (errno != E2BIG) - { - __libc_lock_unlock (lock); - goto converted; - } -# endif -# endif - - resize_freemem: - /* We must allocate a new buffer or resize the old one. */ - if (malloc_count > 0) - { - ++malloc_count; - freemem_size = malloc_count * INITIAL_BLOCK_SIZE; - newmem = (transmem_block_t *) realloc (transmem_list, - freemem_size); -# ifdef _LIBC - if (newmem != NULL) - transmem_list = transmem_list->next; - else - { - struct transmem_list *old = transmem_list; - - transmem_list = transmem_list->next; - free (old); - } -# endif - } - else - { - malloc_count = 1; - freemem_size = INITIAL_BLOCK_SIZE; - newmem = (transmem_block_t *) malloc (freemem_size); - } - if (__builtin_expect (newmem == NULL, 0)) - { - freemem = NULL; - freemem_size = 0; - __libc_lock_unlock (lock); - goto converted; - } - -# ifdef _LIBC - /* Add the block to the list of blocks we have to free - at some point. */ - newmem->next = transmem_list; - transmem_list = newmem; - - freemem = newmem->data; - freemem_size -= offsetof (struct transmem_list, data); -# else - transmem_list = newmem; - freemem = newmem; -# endif - - outbuf = freemem + sizeof (size_t); - } - - /* We have now in our buffer a converted string. Put this - into the table of conversions. */ - *(size_t *) freemem = outbuf - freemem - sizeof (size_t); - domain->conv_tab[act] = (char *) freemem; - /* Shrink freemem, but keep it aligned. */ - freemem_size -= outbuf - freemem; - freemem = outbuf; - freemem += freemem_size & (alignof (size_t) - 1); - freemem_size = freemem_size & ~ (alignof (size_t) - 1); - - __libc_lock_unlock (lock); - } - - /* Now domain->conv_tab[act] contains the translation of all - the plural variants. */ - result = domain->conv_tab[act] + sizeof (size_t); - resultlen = *(size_t *) domain->conv_tab[act]; - } - - converted: - /* The result string is converted. */ - -#endif /* _LIBC || HAVE_ICONV */ - - *lengthp = resultlen; - return result; -} - - -/* Look up a plural variant. */ -static char * -internal_function -plural_lookup (domain, n, translation, translation_len) - struct loaded_l10nfile *domain; - unsigned long int n; - const char *translation; - size_t translation_len; -{ - struct loaded_domain *domaindata = (struct loaded_domain *) domain->data; - unsigned long int index; - const char *p; - - index = plural_eval (domaindata->plural, n); - if (index >= domaindata->nplurals) - /* This should never happen. It means the plural expression and the - given maximum value do not match. */ - index = 0; - - /* Skip INDEX strings at TRANSLATION. */ - p = translation; - while (index-- > 0) - { -#ifdef _LIBC - p = __rawmemchr (p, '\0'); -#else - p = strchr (p, '\0'); -#endif - /* And skip over the NUL byte. */ - p++; - - if (p >= translation + translation_len) - /* This should never happen. It means the plural expression - evaluated to a value larger than the number of variants - available for MSGID1. */ - return (char *) translation; - } - return (char *) p; -} - - -/* Function to evaluate the plural expression and return an index value. */ -static unsigned long int -internal_function -plural_eval (pexp, n) - struct expression *pexp; - unsigned long int n; -{ - switch (pexp->nargs) - { - case 0: - switch (pexp->operation) - { - case var: - return n; - case num: - return pexp->val.num; - default: - break; - } - /* NOTREACHED */ - break; - case 1: - { - /* pexp->operation must be lnot. */ - unsigned long int arg = plural_eval (pexp->val.args[0], n); - return ! arg; - } - case 2: - { - unsigned long int leftarg = plural_eval (pexp->val.args[0], n); - if (pexp->operation == lor) - return leftarg || plural_eval (pexp->val.args[1], n); - else if (pexp->operation == land) - return leftarg && plural_eval (pexp->val.args[1], n); - else - { - unsigned long int rightarg = plural_eval (pexp->val.args[1], n); - - switch (pexp->operation) - { - case mult: - return leftarg * rightarg; - case divide: - return leftarg / rightarg; - case module: - return leftarg % rightarg; - case plus: - return leftarg + rightarg; - case minus: - return leftarg - rightarg; - case less_than: - return leftarg < rightarg; - case greater_than: - return leftarg > rightarg; - case less_or_equal: - return leftarg <= rightarg; - case greater_or_equal: - return leftarg >= rightarg; - case equal: - return leftarg == rightarg; - case not_equal: - return leftarg != rightarg; - default: - break; - } - } - /* NOTREACHED */ - break; - } - case 3: - { - /* pexp->operation must be qmop. */ - unsigned long int boolarg = plural_eval (pexp->val.args[0], n); - return plural_eval (pexp->val.args[boolarg ? 1 : 2], n); - } - } - /* NOTREACHED */ - return 0; -} - - -/* Return string representation of locale CATEGORY. */ -static const char * -internal_function -category_to_name (category) - int category; -{ - const char *retval; - - switch (category) - { -#ifdef LC_COLLATE - case LC_COLLATE: - retval = "LC_COLLATE"; - break; -#endif -#ifdef LC_CTYPE - case LC_CTYPE: - retval = "LC_CTYPE"; - break; -#endif -#ifdef LC_MONETARY - case LC_MONETARY: - retval = "LC_MONETARY"; - break; -#endif -#ifdef LC_NUMERIC - case LC_NUMERIC: - retval = "LC_NUMERIC"; - break; -#endif -#ifdef LC_TIME - case LC_TIME: - retval = "LC_TIME"; - break; -#endif -#ifdef LC_MESSAGES - case LC_MESSAGES: - retval = "LC_MESSAGES"; - break; -#endif -#ifdef LC_RESPONSE - case LC_RESPONSE: - retval = "LC_RESPONSE"; - break; -#endif -#ifdef LC_ALL - case LC_ALL: - /* This might not make sense but is perhaps better than any other - value. */ - retval = "LC_ALL"; - break; -#endif - default: - /* If you have a better idea for a default value let me know. */ - retval = "LC_XXX"; - } - - return retval; -} - -/* Guess value of current locale from value of the environment variables. */ -static const char * -internal_function -guess_category_value (category, categoryname) - int category; - const char *categoryname; -{ - const char *language; - const char *retval; - - /* The highest priority value is the `LANGUAGE' environment - variable. But we don't use the value if the currently selected - locale is the C locale. This is a GNU extension. */ - language = getenv ("LANGUAGE"); - if (language != NULL && language[0] == '\0') - language = NULL; - - /* We have to proceed with the POSIX methods of looking to `LC_ALL', - `LC_xxx', and `LANG'. On some systems this can be done by the - `setlocale' function itself. */ -#if defined _LIBC || (defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL) - retval = setlocale (category, NULL); -#else - /* Setting of LC_ALL overwrites all other. */ - retval = getenv ("LC_ALL"); - if (retval == NULL || retval[0] == '\0') - { - /* Next comes the name of the desired category. */ - retval = getenv (categoryname); - if (retval == NULL || retval[0] == '\0') - { - /* Last possibility is the LANG environment variable. */ - retval = getenv ("LANG"); - if (retval == NULL || retval[0] == '\0') - /* We use C as the default domain. POSIX says this is - implementation defined. */ - return "C"; - } - } -#endif - - return language != NULL && strcmp (retval, "C") != 0 ? language : retval; -} - -/* @@ begin of epilog @@ */ - -/* We don't want libintl.a to depend on any other library. So we - avoid the non-standard function stpcpy. In GNU C Library this - function is available, though. Also allow the symbol HAVE_STPCPY - to be defined. */ -#if !_LIBC && !HAVE_STPCPY -static char * -stpcpy (dest, src) - char *dest; - const char *src; -{ - while ((*dest++ = *src++) != '\0') - /* Do nothing. */ ; - return dest - 1; -} -#endif - -#if !_LIBC && !HAVE_MEMPCPY -static void * -mempcpy (dest, src, n) - void *dest; - const void *src; - size_t n; -{ - return (void *) ((char *) memcpy (dest, src, n) + n); -} -#endif - - -#ifdef _LIBC -/* If we want to free all resources we have to do some work at - program's end. */ -static void __attribute__ ((unused)) -free_mem (void) -{ - void *old; - - while (_nl_domain_bindings != NULL) - { - struct binding *oldp = _nl_domain_bindings; - _nl_domain_bindings = _nl_domain_bindings->next; - if (oldp->dirname != _nl_default_dirname) - /* Yes, this is a pointer comparison. */ - free (oldp->dirname); - free (oldp->codeset); - free (oldp); - } - - if (_nl_current_default_domain != _nl_default_default_domain) - /* Yes, again a pointer comparison. */ - free ((char *) _nl_current_default_domain); - - /* Remove the search tree with the known translations. */ - __tdestroy (root, free); - root = NULL; - - while (transmem_list != NULL) - { - old = transmem_list; - transmem_list = transmem_list->next; - free (old); - } -} - -text_set_element (__libc_subfreeres, free_mem); -#endif diff --git a/intl/dcngettext.c b/intl/dcngettext.c deleted file mode 100644 index c16af21..0000000 --- a/intl/dcngettext.c +++ /dev/null @@ -1,60 +0,0 @@ -/* Implementation of the dcngettext(3) function. - Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "gettextP.h" -#ifdef _LIBC -# include -#else -# include "libgnuintl.h" -#endif - -/* @@ end of prolog @@ */ - -/* Names for the libintl functions are a problem. They must not clash - with existing names and they should follow ANSI C. But this source - code is also used in GNU C Library where the names have a __ - prefix. So we have to make a difference here. */ -#ifdef _LIBC -# define DCNGETTEXT __dcngettext -# define DCIGETTEXT __dcigettext -#else -# define DCNGETTEXT dcngettext__ -# define DCIGETTEXT dcigettext__ -#endif - -/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY - locale. */ -char * -DCNGETTEXT (domainname, msgid1, msgid2, n, category) - const char *domainname; - const char *msgid1; - const char *msgid2; - unsigned long int n; - int category; -{ - return DCIGETTEXT (domainname, msgid1, msgid2, 1, n, category); -} - -#ifdef _LIBC -/* Alias for function name in GNU C Library. */ -weak_alias (__dcngettext, dcngettext); -#endif diff --git a/intl/dgettext.c b/intl/dgettext.c deleted file mode 100644 index 3651207..0000000 --- a/intl/dgettext.c +++ /dev/null @@ -1,59 +0,0 @@ -/* Implementation of the dgettext(3) function. - Copyright (C) 1995-1997, 2000, 2001 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - -#include "gettextP.h" -#ifdef _LIBC -# include -#else -# include "libgnuintl.h" -#endif - -/* @@ end of prolog @@ */ - -/* Names for the libintl functions are a problem. They must not clash - with existing names and they should follow ANSI C. But this source - code is also used in GNU C Library where the names have a __ - prefix. So we have to make a difference here. */ -#ifdef _LIBC -# define DGETTEXT __dgettext -# define DCGETTEXT __dcgettext -#else -# define DGETTEXT dgettext__ -# define DCGETTEXT dcgettext__ -#endif - -/* Look up MSGID in the DOMAINNAME message catalog of the current - LC_MESSAGES locale. */ -char * -DGETTEXT (domainname, msgid) - const char *domainname; - const char *msgid; -{ - return DCGETTEXT (domainname, msgid, LC_MESSAGES); -} - -#ifdef _LIBC -/* Alias for function name in GNU C Library. */ -weak_alias (__dgettext, dgettext); -#endif diff --git a/intl/dngettext.c b/intl/dngettext.c deleted file mode 100644 index f214e95..0000000 --- a/intl/dngettext.c +++ /dev/null @@ -1,61 +0,0 @@ -/* Implementation of the dngettext(3) function. - Copyright (C) 1995-1997, 2000, 2001 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - -#include "gettextP.h" -#ifdef _LIBC -# include -#else -# include "libgnuintl.h" -#endif - -/* @@ end of prolog @@ */ - -/* Names for the libintl functions are a problem. They must not clash - with existing names and they should follow ANSI C. But this source - code is also used in GNU C Library where the names have a __ - prefix. So we have to make a difference here. */ -#ifdef _LIBC -# define DNGETTEXT __dngettext -# define DCNGETTEXT __dcngettext -#else -# define DNGETTEXT dngettext__ -# define DCNGETTEXT dcngettext__ -#endif - -/* Look up MSGID in the DOMAINNAME message catalog of the current - LC_MESSAGES locale and skip message according to the plural form. */ -char * -DNGETTEXT (domainname, msgid1, msgid2, n) - const char *domainname; - const char *msgid1; - const char *msgid2; - unsigned long int n; -{ - return DCNGETTEXT (domainname, msgid1, msgid2, n, LC_MESSAGES); -} - -#ifdef _LIBC -/* Alias for function name in GNU C Library. */ -weak_alias (__dngettext, dngettext); -#endif diff --git a/intl/explodename.c b/intl/explodename.c deleted file mode 100644 index 2985064..0000000 --- a/intl/explodename.c +++ /dev/null @@ -1,192 +0,0 @@ -/* Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc. - Contributed by Ulrich Drepper , 1995. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include - -#include "loadinfo.h" - -/* On some strange systems still no definition of NULL is found. Sigh! */ -#ifndef NULL -# if defined __STDC__ && __STDC__ -# define NULL ((void *) 0) -# else -# define NULL 0 -# endif -#endif - -/* @@ end of prolog @@ */ - -char * -_nl_find_language (name) - const char *name; -{ - while (name[0] != '\0' && name[0] != '_' && name[0] != '@' - && name[0] != '+' && name[0] != ',') - ++name; - - return (char *) name; -} - - -int -_nl_explode_name (name, language, modifier, territory, codeset, - normalized_codeset, special, sponsor, revision) - char *name; - const char **language; - const char **modifier; - const char **territory; - const char **codeset; - const char **normalized_codeset; - const char **special; - const char **sponsor; - const char **revision; -{ - enum { undecided, xpg, cen } syntax; - char *cp; - int mask; - - *modifier = NULL; - *territory = NULL; - *codeset = NULL; - *normalized_codeset = NULL; - *special = NULL; - *sponsor = NULL; - *revision = NULL; - - /* Now we determine the single parts of the locale name. First - look for the language. Termination symbols are `_' and `@' if - we use XPG4 style, and `_', `+', and `,' if we use CEN syntax. */ - mask = 0; - syntax = undecided; - *language = cp = name; - cp = _nl_find_language (*language); - - if (*language == cp) - /* This does not make sense: language has to be specified. Use - this entry as it is without exploding. Perhaps it is an alias. */ - cp = strchr (*language, '\0'); - else if (cp[0] == '_') - { - /* Next is the territory. */ - cp[0] = '\0'; - *territory = ++cp; - - while (cp[0] != '\0' && cp[0] != '.' && cp[0] != '@' - && cp[0] != '+' && cp[0] != ',' && cp[0] != '_') - ++cp; - - mask |= TERRITORY; - - if (cp[0] == '.') - { - /* Next is the codeset. */ - syntax = xpg; - cp[0] = '\0'; - *codeset = ++cp; - - while (cp[0] != '\0' && cp[0] != '@') - ++cp; - - mask |= XPG_CODESET; - - if (*codeset != cp && (*codeset)[0] != '\0') - { - *normalized_codeset = _nl_normalize_codeset (*codeset, - cp - *codeset); - if (strcmp (*codeset, *normalized_codeset) == 0) - free ((char *) *normalized_codeset); - else - mask |= XPG_NORM_CODESET; - } - } - } - - if (cp[0] == '@' || (syntax != xpg && cp[0] == '+')) - { - /* Next is the modifier. */ - syntax = cp[0] == '@' ? xpg : cen; - cp[0] = '\0'; - *modifier = ++cp; - - while (syntax == cen && cp[0] != '\0' && cp[0] != '+' - && cp[0] != ',' && cp[0] != '_') - ++cp; - - mask |= XPG_MODIFIER | CEN_AUDIENCE; - } - - if (syntax != xpg && (cp[0] == '+' || cp[0] == ',' || cp[0] == '_')) - { - syntax = cen; - - if (cp[0] == '+') - { - /* Next is special application (CEN syntax). */ - cp[0] = '\0'; - *special = ++cp; - - while (cp[0] != '\0' && cp[0] != ',' && cp[0] != '_') - ++cp; - - mask |= CEN_SPECIAL; - } - - if (cp[0] == ',') - { - /* Next is sponsor (CEN syntax). */ - cp[0] = '\0'; - *sponsor = ++cp; - - while (cp[0] != '\0' && cp[0] != '_') - ++cp; - - mask |= CEN_SPONSOR; - } - - if (cp[0] == '_') - { - /* Next is revision (CEN syntax). */ - cp[0] = '\0'; - *revision = ++cp; - - mask |= CEN_REVISION; - } - } - - /* For CEN syntax values it might be important to have the - separator character in the file name, not for XPG syntax. */ - if (syntax == xpg) - { - if (*territory != NULL && (*territory)[0] == '\0') - mask &= ~TERRITORY; - - if (*codeset != NULL && (*codeset)[0] == '\0') - mask &= ~XPG_CODESET; - - if (*modifier != NULL && (*modifier)[0] == '\0') - mask &= ~XPG_MODIFIER; - } - - return mask; -} diff --git a/intl/finddomain.c b/intl/finddomain.c deleted file mode 100644 index 2f103d5..0000000 --- a/intl/finddomain.c +++ /dev/null @@ -1,198 +0,0 @@ -/* Handle list of needed message catalogs - Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. - Written by Ulrich Drepper , 1995. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include - -#if defined HAVE_UNISTD_H || defined _LIBC -# include -#endif - -#include "gettextP.h" -#ifdef _LIBC -# include -#else -# include "libgnuintl.h" -#endif - -/* @@ end of prolog @@ */ -/* List of already loaded domains. */ -static struct loaded_l10nfile *_nl_loaded_domains; - - -/* Return a data structure describing the message catalog described by - the DOMAINNAME and CATEGORY parameters with respect to the currently - established bindings. */ -struct loaded_l10nfile * -internal_function -_nl_find_domain (dirname, locale, domainname, domainbinding) - const char *dirname; - char *locale; - const char *domainname; - struct binding *domainbinding; -{ - struct loaded_l10nfile *retval; - const char *language; - const char *modifier; - const char *territory; - const char *codeset; - const char *normalized_codeset; - const char *special; - const char *sponsor; - const char *revision; - const char *alias_value; - int mask; - - /* LOCALE can consist of up to four recognized parts for the XPG syntax: - - language[_territory[.codeset]][@modifier] - - and six parts for the CEN syntax: - - language[_territory][+audience][+special][,[sponsor][_revision]] - - Beside the first part all of them are allowed to be missing. If - the full specified locale is not found, the less specific one are - looked for. The various parts will be stripped off according to - the following order: - (1) revision - (2) sponsor - (3) special - (4) codeset - (5) normalized codeset - (6) territory - (7) audience/modifier - */ - - /* If we have already tested for this locale entry there has to - be one data set in the list of loaded domains. */ - retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname, - strlen (dirname) + 1, 0, locale, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, domainname, 0); - if (retval != NULL) - { - /* We know something about this locale. */ - int cnt; - - if (retval->decided == 0) - _nl_load_domain (retval, domainbinding); - - if (retval->data != NULL) - return retval; - - for (cnt = 0; retval->successor[cnt] != NULL; ++cnt) - { - if (retval->successor[cnt]->decided == 0) - _nl_load_domain (retval->successor[cnt], domainbinding); - - if (retval->successor[cnt]->data != NULL) - break; - } - return cnt >= 0 ? retval : NULL; - /* NOTREACHED */ - } - - /* See whether the locale value is an alias. If yes its value - *overwrites* the alias name. No test for the original value is - done. */ - alias_value = _nl_expand_alias (locale); - if (alias_value != NULL) - { -#if defined _LIBC || defined HAVE_STRDUP - locale = strdup (alias_value); - if (locale == NULL) - return NULL; -#else - size_t len = strlen (alias_value) + 1; - locale = (char *) malloc (len); - if (locale == NULL) - return NULL; - - memcpy (locale, alias_value, len); -#endif - } - - /* Now we determine the single parts of the locale name. First - look for the language. Termination symbols are `_' and `@' if - we use XPG4 style, and `_', `+', and `,' if we use CEN syntax. */ - mask = _nl_explode_name (locale, &language, &modifier, &territory, - &codeset, &normalized_codeset, &special, - &sponsor, &revision); - - /* Create all possible locale entries which might be interested in - generalization. */ - retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname, - strlen (dirname) + 1, mask, language, territory, - codeset, normalized_codeset, modifier, special, - sponsor, revision, domainname, 1); - if (retval == NULL) - /* This means we are out of core. */ - return NULL; - - if (retval->decided == 0) - _nl_load_domain (retval, domainbinding); - if (retval->data == NULL) - { - int cnt; - for (cnt = 0; retval->successor[cnt] != NULL; ++cnt) - { - if (retval->successor[cnt]->decided == 0) - _nl_load_domain (retval->successor[cnt], domainbinding); - if (retval->successor[cnt]->data != NULL) - break; - } - } - - /* The room for an alias was dynamically allocated. Free it now. */ - if (alias_value != NULL) - free (locale); - - /* The space for normalized_codeset is dynamically allocated. Free it. */ - if (mask & XPG_NORM_CODESET) - free ((void *) normalized_codeset); - - return retval; -} - - -#ifdef _LIBC -static void __attribute__ ((unused)) -free_mem (void) -{ - struct loaded_l10nfile *runp = _nl_loaded_domains; - - while (runp != NULL) - { - struct loaded_l10nfile *here = runp; - if (runp->data != NULL) - _nl_unload_domain ((struct loaded_domain *) runp->data); - runp = runp->next; - free ((char *) here->filename); - free (here); - } -} - -text_set_element (__libc_subfreeres, free_mem); -#endif diff --git a/intl/gettext.c b/intl/gettext.c deleted file mode 100644 index 22a6c24..0000000 --- a/intl/gettext.c +++ /dev/null @@ -1,64 +0,0 @@ -/* Implementation of gettext(3) function. - Copyright (C) 1995, 1997, 2000, 2001 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifdef _LIBC -# define __need_NULL -# include -#else -# include /* Just for NULL. */ -#endif - -#include "gettextP.h" -#ifdef _LIBC -# include -#else -# include "libgnuintl.h" -#endif - -/* @@ end of prolog @@ */ - -/* Names for the libintl functions are a problem. They must not clash - with existing names and they should follow ANSI C. But this source - code is also used in GNU C Library where the names have a __ - prefix. So we have to make a difference here. */ -#ifdef _LIBC -# define GETTEXT __gettext -# define DCGETTEXT __dcgettext -#else -# define GETTEXT gettext__ -# define DCGETTEXT dcgettext__ -#endif - -/* Look up MSGID in the current default message catalog for the current - LC_MESSAGES locale. If not found, returns MSGID itself (the default - text). */ -char * -GETTEXT (msgid) - const char *msgid; -{ - return DCGETTEXT (NULL, msgid, LC_MESSAGES); -} - -#ifdef _LIBC -/* Alias for function name in GNU C Library. */ -weak_alias (__gettext, gettext); -#endif diff --git a/intl/gettext.h b/intl/gettext.h deleted file mode 100644 index 6f5d760..0000000 --- a/intl/gettext.h +++ /dev/null @@ -1,102 +0,0 @@ -/* Description of GNU message catalog format: general file layout. - Copyright (C) 1995, 1997, 2000, 2001 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library 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 _GETTEXT_H -#define _GETTEXT_H 1 - -#if HAVE_LIMITS_H || _LIBC -# include -#endif - -/* @@ end of prolog @@ */ - -/* The magic number of the GNU message catalog format. */ -#define _MAGIC 0x950412de -#define _MAGIC_SWAPPED 0xde120495 - -/* Revision number of the currently used .mo (binary) file format. */ -#define MO_REVISION_NUMBER 0 - -/* The following contortions are an attempt to use the C preprocessor - to determine an unsigned integral type that is 32 bits wide. An - alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but - as of version autoconf-2.13, the AC_CHECK_SIZEOF macro doesn't work - when cross-compiling. */ - -#if __STDC__ -# define UINT_MAX_32_BITS 4294967295U -#else -# define UINT_MAX_32_BITS 0xFFFFFFFF -#endif - -/* If UINT_MAX isn't defined, assume it's a 32-bit type. - This should be valid for all systems GNU cares about because - that doesn't include 16-bit systems, and only modern systems - (that certainly have ) have 64+-bit integral types. */ - -#ifndef UINT_MAX -# define UINT_MAX UINT_MAX_32_BITS -#endif - -#if UINT_MAX == UINT_MAX_32_BITS -typedef unsigned nls_uint32; -#else -# if USHRT_MAX == UINT_MAX_32_BITS -typedef unsigned short nls_uint32; -# else -# if ULONG_MAX == UINT_MAX_32_BITS -typedef unsigned long nls_uint32; -# else - /* The following line is intended to throw an error. Using #error is - not portable enough. */ - "Cannot determine unsigned 32-bit data type." -# endif -# endif -#endif - - -/* Header for binary .mo file format. */ -struct mo_file_header -{ - /* The magic number. */ - nls_uint32 magic; - /* The revision number of the file format. */ - nls_uint32 revision; - /* The number of strings pairs. */ - nls_uint32 nstrings; - /* Offset of table with start offsets of original strings. */ - nls_uint32 orig_tab_offset; - /* Offset of table with start offsets of translation strings. */ - nls_uint32 trans_tab_offset; - /* Size of hashing table. */ - nls_uint32 hash_tab_size; - /* Offset of first hashing entry. */ - nls_uint32 hash_tab_offset; -}; - -struct string_desc -{ - /* Length of addressed string. */ - nls_uint32 length; - /* Offset of string in file. */ - nls_uint32 offset; -}; - -/* @@ begin of epilog @@ */ - -#endif /* gettext.h */ diff --git a/intl/gettextP.h b/intl/gettextP.h deleted file mode 100644 index 43de1cd..0000000 --- a/intl/gettextP.h +++ /dev/null @@ -1,252 +0,0 @@ -/* Header describing internals of libintl library. - Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. - Written by Ulrich Drepper , 1995. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library 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 _GETTEXTP_H -#define _GETTEXTP_H - -#include /* Get size_t. */ - -#ifdef _LIBC -# include "../iconv/gconv_int.h" -#else -# if HAVE_ICONV -# include -# endif -#endif - -#include "loadinfo.h" - -#include "gettext.h" /* Get nls_uint32. */ - -/* @@ end of prolog @@ */ - -#ifndef PARAMS -# if __STDC__ -# define PARAMS(args) args -# else -# define PARAMS(args) () -# endif -#endif - -#ifndef internal_function -# define internal_function -#endif - -/* Tell the compiler when a conditional or integer expression is - almost always true or almost always false. */ -#ifndef HAVE_BUILTIN_EXPECT -# define __builtin_expect(expr, val) (expr) -#endif - -#ifndef W -# define W(flag, data) ((flag) ? SWAP (data) : (data)) -#endif - - -#ifdef _LIBC -# include -# define SWAP(i) bswap_32 (i) -#else -static inline nls_uint32 -SWAP (i) - nls_uint32 i; -{ - return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24); -} -#endif - - -/* This is the representation of the expressions to determine the - plural form. */ -struct expression -{ - int nargs; /* Number of arguments. */ - enum operator - { - /* Without arguments: */ - var, /* The variable "n". */ - num, /* Decimal number. */ - /* Unary operators: */ - lnot, /* Logical NOT. */ - /* Binary operators: */ - mult, /* Multiplication. */ - divide, /* Division. */ - module, /* Module operation. */ - plus, /* Addition. */ - minus, /* Subtraction. */ - less_than, /* Comparison. */ - greater_than, /* Comparison. */ - less_or_equal, /* Comparison. */ - greater_or_equal, /* Comparison. */ - equal, /* Comparision for equality. */ - not_equal, /* Comparision for inequality. */ - land, /* Logical AND. */ - lor, /* Logical OR. */ - /* Ternary operators: */ - qmop /* Question mark operator. */ - } operation; - union - { - unsigned long int num; /* Number value for `num'. */ - struct expression *args[3]; /* Up to three arguments. */ - } val; -}; - -/* This is the data structure to pass information to the parser and get - the result in a thread-safe way. */ -struct parse_args -{ - const char *cp; - struct expression *res; -}; - - -/* The representation of an opened message catalog. */ -struct loaded_domain -{ - const char *data; - int use_mmap; - size_t mmap_size; - int must_swap; - nls_uint32 nstrings; - struct string_desc *orig_tab; - struct string_desc *trans_tab; - nls_uint32 hash_size; - nls_uint32 *hash_tab; - int codeset_cntr; -#ifdef _LIBC - __gconv_t conv; -#else -# if HAVE_ICONV - iconv_t conv; -# endif -#endif - char **conv_tab; - - struct expression *plural; - unsigned long int nplurals; -}; - -/* We want to allocate a string at the end of the struct. But ISO C - doesn't allow zero sized arrays. */ -#ifdef __GNUC__ -# define ZERO 0 -#else -# define ZERO 1 -#endif - -/* A set of settings bound to a message domain. Used to store settings - from bindtextdomain() and bind_textdomain_codeset(). */ -struct binding -{ - struct binding *next; - char *dirname; - int codeset_cntr; /* Incremented each time codeset changes. */ - char *codeset; - char domainname[ZERO]; -}; - -/* A counter which is incremented each time some previous translations - become invalid. - This variable is part of the external ABI of the GNU libintl. */ -extern int _nl_msg_cat_cntr; - -struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname, - char *__locale, - const char *__domainname, - struct binding *__domainbinding)) - internal_function; -void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain, - struct binding *__domainbinding)) - internal_function; -void _nl_unload_domain PARAMS ((struct loaded_domain *__domain)) - internal_function; -const char *_nl_init_domain_conv PARAMS ((struct loaded_l10nfile *__domain_file, - struct loaded_domain *__domain, - struct binding *__domainbinding)) - internal_function; -void _nl_free_domain_conv PARAMS ((struct loaded_domain *__domain)) - internal_function; - -char *_nl_find_msg PARAMS ((struct loaded_l10nfile *domain_file, - struct binding *domainbinding, - const char *msgid, size_t *lengthp)) - internal_function; - -#ifdef _LIBC -extern char *__gettext PARAMS ((const char *__msgid)); -extern char *__dgettext PARAMS ((const char *__domainname, - const char *__msgid)); -extern char *__dcgettext PARAMS ((const char *__domainname, - const char *__msgid, int __category)); -extern char *__ngettext PARAMS ((const char *__msgid1, const char *__msgid2, - unsigned long int __n)); -extern char *__dngettext PARAMS ((const char *__domainname, - const char *__msgid1, const char *__msgid2, - unsigned long int n)); -extern char *__dcngettext PARAMS ((const char *__domainname, - const char *__msgid1, const char *__msgid2, - unsigned long int __n, int __category)); -extern char *__dcigettext PARAMS ((const char *__domainname, - const char *__msgid1, const char *__msgid2, - int __plural, unsigned long int __n, - int __category)); -extern char *__textdomain PARAMS ((const char *__domainname)); -extern char *__bindtextdomain PARAMS ((const char *__domainname, - const char *__dirname)); -extern char *__bind_textdomain_codeset PARAMS ((const char *__domainname, - const char *__codeset)); -#else -extern char *gettext__ PARAMS ((const char *__msgid)); -extern char *dgettext__ PARAMS ((const char *__domainname, - const char *__msgid)); -extern char *dcgettext__ PARAMS ((const char *__domainname, - const char *__msgid, int __category)); -extern char *ngettext__ PARAMS ((const char *__msgid1, const char *__msgid2, - unsigned long int __n)); -extern char *dngettext__ PARAMS ((const char *__domainname, - const char *__msgid1, const char *__msgid2, - unsigned long int __n)); -extern char *dcngettext__ PARAMS ((const char *__domainname, - const char *__msgid1, const char *__msgid2, - unsigned long int __n, int __category)); -extern char *dcigettext__ PARAMS ((const char *__domainname, - const char *__msgid1, const char *__msgid2, - int __plural, unsigned long int __n, - int __category)); -extern char *textdomain__ PARAMS ((const char *__domainname)); -extern char *bindtextdomain__ PARAMS ((const char *__domainname, - const char *__dirname)); -extern char *bind_textdomain_codeset__ PARAMS ((const char *__domainname, - const char *__codeset)); -#endif - -#ifdef _LIBC -extern void __gettext_free_exp PARAMS ((struct expression *exp)) - internal_function; -extern int __gettextparse PARAMS ((void *arg)); -#else -extern void gettext_free_exp__ PARAMS ((struct expression *exp)) - internal_function; -extern int gettextparse__ PARAMS ((void *arg)); -#endif - -/* @@ begin of epilog @@ */ - -#endif /* gettextP.h */ diff --git a/intl/hash-string.h b/intl/hash-string.h deleted file mode 100644 index ccb7acc..0000000 --- a/intl/hash-string.h +++ /dev/null @@ -1,59 +0,0 @@ -/* Description of GNU message catalog format: string hashing function. - Copyright (C) 1995, 1997, 1998, 2000, 2001 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library 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. */ - -/* @@ end of prolog @@ */ - -#ifndef PARAMS -# if __STDC__ -# define PARAMS(Args) Args -# else -# define PARAMS(Args) () -# endif -#endif - -/* We assume to have `unsigned long int' value with at least 32 bits. */ -#define HASHWORDBITS 32 - - -/* Defines the so called `hashpjw' function by P.J. Weinberger - [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools, - 1986, 1987 Bell Telephone Laboratories, Inc.] */ -static unsigned long int hash_string PARAMS ((const char *__str_param)); - -static inline unsigned long int -hash_string (str_param) - const char *str_param; -{ - unsigned long int hval, g; - const char *str = str_param; - - /* Compute the hash value for the given string. */ - hval = 0; - while (*str != '\0') - { - hval <<= 4; - hval += (unsigned long int) *str++; - g = hval & ((unsigned long int) 0xf << (HASHWORDBITS - 4)); - if (g != 0) - { - hval ^= g >> (HASHWORDBITS - 8); - hval ^= g; - } - } - return hval; -} diff --git a/intl/intl-compat.c b/intl/intl-compat.c deleted file mode 100644 index 0a06ce9..0000000 --- a/intl/intl-compat.c +++ /dev/null @@ -1,166 +0,0 @@ -/* intl-compat.c - Stub functions to call gettext functions from GNU gettext - Library. - Copyright (C) 1995, 2000, 2001 Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "libgnuintl.h" -#include "gettextP.h" - -/* @@ end of prolog @@ */ - -/* This file redirects the gettext functions (without prefix or suffix) to - those defined in the included GNU gettext library (with "__" suffix). - It is compiled into libintl when the included GNU gettext library is - configured --with-included-gettext. - - This redirection works also in the case that the system C library or - the system libintl library contain gettext/textdomain/... functions. - If it didn't, we would need to add preprocessor level redirections to - libgnuintl.h of the following form: - -# define gettext gettext__ -# define dgettext dgettext__ -# define dcgettext dcgettext__ -# define ngettext ngettext__ -# define dngettext dngettext__ -# define dcngettext dcngettext__ -# define textdomain textdomain__ -# define bindtextdomain bindtextdomain__ -# define bind_textdomain_codeset bind_textdomain_codeset__ - - How does this redirection work? There are two cases. - A. When libintl.a is linked into an executable, it works because - functions defined in the executable always override functions in - the shared libraries. - B. When libintl.so is used, it works because - 1. those systems defining gettext/textdomain/... in the C library - (namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer) are - ELF systems and define these symbols as weak, thus explicitly - letting other shared libraries override it. - 2. those systems defining gettext/textdomain/... in a standalone - libintl.so library (namely, Solaris 2.3 and newer) have this - shared library in /usr/lib, and the linker will search /usr/lib - *after* the directory where the GNU gettext library is installed. - - A third case, namely when libintl.a is linked into a shared library - whose name is not libintl.so, is not supported. In this case, on - Solaris, when -lintl precedes the linker option for the shared library - containing GNU gettext, the system's gettext would indeed override - the GNU gettext. Anyone doing this kind of stuff must be clever enough - to 1. compile libintl.a with -fPIC, 2. remove -lintl from his linker - command line. */ - - -#undef gettext -#undef dgettext -#undef dcgettext -#undef ngettext -#undef dngettext -#undef dcngettext -#undef textdomain -#undef bindtextdomain -#undef bind_textdomain_codeset - - -char * -gettext (msgid) - const char *msgid; -{ - return gettext__ (msgid); -} - - -char * -dgettext (domainname, msgid) - const char *domainname; - const char *msgid; -{ - return dgettext__ (domainname, msgid); -} - - -char * -dcgettext (domainname, msgid, category) - const char *domainname; - const char *msgid; - int category; -{ - return dcgettext__ (domainname, msgid, category); -} - - -char * -ngettext (msgid1, msgid2, n) - const char *msgid1; - const char *msgid2; - unsigned long int n; -{ - return ngettext__ (msgid1, msgid2, n); -} - - -char * -dngettext (domainname, msgid1, msgid2, n) - const char *domainname; - const char *msgid1; - const char *msgid2; - unsigned long int n; -{ - return dngettext__ (domainname, msgid1, msgid2, n); -} - - -char * -dcngettext (domainname, msgid1, msgid2, n, category) - const char *domainname; - const char *msgid1; - const char *msgid2; - unsigned long int n; - int category; -{ - return dcngettext__ (domainname, msgid1, msgid2, n, category); -} - - -char * -textdomain (domainname) - const char *domainname; -{ - return textdomain__ (domainname); -} - - -char * -bindtextdomain (domainname, dirname) - const char *domainname; - const char *dirname; -{ - return bindtextdomain__ (domainname, dirname); -} - - -char * -bind_textdomain_codeset (domainname, codeset) - const char *domainname; - const char *codeset; -{ - return bind_textdomain_codeset__ (domainname, codeset); -} diff --git a/intl/l10nflist.c b/intl/l10nflist.c deleted file mode 100644 index 533e94b..0000000 --- a/intl/l10nflist.c +++ /dev/null @@ -1,405 +0,0 @@ -/* Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. - Contributed by Ulrich Drepper , 1995. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library 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. */ - -/* Tell glibc's to provide a prototype for stpcpy(). - This must come before because may include - , and once has been included, it's too late. */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#if !HAVE_STRCHR && !defined _LIBC -# ifndef strchr -# define strchr index -# endif -#endif - -#if defined _LIBC || defined HAVE_ARGZ_H -# include -#endif -#include -#include -#include - -#include "loadinfo.h" - -/* On some strange systems still no definition of NULL is found. Sigh! */ -#ifndef NULL -# if defined __STDC__ && __STDC__ -# define NULL ((void *) 0) -# else -# define NULL 0 -# endif -#endif - -/* @@ end of prolog @@ */ - -#ifdef _LIBC -/* Rename the non ANSI C functions. This is required by the standard - because some ANSI C functions will require linking with this object - file and the name space must not be polluted. */ -# ifndef stpcpy -# define stpcpy(dest, src) __stpcpy(dest, src) -# endif -#else -# ifndef HAVE_STPCPY -static char *stpcpy PARAMS ((char *dest, const char *src)); -# endif -#endif - -/* Define function which are usually not available. */ - -#if !defined _LIBC && !defined HAVE___ARGZ_COUNT -/* Returns the number of strings in ARGZ. */ -static size_t argz_count__ PARAMS ((const char *argz, size_t len)); - -static size_t -argz_count__ (argz, len) - const char *argz; - size_t len; -{ - size_t count = 0; - while (len > 0) - { - size_t part_len = strlen (argz); - argz += part_len + 1; - len -= part_len + 1; - count++; - } - return count; -} -# undef __argz_count -# define __argz_count(argz, len) argz_count__ (argz, len) -#endif /* !_LIBC && !HAVE___ARGZ_COUNT */ - -#if !defined _LIBC && !defined HAVE___ARGZ_STRINGIFY -/* Make '\0' separated arg vector ARGZ printable by converting all the '\0's - except the last into the character SEP. */ -static void argz_stringify__ PARAMS ((char *argz, size_t len, int sep)); - -static void -argz_stringify__ (argz, len, sep) - char *argz; - size_t len; - int sep; -{ - while (len > 0) - { - size_t part_len = strlen (argz); - argz += part_len; - len -= part_len + 1; - if (len > 0) - *argz++ = sep; - } -} -# undef __argz_stringify -# define __argz_stringify(argz, len, sep) argz_stringify__ (argz, len, sep) -#endif /* !_LIBC && !HAVE___ARGZ_STRINGIFY */ - -#if !defined _LIBC && !defined HAVE___ARGZ_NEXT -static char *argz_next__ PARAMS ((char *argz, size_t argz_len, - const char *entry)); - -static char * -argz_next__ (argz, argz_len, entry) - char *argz; - size_t argz_len; - const char *entry; -{ - if (entry) - { - if (entry < argz + argz_len) - entry = strchr (entry, '\0') + 1; - - return entry >= argz + argz_len ? NULL : (char *) entry; - } - else - if (argz_len > 0) - return argz; - else - return 0; -} -# undef __argz_next -# define __argz_next(argz, len, entry) argz_next__ (argz, len, entry) -#endif /* !_LIBC && !HAVE___ARGZ_NEXT */ - - -/* Return number of bits set in X. */ -static int pop PARAMS ((int x)); - -static inline int -pop (x) - int x; -{ - /* We assume that no more than 16 bits are used. */ - x = ((x & ~0x5555) >> 1) + (x & 0x5555); - x = ((x & ~0x3333) >> 2) + (x & 0x3333); - x = ((x >> 4) + x) & 0x0f0f; - x = ((x >> 8) + x) & 0xff; - - return x; -} - - -struct loaded_l10nfile * -_nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language, - territory, codeset, normalized_codeset, modifier, special, - sponsor, revision, filename, do_allocate) - struct loaded_l10nfile **l10nfile_list; - const char *dirlist; - size_t dirlist_len; - int mask; - const char *language; - const char *territory; - const char *codeset; - const char *normalized_codeset; - const char *modifier; - const char *special; - const char *sponsor; - const char *revision; - const char *filename; - int do_allocate; -{ - char *abs_filename; - struct loaded_l10nfile *last = NULL; - struct loaded_l10nfile *retval; - char *cp; - size_t entries; - int cnt; - - /* Allocate room for the full file name. */ - abs_filename = (char *) malloc (dirlist_len - + strlen (language) - + ((mask & TERRITORY) != 0 - ? strlen (territory) + 1 : 0) - + ((mask & XPG_CODESET) != 0 - ? strlen (codeset) + 1 : 0) - + ((mask & XPG_NORM_CODESET) != 0 - ? strlen (normalized_codeset) + 1 : 0) - + (((mask & XPG_MODIFIER) != 0 - || (mask & CEN_AUDIENCE) != 0) - ? strlen (modifier) + 1 : 0) - + ((mask & CEN_SPECIAL) != 0 - ? strlen (special) + 1 : 0) - + (((mask & CEN_SPONSOR) != 0 - || (mask & CEN_REVISION) != 0) - ? (1 + ((mask & CEN_SPONSOR) != 0 - ? strlen (sponsor) + 1 : 0) - + ((mask & CEN_REVISION) != 0 - ? strlen (revision) + 1 : 0)) : 0) - + 1 + strlen (filename) + 1); - - if (abs_filename == NULL) - return NULL; - - retval = NULL; - last = NULL; - - /* Construct file name. */ - memcpy (abs_filename, dirlist, dirlist_len); - __argz_stringify (abs_filename, dirlist_len, PATH_SEPARATOR); - cp = abs_filename + (dirlist_len - 1); - *cp++ = '/'; - cp = stpcpy (cp, language); - - if ((mask & TERRITORY) != 0) - { - *cp++ = '_'; - cp = stpcpy (cp, territory); - } - if ((mask & XPG_CODESET) != 0) - { - *cp++ = '.'; - cp = stpcpy (cp, codeset); - } - if ((mask & XPG_NORM_CODESET) != 0) - { - *cp++ = '.'; - cp = stpcpy (cp, normalized_codeset); - } - if ((mask & (XPG_MODIFIER | CEN_AUDIENCE)) != 0) - { - /* This component can be part of both syntaces but has different - leading characters. For CEN we use `+', else `@'. */ - *cp++ = (mask & CEN_AUDIENCE) != 0 ? '+' : '@'; - cp = stpcpy (cp, modifier); - } - if ((mask & CEN_SPECIAL) != 0) - { - *cp++ = '+'; - cp = stpcpy (cp, special); - } - if ((mask & (CEN_SPONSOR | CEN_REVISION)) != 0) - { - *cp++ = ','; - if ((mask & CEN_SPONSOR) != 0) - cp = stpcpy (cp, sponsor); - if ((mask & CEN_REVISION) != 0) - { - *cp++ = '_'; - cp = stpcpy (cp, revision); - } - } - - *cp++ = '/'; - stpcpy (cp, filename); - - /* Look in list of already loaded domains whether it is already - available. */ - last = NULL; - for (retval = *l10nfile_list; retval != NULL; retval = retval->next) - if (retval->filename != NULL) - { - int compare = strcmp (retval->filename, abs_filename); - if (compare == 0) - /* We found it! */ - break; - if (compare < 0) - { - /* It's not in the list. */ - retval = NULL; - break; - } - - last = retval; - } - - if (retval != NULL || do_allocate == 0) - { - free (abs_filename); - return retval; - } - - retval = (struct loaded_l10nfile *) - malloc (sizeof (*retval) + (__argz_count (dirlist, dirlist_len) - * (1 << pop (mask)) - * sizeof (struct loaded_l10nfile *))); - if (retval == NULL) - return NULL; - - retval->filename = abs_filename; - retval->decided = (__argz_count (dirlist, dirlist_len) != 1 - || ((mask & XPG_CODESET) != 0 - && (mask & XPG_NORM_CODESET) != 0)); - retval->data = NULL; - - if (last == NULL) - { - retval->next = *l10nfile_list; - *l10nfile_list = retval; - } - else - { - retval->next = last->next; - last->next = retval; - } - - entries = 0; - /* If the DIRLIST is a real list the RETVAL entry corresponds not to - a real file. So we have to use the DIRLIST separation mechanism - of the inner loop. */ - cnt = __argz_count (dirlist, dirlist_len) == 1 ? mask - 1 : mask; - for (; cnt >= 0; --cnt) - if ((cnt & ~mask) == 0 - && ((cnt & CEN_SPECIFIC) == 0 || (cnt & XPG_SPECIFIC) == 0) - && ((cnt & XPG_CODESET) == 0 || (cnt & XPG_NORM_CODESET) == 0)) - { - /* Iterate over all elements of the DIRLIST. */ - char *dir = NULL; - - while ((dir = __argz_next ((char *) dirlist, dirlist_len, dir)) - != NULL) - retval->successor[entries++] - = _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1, cnt, - language, territory, codeset, - normalized_codeset, modifier, special, - sponsor, revision, filename, 1); - } - retval->successor[entries] = NULL; - - return retval; -} - -/* Normalize codeset name. There is no standard for the codeset - names. Normalization allows the user to use any of the common - names. The return value is dynamically allocated and has to be - freed by the caller. */ -const char * -_nl_normalize_codeset (codeset, name_len) - const char *codeset; - size_t name_len; -{ - int len = 0; - int only_digit = 1; - char *retval; - char *wp; - size_t cnt; - - for (cnt = 0; cnt < name_len; ++cnt) - if (isalnum (codeset[cnt])) - { - ++len; - - if (isalpha (codeset[cnt])) - only_digit = 0; - } - - retval = (char *) malloc ((only_digit ? 3 : 0) + len + 1); - - if (retval != NULL) - { - if (only_digit) - wp = stpcpy (retval, "iso"); - else - wp = retval; - - for (cnt = 0; cnt < name_len; ++cnt) - if (isalpha (codeset[cnt])) - *wp++ = tolower (codeset[cnt]); - else if (isdigit (codeset[cnt])) - *wp++ = codeset[cnt]; - - *wp = '\0'; - } - - return (const char *) retval; -} - - -/* @@ begin of epilog @@ */ - -/* We don't want libintl.a to depend on any other library. So we - avoid the non-standard function stpcpy. In GNU C Library this - function is available, though. Also allow the symbol HAVE_STPCPY - to be defined. */ -#if !_LIBC && !HAVE_STPCPY -static char * -stpcpy (dest, src) - char *dest; - const char *src; -{ - while ((*dest++ = *src++) != '\0') - /* Do nothing. */ ; - return dest - 1; -} -#endif diff --git a/intl/libgettext.h b/intl/libgettext.h deleted file mode 100644 index c5be54a..0000000 --- a/intl/libgettext.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Convenience header for conditional use of GNU . - Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library 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 _LIBGETTEXT_H -#define _LIBGETTEXT_H 1 - -/* NLS can be disabled through the configure --disable-nls option. */ -#if ENABLE_NLS - -/* Get declarations of GNU message catalog functions. */ -# include - -#else - -# define gettext(Msgid) (Msgid) -# define dgettext(Domainname, Msgid) (Msgid) -# define dcgettext(Domainname, Msgid, Category) (Msgid) -# define ngettext(Msgid1, Msgid2, N) \ - ((N) == 1 ? (char *) (Msgid1) : (char *) (Msgid2)) -# define dngettext(Domainname, Msgid1, Msgid2, N) \ - ((N) == 1 ? (char *) (Msgid1) : (char *) (Msgid2)) -# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ - ((N) == 1 ? (char *) (Msgid1) : (char *) (Msgid2)) -# define textdomain(Domainname) ((char *) (Domainname)) -# define bindtextdomain(Domainname, Dirname) ((char *) (Dirname)) -# define bind_textdomain_codeset(Domainname, Codeset) ((char *) (Codeset)) - -#endif - -/* For automatical extraction of messages sometimes no real - translation is needed. Instead the string itself is the result. */ -#define gettext_noop(Str) (Str) - -#endif /* _LIBGETTEXT_H */ diff --git a/intl/libgnuintl.h b/intl/libgnuintl.h deleted file mode 100644 index f891deb..0000000 --- a/intl/libgnuintl.h +++ /dev/null @@ -1,128 +0,0 @@ -/* Message catalogs for internationalization. - Copyright (C) 1995-1997, 2000, 2001 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library 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 _LIBINTL_H -#define _LIBINTL_H 1 - -#include - -/* The LC_MESSAGES locale category is the category used by the functions - gettext() and dgettext(). It is specified in POSIX, but not in ANSI C. - On systems that don't define it, use an arbitrary value instead. - On Solaris, defines __LOCALE_H then includes (i.e. - this file!) and then only defines LC_MESSAGES. To avoid a redefinition - warning, don't define LC_MESSAGES in this case. */ -#if !defined LC_MESSAGES && !defined __LOCALE_H -# define LC_MESSAGES 1729 -#endif - -/* We define an additional symbol to signal that we use the GNU - implementation of gettext. */ -#define __USE_GNU_GETTEXT 1 - -/* Resolve a platform specific conflict on DJGPP. GNU gettext takes - precedence over _conio_gettext. */ -#ifdef __DJGPP__ -# undef gettext -# define gettext gettext -#endif - -#ifndef PARAMS -# if __STDC__ || defined __cplusplus -# define PARAMS(args) args -# else -# define PARAMS(args) () -# endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* Look up MSGID in the current default message catalog for the current - LC_MESSAGES locale. If not found, returns MSGID itself (the default - text). */ -extern char *gettext PARAMS ((const char *__msgid)); - -/* Look up MSGID in the DOMAINNAME message catalog for the current - LC_MESSAGES locale. */ -extern char *dgettext PARAMS ((const char *__domainname, const char *__msgid)); - -/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY - locale. */ -extern char *dcgettext PARAMS ((const char *__domainname, const char *__msgid, - int __category)); - - -/* Similar to `gettext' but select the plural form corresponding to the - number N. */ -extern char *ngettext PARAMS ((const char *__msgid1, const char *__msgid2, - unsigned long int __n)); - -/* Similar to `dgettext' but select the plural form corresponding to the - number N. */ -extern char *dngettext PARAMS ((const char *__domainname, const char *__msgid1, - const char *__msgid2, unsigned long int __n)); - -/* Similar to `dcgettext' but select the plural form corresponding to the - number N. */ -extern char *dcngettext PARAMS ((const char *__domainname, const char *__msgid1, - const char *__msgid2, unsigned long int __n, - int __category)); - - -/* Set the current default message catalog to DOMAINNAME. - If DOMAINNAME is null, return the current default. - If DOMAINNAME is "", reset to the default of "messages". */ -extern char *textdomain PARAMS ((const char *__domainname)); - -/* Specify that the DOMAINNAME message catalog will be found - in DIRNAME rather than in the system locale data base. */ -extern char *bindtextdomain PARAMS ((const char *__domainname, - const char *__dirname)); - -/* Specify the character encoding in which the messages from the - DOMAINNAME message catalog will be returned. */ -extern char *bind_textdomain_codeset PARAMS ((const char *__domainname, - const char *__codeset)); - - -/* Optimized version of the functions above. */ -#if defined __OPTIMIZED -/* These are macros, but could also be inline functions. */ - -# define gettext(msgid) \ - dgettext (NULL, msgid) - -# define dgettext(domainname, msgid) \ - dcgettext (domainname, msgid, LC_MESSAGES) - -# define ngettext(msgid1, msgid2, n) \ - dngettext (NULL, msgid1, msgid2, n) - -# define dngettext(domainname, msgid1, msgid2, n) \ - dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES) - -#endif /* Optimizing. */ - - -#ifdef __cplusplus -} -#endif - -#endif /* libintl.h */ diff --git a/intl/loadinfo.h b/intl/loadinfo.h deleted file mode 100644 index b861260..0000000 --- a/intl/loadinfo.h +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright (C) 1996-1999, 2000, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1996. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library 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 _LOADINFO_H -#define _LOADINFO_H 1 - -#ifndef PARAMS -# if __STDC__ -# define PARAMS(args) args -# else -# define PARAMS(args) () -# endif -#endif - -#ifndef internal_function -# define internal_function -#endif - -/* Tell the compiler when a conditional or integer expression is - almost always true or almost always false. */ -#ifndef HAVE_BUILTIN_EXPECT -# define __builtin_expect(expr, val) (expr) -#endif - -/* Separator in PATH like lists of pathnames. */ -#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__ - /* Win32, OS/2, DOS */ -# define PATH_SEPARATOR ';' -#else - /* Unix */ -# define PATH_SEPARATOR ':' -#endif - -/* Encoding of locale name parts. */ -#define CEN_REVISION 1 -#define CEN_SPONSOR 2 -#define CEN_SPECIAL 4 -#define XPG_NORM_CODESET 8 -#define XPG_CODESET 16 -#define TERRITORY 32 -#define CEN_AUDIENCE 64 -#define XPG_MODIFIER 128 - -#define CEN_SPECIFIC (CEN_REVISION|CEN_SPONSOR|CEN_SPECIAL|CEN_AUDIENCE) -#define XPG_SPECIFIC (XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER) - - -struct loaded_l10nfile -{ - const char *filename; - int decided; - - const void *data; - - struct loaded_l10nfile *next; - struct loaded_l10nfile *successor[1]; -}; - - -/* Normalize codeset name. There is no standard for the codeset - names. Normalization allows the user to use any of the common - names. The return value is dynamically allocated and has to be - freed by the caller. */ -extern const char *_nl_normalize_codeset PARAMS ((const char *codeset, - size_t name_len)); - -extern struct loaded_l10nfile * -_nl_make_l10nflist PARAMS ((struct loaded_l10nfile **l10nfile_list, - const char *dirlist, size_t dirlist_len, int mask, - const char *language, const char *territory, - const char *codeset, - const char *normalized_codeset, - const char *modifier, const char *special, - const char *sponsor, const char *revision, - const char *filename, int do_allocate)); - - -extern const char *_nl_expand_alias PARAMS ((const char *name)); - -/* normalized_codeset is dynamically allocated and has to be freed by - the caller. */ -extern int _nl_explode_name PARAMS ((char *name, const char **language, - const char **modifier, - const char **territory, - const char **codeset, - const char **normalized_codeset, - const char **special, - const char **sponsor, - const char **revision)); - -extern char *_nl_find_language PARAMS ((const char *name)); - -#endif /* loadinfo.h */ diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c deleted file mode 100644 index f99ebee..0000000 --- a/intl/loadmsgcat.c +++ /dev/null @@ -1,567 +0,0 @@ -/* Load needed message catalogs. - Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library 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. */ - -/* Tell glibc's to provide a prototype for mempcpy(). - This must come before because may include - , and once has been included, it's too late. */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include - -#ifdef __GNUC__ -# define alloca __builtin_alloca -# define HAVE_ALLOCA 1 -#else -# if defined HAVE_ALLOCA_H || defined _LIBC -# include -# else -# ifdef _AIX - #pragma alloca -# else -# ifndef alloca -char *alloca (); -# endif -# endif -# endif -#endif - -#include -#include - -#if defined HAVE_UNISTD_H || defined _LIBC -# include -#endif - -#ifdef _LIBC -# include -# include -#endif - -#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \ - || (defined _LIBC && defined _POSIX_MAPPED_FILES) -# include -# undef HAVE_MMAP -# define HAVE_MMAP 1 -#else -# undef HAVE_MMAP -#endif - -#include "gettext.h" -#include "gettextP.h" - -#ifdef _LIBC -# include "../locale/localeinfo.h" -#endif - -/* @@ end of prolog @@ */ - -#ifdef _LIBC -/* Rename the non ISO C functions. This is required by the standard - because some ISO C functions will require linking with this object - file and the name space must not be polluted. */ -# define open __open -# define close __close -# define read __read -# define mmap __mmap -# define munmap __munmap -#endif - -/* Names for the libintl functions are a problem. They must not clash - with existing names and they should follow ANSI C. But this source - code is also used in GNU C Library where the names have a __ - prefix. So we have to make a difference here. */ -#ifdef _LIBC -# define PLURAL_PARSE __gettextparse -#else -# define PLURAL_PARSE gettextparse__ -#endif - -/* For those losing systems which don't have `alloca' we have to add - some additional code emulating it. */ -#ifdef HAVE_ALLOCA -# define freea(p) /* nothing */ -#else -# define alloca(n) malloc (n) -# define freea(p) free (p) -#endif - -/* For systems that distinguish between text and binary I/O. - O_BINARY is usually declared in . */ -#if !defined O_BINARY && defined _O_BINARY - /* For MSC-compatible compilers. */ -# define O_BINARY _O_BINARY -# define O_TEXT _O_TEXT -#endif -#ifdef __BEOS__ - /* BeOS 5 has O_BINARY and O_TEXT, but they have no effect. */ -# undef O_BINARY -# undef O_TEXT -#endif -/* On reasonable systems, binary I/O is the default. */ -#ifndef O_BINARY -# define O_BINARY 0 -#endif - -/* We need a sign, whether a new catalog was loaded, which can be associated - with all translations. This is important if the translations are - cached by one of GCC's features. */ -int _nl_msg_cat_cntr; - -#if (defined __GNUC__ && !defined __APPLE_CC__) \ - || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) - -/* These structs are the constant expression for the germanic plural - form determination. It represents the expression "n != 1". */ -static const struct expression plvar = -{ - .nargs = 0, - .operation = var, -}; -static const struct expression plone = -{ - .nargs = 0, - .operation = num, - .val = - { - .num = 1 - } -}; -static struct expression germanic_plural = -{ - .nargs = 2, - .operation = not_equal, - .val = - { - .args = - { - [0] = (struct expression *) &plvar, - [1] = (struct expression *) &plone - } - } -}; - -# define INIT_GERMANIC_PLURAL() - -#else - -/* For compilers without support for ISO C 99 struct/union initializers: - Initialization at run-time. */ - -static struct expression plvar; -static struct expression plone; -static struct expression germanic_plural; - -static void -init_germanic_plural () -{ - if (plone.val.num == 0) - { - plvar.nargs = 0; - plvar.operation = var; - - plone.nargs = 0; - plone.operation = num; - plone.val.num = 1; - - germanic_plural.nargs = 2; - germanic_plural.operation = not_equal; - germanic_plural.val.args[0] = &plvar; - germanic_plural.val.args[1] = &plone; - } -} - -# define INIT_GERMANIC_PLURAL() init_germanic_plural () - -#endif - - -/* Initialize the codeset dependent parts of an opened message catalog. - Return the header entry. */ -const char * -internal_function -_nl_init_domain_conv (domain_file, domain, domainbinding) - struct loaded_l10nfile *domain_file; - struct loaded_domain *domain; - struct binding *domainbinding; -{ - /* Find out about the character set the file is encoded with. - This can be found (in textual form) in the entry "". If this - entry does not exist or if this does not contain the `charset=' - information, we will assume the charset matches the one the - current locale and we don't have to perform any conversion. */ - char *nullentry; - size_t nullentrylen; - - /* Preinitialize fields, to avoid recursion during _nl_find_msg. */ - domain->codeset_cntr = - (domainbinding != NULL ? domainbinding->codeset_cntr : 0); -#ifdef _LIBC - domain->conv = (__gconv_t) -1; -#else -# if HAVE_ICONV - domain->conv = (iconv_t) -1; -# endif -#endif - domain->conv_tab = NULL; - - /* Get the header entry. */ - nullentry = _nl_find_msg (domain_file, domainbinding, "", &nullentrylen); - - if (nullentry != NULL) - { -#if defined _LIBC || HAVE_ICONV - const char *charsetstr; - - charsetstr = strstr (nullentry, "charset="); - if (charsetstr != NULL) - { - size_t len; - char *charset; - const char *outcharset; - - charsetstr += strlen ("charset="); - len = strcspn (charsetstr, " \t\n"); - - charset = (char *) alloca (len + 1); -# if defined _LIBC || HAVE_MEMPCPY - *((char *) mempcpy (charset, charsetstr, len)) = '\0'; -# else - memcpy (charset, charsetstr, len); - charset[len] = '\0'; -# endif - - /* The output charset should normally be determined by the - locale. But sometimes the locale is not used or not correctly - set up, so we provide a possibility for the user to override - this. Moreover, the value specified through - bind_textdomain_codeset overrides both. */ - if (domainbinding != NULL && domainbinding->codeset != NULL) - outcharset = domainbinding->codeset; - else - { - outcharset = getenv ("OUTPUT_CHARSET"); - if (outcharset == NULL || outcharset[0] == '\0') - { -# ifdef _LIBC - outcharset = (*_nl_current[LC_CTYPE])->values[_NL_ITEM_INDEX (CODESET)].string; -# else -# if HAVE_ICONV - extern const char *locale_charset (void); - outcharset = locale_charset (); -# endif -# endif - } - } - -# ifdef _LIBC - /* We always want to use transliteration. */ - outcharset = norm_add_slashes (outcharset, "TRANSLIT"); - charset = norm_add_slashes (charset, NULL); - if (__gconv_open (outcharset, charset, &domain->conv, - GCONV_AVOID_NOCONV) - != __GCONV_OK) - domain->conv = (__gconv_t) -1; -# else -# if HAVE_ICONV - /* When using GNU libiconv, we want to use transliteration. */ -# if _LIBICONV_VERSION >= 0x0105 - len = strlen (outcharset); - { - char *tmp = (char *) alloca (len + 10 + 1); - memcpy (tmp, outcharset, len); - memcpy (tmp + len, "//TRANSLIT", 10 + 1); - outcharset = tmp; - } -# endif - domain->conv = iconv_open (outcharset, charset); -# if _LIBICONV_VERSION >= 0x0105 - freea (outcharset); -# endif -# endif -# endif - - freea (charset); - } -#endif /* _LIBC || HAVE_ICONV */ - } - - return nullentry; -} - -/* Frees the codeset dependent parts of an opened message catalog. */ -void -internal_function -_nl_free_domain_conv (domain) - struct loaded_domain *domain; -{ - if (domain->conv_tab != NULL && domain->conv_tab != (char **) -1) - free (domain->conv_tab); - -#ifdef _LIBC - if (domain->conv != (__gconv_t) -1) - __gconv_close (domain->conv); -#else -# if HAVE_ICONV - if (domain->conv != (iconv_t) -1) - iconv_close (domain->conv); -# endif -#endif -} - -/* Load the message catalogs specified by FILENAME. If it is no valid - message catalog do nothing. */ -void -internal_function -_nl_load_domain (domain_file, domainbinding) - struct loaded_l10nfile *domain_file; - struct binding *domainbinding; -{ - int fd; - size_t size; -#ifdef _LIBC - struct stat64 st; -#else - struct stat st; -#endif - struct mo_file_header *data = (struct mo_file_header *) -1; - int use_mmap = 0; - struct loaded_domain *domain; - const char *nullentry; - - domain_file->decided = 1; - domain_file->data = NULL; - - /* Note that it would be useless to store domainbinding in domain_file - because domainbinding might be == NULL now but != NULL later (after - a call to bind_textdomain_codeset). */ - - /* If the record does not represent a valid locale the FILENAME - might be NULL. This can happen when according to the given - specification the locale file name is different for XPG and CEN - syntax. */ - if (domain_file->filename == NULL) - return; - - /* Try to open the addressed file. */ - fd = open (domain_file->filename, O_RDONLY | O_BINARY); - if (fd == -1) - return; - - /* We must know about the size of the file. */ - if ( -#ifdef _LIBC - __builtin_expect (fstat64 (fd, &st) != 0, 0) -#else - __builtin_expect (fstat (fd, &st) != 0, 0) -#endif - || __builtin_expect ((size = (size_t) st.st_size) != st.st_size, 0) - || __builtin_expect (size < sizeof (struct mo_file_header), 0)) - { - /* Something went wrong. */ - close (fd); - return; - } - -#ifdef HAVE_MMAP - /* Now we are ready to load the file. If mmap() is available we try - this first. If not available or it failed we try to load it. */ - data = (struct mo_file_header *) mmap (NULL, size, PROT_READ, - MAP_PRIVATE, fd, 0); - - if (__builtin_expect (data != (struct mo_file_header *) -1, 1)) - { - /* mmap() call was successful. */ - close (fd); - use_mmap = 1; - } -#endif - - /* If the data is not yet available (i.e. mmap'ed) we try to load - it manually. */ - if (data == (struct mo_file_header *) -1) - { - size_t to_read; - char *read_ptr; - - data = (struct mo_file_header *) malloc (size); - if (data == NULL) - return; - - to_read = size; - read_ptr = (char *) data; - do - { - long int nb = (long int) read (fd, read_ptr, to_read); - if (nb <= 0) - { -#ifdef EINTR - if (nb == -1 && errno == EINTR) - continue; -#endif - close (fd); - return; - } - read_ptr += nb; - to_read -= nb; - } - while (to_read > 0); - - close (fd); - } - - /* Using the magic number we can test whether it really is a message - catalog file. */ - if (__builtin_expect (data->magic != _MAGIC && data->magic != _MAGIC_SWAPPED, - 0)) - { - /* The magic number is wrong: not a message catalog file. */ -#ifdef HAVE_MMAP - if (use_mmap) - munmap ((caddr_t) data, size); - else -#endif - free (data); - return; - } - - domain = (struct loaded_domain *) malloc (sizeof (struct loaded_domain)); - if (domain == NULL) - return; - domain_file->data = domain; - - domain->data = (char *) data; - domain->use_mmap = use_mmap; - domain->mmap_size = size; - domain->must_swap = data->magic != _MAGIC; - - /* Fill in the information about the available tables. */ - switch (W (domain->must_swap, data->revision)) - { - case 0: - domain->nstrings = W (domain->must_swap, data->nstrings); - domain->orig_tab = (struct string_desc *) - ((char *) data + W (domain->must_swap, data->orig_tab_offset)); - domain->trans_tab = (struct string_desc *) - ((char *) data + W (domain->must_swap, data->trans_tab_offset)); - domain->hash_size = W (domain->must_swap, data->hash_tab_size); - domain->hash_tab = (nls_uint32 *) - ((char *) data + W (domain->must_swap, data->hash_tab_offset)); - break; - default: - /* This is an invalid revision. */ -#ifdef HAVE_MMAP - if (use_mmap) - munmap ((caddr_t) data, size); - else -#endif - free (data); - free (domain); - domain_file->data = NULL; - return; - } - - /* Now initialize the character set converter from the character set - the file is encoded with (found in the header entry) to the domain's - specified character set or the locale's character set. */ - nullentry = _nl_init_domain_conv (domain_file, domain, domainbinding); - - /* Also look for a plural specification. */ - if (nullentry != NULL) - { - const char *plural; - const char *nplurals; - - plural = strstr (nullentry, "plural="); - nplurals = strstr (nullentry, "nplurals="); - if (plural == NULL || nplurals == NULL) - goto no_plural; - else - { - /* First get the number. */ - char *endp; - unsigned long int n; - struct parse_args args; - - nplurals += 9; - while (*nplurals != '\0' && isspace (*nplurals)) - ++nplurals; -#if defined HAVE_STRTOUL || defined _LIBC - n = strtoul (nplurals, &endp, 10); -#else - for (endp = nplurals, n = 0; *endp >= '0' && *endp <= '9'; endp++) - n = n * 10 + (*endp - '0'); -#endif - domain->nplurals = n; - if (nplurals == endp) - goto no_plural; - - /* Due to the restrictions bison imposes onto the interface of the - scanner function we have to put the input string and the result - passed up from the parser into the same structure which address - is passed down to the parser. */ - plural += 7; - args.cp = plural; - if (PLURAL_PARSE (&args) != 0) - goto no_plural; - domain->plural = args.res; - } - } - else - { - /* By default we are using the Germanic form: singular form only - for `one', the plural form otherwise. Yes, this is also what - English is using since English is a Germanic language. */ - no_plural: - INIT_GERMANIC_PLURAL (); - domain->plural = &germanic_plural; - domain->nplurals = 2; - } -} - - -#ifdef _LIBC -void -internal_function -_nl_unload_domain (domain) - struct loaded_domain *domain; -{ - if (domain->plural != &germanic_plural) - __gettext_free_exp (domain->plural); - - _nl_free_domain_conv (domain); - -# ifdef _POSIX_MAPPED_FILES - if (domain->use_mmap) - munmap ((caddr_t) domain->data, domain->mmap_size); - else -# endif /* _POSIX_MAPPED_FILES */ - free ((void *) domain->data); - - free (domain); -} -#endif diff --git a/intl/localcharset.c b/intl/localcharset.c deleted file mode 100644 index 61f8f3e..0000000 --- a/intl/localcharset.c +++ /dev/null @@ -1,271 +0,0 @@ -/* Determine a canonical name for the current locale's character encoding. - - Copyright (C) 2000-2001 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library 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. */ - -/* Written by Bruno Haible . */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#if HAVE_STDDEF_H -# include -#endif - -#include -#if HAVE_STRING_H -# include -#else -# include -#endif -#if HAVE_STDLIB_H -# include -#endif - -#if defined _WIN32 || defined __WIN32__ -# undef WIN32 /* avoid warning on mingw32 */ -# define WIN32 -#endif - -#ifndef WIN32 -# if HAVE_LANGINFO_CODESET -# include -# else -# if HAVE_SETLOCALE -# include -# endif -# endif -#else /* WIN32 */ -# define WIN32_LEAN_AND_MEAN -# include -#endif - -#ifndef DIRECTORY_SEPARATOR -# define DIRECTORY_SEPARATOR '/' -#endif - -#ifndef ISSLASH -# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR) -#endif - -/* The following static variable is declared 'volatile' to avoid a - possible multithread problem in the function get_charset_aliases. If we - are running in a threaded environment, and if two threads initialize - 'charset_aliases' simultaneously, both will produce the same value, - and everything will be ok if the two assignments to 'charset_aliases' - are atomic. But I don't know what will happen if the two assignments mix. */ -#if __STDC__ != 1 -# define volatile /* empty */ -#endif -/* Pointer to the contents of the charset.alias file, if it has already been - read, else NULL. Its format is: - ALIAS_1 '\0' CANONICAL_1 '\0' ... ALIAS_n '\0' CANONICAL_n '\0' '\0' */ -static const char * volatile charset_aliases; - -/* Return a pointer to the contents of the charset.alias file. */ -static const char * -get_charset_aliases () -{ - const char *cp; - - cp = charset_aliases; - if (cp == NULL) - { -#ifndef WIN32 - FILE *fp; - const char *dir = LIBDIR; - const char *base = "charset.alias"; - char *file_name; - - /* Concatenate dir and base into freshly allocated file_name. */ - { - size_t dir_len = strlen (dir); - size_t base_len = strlen (base); - int add_slash = (dir_len > 0 && !ISSLASH (dir[dir_len - 1])); - file_name = (char *) malloc (dir_len + add_slash + base_len + 1); - if (file_name != NULL) - { - memcpy (file_name, dir, dir_len); - if (add_slash) - file_name[dir_len] = DIRECTORY_SEPARATOR; - memcpy (file_name + dir_len + add_slash, base, base_len + 1); - } - } - - if (file_name == NULL || (fp = fopen (file_name, "r")) == NULL) - /* Out of memory or file not found, treat it as empty. */ - cp = ""; - else - { - /* Parse the file's contents. */ - int c; - char buf1[50+1]; - char buf2[50+1]; - char *res_ptr = NULL; - size_t res_size = 0; - size_t l1, l2; - - for (;;) - { - c = getc (fp); - if (c == EOF) - break; - if (c == '\n' || c == ' ' || c == '\t') - continue; - if (c == '#') - { - /* Skip comment, to end of line. */ - do - c = getc (fp); - while (!(c == EOF || c == '\n')); - if (c == EOF) - break; - continue; - } - ungetc (c, fp); - if (fscanf(fp, "%50s %50s", buf1, buf2) < 2) - break; - l1 = strlen (buf1); - l2 = strlen (buf2); - if (res_size == 0) - { - res_size = l1 + 1 + l2 + 1; - res_ptr = malloc (res_size + 1); - } - else - { - res_size += l1 + 1 + l2 + 1; - res_ptr = realloc (res_ptr, res_size + 1); - } - if (res_ptr == NULL) - { - /* Out of memory. */ - res_size = 0; - break; - } - strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1); - strcpy (res_ptr + res_size - (l2 + 1), buf2); - } - fclose (fp); - if (res_size == 0) - cp = ""; - else - { - *(res_ptr + res_size) = '\0'; - cp = res_ptr; - } - } - - if (file_name != NULL) - free (file_name); - -#else /* WIN32 */ - - /* To avoid the troubles of installing a separate file in the same - directory as the DLL and of retrieving the DLL's directory at - runtime, simply inline the aliases here. */ - - cp = "CP936" "\0" "GBK" "\0" - "CP1361" "\0" "JOHAB" "\0"; -#endif - - charset_aliases = cp; - } - - return cp; -} - -/* Determine the current locale's character encoding, and canonicalize it - into one of the canonical names listed in config.charset. - The result must not be freed; it is statically allocated. - If the canonical name cannot be determined, the result is a non-canonical - name. */ - -#ifdef STATIC -STATIC -#endif -const char * -locale_charset () -{ - const char *codeset; - const char *aliases; - -#ifndef WIN32 - -# if HAVE_LANGINFO_CODESET - - /* Most systems support nl_langinfo (CODESET) nowadays. */ - codeset = nl_langinfo (CODESET); - -# else - - /* On old systems which lack it, use setlocale or getenv. */ - const char *locale = NULL; - - /* But most old systems don't have a complete set of locales. Some - (like SunOS 4 or DJGPP) have only the C locale. Therefore we don't - use setlocale here; it would return "C" when it doesn't support the - locale name the user has set. */ -# if HAVE_SETLOCALE && 0 - locale = setlocale (LC_CTYPE, NULL); -# endif - if (locale == NULL || locale[0] == '\0') - { - locale = getenv ("LC_ALL"); - if (locale == NULL || locale[0] == '\0') - { - locale = getenv ("LC_CTYPE"); - if (locale == NULL || locale[0] == '\0') - locale = getenv ("LANG"); - } - } - - /* On some old systems, one used to set locale = "iso8859_1". On others, - you set it to "language_COUNTRY.charset". In any case, we resolve it - through the charset.alias file. */ - codeset = locale; - -# endif - -#else /* WIN32 */ - - static char buf[2 + 10 + 1]; - - /* Win32 has a function returning the locale's codepage as a number. */ - sprintf (buf, "CP%u", GetACP ()); - codeset = buf; - -#endif - - if (codeset == NULL) - /* The canonical name cannot be determined. */ - codeset = ""; - - /* Resolve alias. */ - for (aliases = get_charset_aliases (); - *aliases != '\0'; - aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1) - if (strcmp (codeset, aliases) == 0 - || (aliases[0] == '*' && aliases[1] == '\0')) - { - codeset = aliases + strlen (aliases) + 1; - break; - } - - return codeset; -} diff --git a/intl/locale.alias b/intl/locale.alias deleted file mode 100644 index bd7b9b3..0000000 --- a/intl/locale.alias +++ /dev/null @@ -1,78 +0,0 @@ -# Locale name alias data base. -# Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU Library General Public License as published -# by the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Library General Public License for more details. -# -# You should have received a copy of the GNU Library 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. - -# The format of this file is the same as for the corresponding file of -# the X Window System, which normally can be found in -# /usr/lib/X11/locale/locale.alias -# A single line contains two fields: an alias and a substitution value. -# All entries are case independent. - -# Note: This file is far from being complete. If you have a value for -# your own site which you think might be useful for others too, share -# it with the rest of us. Send it using the `glibcbug' script to -# bugs@gnu.org. - -# Packages using this file: - -bokmal no_NO.ISO-8859-1 -bokmål no_NO.ISO-8859-1 -catalan ca_ES.ISO-8859-1 -croatian hr_HR.ISO-8859-2 -czech cs_CZ.ISO-8859-2 -danish da_DK.ISO-8859-1 -dansk da_DK.ISO-8859-1 -deutsch de_DE.ISO-8859-1 -dutch nl_NL.ISO-8859-1 -eesti et_EE.ISO-8859-1 -estonian et_EE.ISO-8859-1 -finnish fi_FI.ISO-8859-1 -français fr_FR.ISO-8859-1 -french fr_FR.ISO-8859-1 -galego gl_ES.ISO-8859-1 -galician gl_ES.ISO-8859-1 -german de_DE.ISO-8859-1 -greek el_GR.ISO-8859-7 -hebrew he_IL.ISO-8859-8 -hrvatski hr_HR.ISO-8859-2 -hungarian hu_HU.ISO-8859-2 -icelandic is_IS.ISO-8859-1 -italian it_IT.ISO-8859-1 -japanese ja_JP.eucJP -japanese.euc ja_JP.eucJP -ja_JP ja_JP.eucJP -ja_JP.ujis ja_JP.eucJP -japanese.sjis ja_JP.SJIS -korean ko_KR.eucKR -korean.euc ko_KR.eucKR -ko_KR ko_KR.eucKR -lithuanian lt_LT.ISO-8859-13 -nb_NO no_NO.ISO-8859-1 -nb_NO.ISO-8859-1 no_NO.ISO-8859-1 -norwegian no_NO.ISO-8859-1 -nynorsk nn_NO.ISO-8859-1 -polish pl_PL.ISO-8859-2 -portuguese pt_PT.ISO-8859-1 -romanian ro_RO.ISO-8859-2 -russian ru_RU.ISO-8859-5 -slovak sk_SK.ISO-8859-2 -slovene sl_SI.ISO-8859-2 -slovenian sl_SI.ISO-8859-2 -spanish es_ES.ISO-8859-1 -swedish sv_SE.ISO-8859-1 -thai th_TH.TIS-620 -turkish tr_TR.ISO-8859-9 diff --git a/intl/localealias.c b/intl/localealias.c deleted file mode 100644 index 91e7acc..0000000 --- a/intl/localealias.c +++ /dev/null @@ -1,404 +0,0 @@ -/* Handle aliases for locale names. - Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library 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. */ - -/* Tell glibc's to provide a prototype for mempcpy(). - This must come before because may include - , and once has been included, it's too late. */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include - -#ifdef __GNUC__ -# define alloca __builtin_alloca -# define HAVE_ALLOCA 1 -#else -# if defined HAVE_ALLOCA_H || defined _LIBC -# include -# else -# ifdef _AIX - #pragma alloca -# else -# ifndef alloca -char *alloca (); -# endif -# endif -# endif -#endif - -#include - -#include -#if !HAVE_STRCHR && !defined _LIBC -# ifndef strchr -# define strchr index -# endif -#endif - -#include "gettextP.h" - -/* @@ end of prolog @@ */ - -#ifdef _LIBC -/* Rename the non ANSI C functions. This is required by the standard - because some ANSI C functions will require linking with this object - file and the name space must not be polluted. */ -# define strcasecmp __strcasecmp - -# ifndef mempcpy -# define mempcpy __mempcpy -# endif -# define HAVE_MEMPCPY 1 - -/* We need locking here since we can be called from different places. */ -# include - -__libc_lock_define_initialized (static, lock); -#endif - -#ifndef internal_function -# define internal_function -#endif - -/* For those losing systems which don't have `alloca' we have to add - some additional code emulating it. */ -#ifdef HAVE_ALLOCA -# define freea(p) /* nothing */ -#else -# define alloca(n) malloc (n) -# define freea(p) free (p) -#endif - -#if defined _LIBC_REENTRANT || defined HAVE_FGETS_UNLOCKED -# undef fgets -# define fgets(buf, len, s) fgets_unlocked (buf, len, s) -#endif -#if defined _LIBC_REENTRANT || defined HAVE_FEOF_UNLOCKED -# undef feof -# define feof(s) feof_unlocked (s) -#endif - - -struct alias_map -{ - const char *alias; - const char *value; -}; - - -static char *string_space; -static size_t string_space_act; -static size_t string_space_max; -static struct alias_map *map; -static size_t nmap; -static size_t maxmap; - - -/* Prototypes for local functions. */ -static size_t read_alias_file PARAMS ((const char *fname, int fname_len)) - internal_function; -static int extend_alias_table PARAMS ((void)); -static int alias_compare PARAMS ((const struct alias_map *map1, - const struct alias_map *map2)); - - -const char * -_nl_expand_alias (name) - const char *name; -{ - static const char *locale_alias_path = LOCALE_ALIAS_PATH; - struct alias_map *retval; - const char *result = NULL; - size_t added; - -#ifdef _LIBC - __libc_lock_lock (lock); -#endif - - do - { - struct alias_map item; - - item.alias = name; - - if (nmap > 0) - retval = (struct alias_map *) bsearch (&item, map, nmap, - sizeof (struct alias_map), - (int (*) PARAMS ((const void *, - const void *)) - ) alias_compare); - else - retval = NULL; - - /* We really found an alias. Return the value. */ - if (retval != NULL) - { - result = retval->value; - break; - } - - /* Perhaps we can find another alias file. */ - added = 0; - while (added == 0 && locale_alias_path[0] != '\0') - { - const char *start; - - while (locale_alias_path[0] == PATH_SEPARATOR) - ++locale_alias_path; - start = locale_alias_path; - - while (locale_alias_path[0] != '\0' - && locale_alias_path[0] != PATH_SEPARATOR) - ++locale_alias_path; - - if (start < locale_alias_path) - added = read_alias_file (start, locale_alias_path - start); - } - } - while (added != 0); - -#ifdef _LIBC - __libc_lock_unlock (lock); -#endif - - return result; -} - - -static size_t -internal_function -read_alias_file (fname, fname_len) - const char *fname; - int fname_len; -{ - FILE *fp; - char *full_fname; - size_t added; - static const char aliasfile[] = "/locale.alias"; - - full_fname = (char *) alloca (fname_len + sizeof aliasfile); -#ifdef HAVE_MEMPCPY - mempcpy (mempcpy (full_fname, fname, fname_len), - aliasfile, sizeof aliasfile); -#else - memcpy (full_fname, fname, fname_len); - memcpy (&full_fname[fname_len], aliasfile, sizeof aliasfile); -#endif - - fp = fopen (full_fname, "r"); - freea (full_fname); - if (fp == NULL) - return 0; - - added = 0; - while (!feof (fp)) - { - /* It is a reasonable approach to use a fix buffer here because - a) we are only interested in the first two fields - b) these fields must be usable as file names and so must not - be that long - */ - char buf[BUFSIZ]; - char *alias; - char *value; - char *cp; - - if (fgets (buf, sizeof buf, fp) == NULL) - /* EOF reached. */ - break; - - /* Possibly not the whole line fits into the buffer. Ignore - the rest of the line. */ - if (strchr (buf, '\n') == NULL) - { - char altbuf[BUFSIZ]; - do - if (fgets (altbuf, sizeof altbuf, fp) == NULL) - /* Make sure the inner loop will be left. The outer loop - will exit at the `feof' test. */ - break; - while (strchr (altbuf, '\n') == NULL); - } - - cp = buf; - /* Ignore leading white space. */ - while (isspace (cp[0])) - ++cp; - - /* A leading '#' signals a comment line. */ - if (cp[0] != '\0' && cp[0] != '#') - { - alias = cp++; - while (cp[0] != '\0' && !isspace (cp[0])) - ++cp; - /* Terminate alias name. */ - if (cp[0] != '\0') - *cp++ = '\0'; - - /* Now look for the beginning of the value. */ - while (isspace (cp[0])) - ++cp; - - if (cp[0] != '\0') - { - size_t alias_len; - size_t value_len; - - value = cp++; - while (cp[0] != '\0' && !isspace (cp[0])) - ++cp; - /* Terminate value. */ - if (cp[0] == '\n') - { - /* This has to be done to make the following test - for the end of line possible. We are looking for - the terminating '\n' which do not overwrite here. */ - *cp++ = '\0'; - *cp = '\n'; - } - else if (cp[0] != '\0') - *cp++ = '\0'; - - if (nmap >= maxmap) - if (__builtin_expect (extend_alias_table (), 0)) - return added; - - alias_len = strlen (alias) + 1; - value_len = strlen (value) + 1; - - if (string_space_act + alias_len + value_len > string_space_max) - { - /* Increase size of memory pool. */ - size_t new_size = (string_space_max - + (alias_len + value_len > 1024 - ? alias_len + value_len : 1024)); - char *new_pool = (char *) realloc (string_space, new_size); - if (new_pool == NULL) - return added; - - if (__builtin_expect (string_space != new_pool, 0)) - { - size_t i; - - for (i = 0; i < nmap; i++) - { - map[i].alias += new_pool - string_space; - map[i].value += new_pool - string_space; - } - } - - string_space = new_pool; - string_space_max = new_size; - } - - map[nmap].alias = memcpy (&string_space[string_space_act], - alias, alias_len); - string_space_act += alias_len; - - map[nmap].value = memcpy (&string_space[string_space_act], - value, value_len); - string_space_act += value_len; - - ++nmap; - ++added; - } - } - } - - /* Should we test for ferror()? I think we have to silently ignore - errors. --drepper */ - fclose (fp); - - if (added > 0) - qsort (map, nmap, sizeof (struct alias_map), - (int (*) PARAMS ((const void *, const void *))) alias_compare); - - return added; -} - - -static int -extend_alias_table () -{ - size_t new_size; - struct alias_map *new_map; - - new_size = maxmap == 0 ? 100 : 2 * maxmap; - new_map = (struct alias_map *) realloc (map, (new_size - * sizeof (struct alias_map))); - if (new_map == NULL) - /* Simply don't extend: we don't have any more core. */ - return -1; - - map = new_map; - maxmap = new_size; - return 0; -} - - -#ifdef _LIBC -static void __attribute__ ((unused)) -free_mem (void) -{ - if (string_space != NULL) - free (string_space); - if (map != NULL) - free (map); -} -text_set_element (__libc_subfreeres, free_mem); -#endif - - -static int -alias_compare (map1, map2) - const struct alias_map *map1; - const struct alias_map *map2; -{ -#if defined _LIBC || defined HAVE_STRCASECMP - return strcasecmp (map1->alias, map2->alias); -#else - const unsigned char *p1 = (const unsigned char *) map1->alias; - const unsigned char *p2 = (const unsigned char *) map2->alias; - unsigned char c1, c2; - - if (p1 == p2) - return 0; - - do - { - /* I know this seems to be odd but the tolower() function in - some systems libc cannot handle nonalpha characters. */ - c1 = isupper (*p1) ? tolower (*p1) : *p1; - c2 = isupper (*p2) ? tolower (*p2) : *p2; - if (c1 == '\0') - break; - ++p1; - ++p2; - } - while (c1 == c2); - - return c1 - c2; -#endif -} diff --git a/intl/ngettext.c b/intl/ngettext.c deleted file mode 100644 index fb3ec5a..0000000 --- a/intl/ngettext.c +++ /dev/null @@ -1,68 +0,0 @@ -/* Implementation of ngettext(3) function. - Copyright (C) 1995, 1997, 2000, 2001 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifdef _LIBC -# define __need_NULL -# include -#else -# include /* Just for NULL. */ -#endif - -#include "gettextP.h" -#ifdef _LIBC -# include -#else -# include "libgnuintl.h" -#endif - -#include - -/* @@ end of prolog @@ */ - -/* Names for the libintl functions are a problem. They must not clash - with existing names and they should follow ANSI C. But this source - code is also used in GNU C Library where the names have a __ - prefix. So we have to make a difference here. */ -#ifdef _LIBC -# define NGETTEXT __ngettext -# define DCNGETTEXT __dcngettext -#else -# define NGETTEXT ngettext__ -# define DCNGETTEXT dcngettext__ -#endif - -/* Look up MSGID in the current default message catalog for the current - LC_MESSAGES locale. If not found, returns MSGID itself (the default - text). */ -char * -NGETTEXT (msgid1, msgid2, n) - const char *msgid1; - const char *msgid2; - unsigned long int n; -{ - return DCNGETTEXT (NULL, msgid1, msgid2, n, LC_MESSAGES); -} - -#ifdef _LIBC -/* Alias for function name in GNU C Library. */ -weak_alias (__ngettext, ngettext); -#endif diff --git a/intl/plural.c b/intl/plural.c deleted file mode 100644 index 640d43c..0000000 --- a/intl/plural.c +++ /dev/null @@ -1,1326 +0,0 @@ - -/* A Bison parser, made from plural.y - by GNU Bison version 1.28 */ - -#define YYBISON 1 /* Identify Bison output. */ - -#define yyparse __gettextparse -#define yylex __gettextlex -#define yyerror __gettexterror -#define yylval __gettextlval -#define yychar __gettextchar -#define yydebug __gettextdebug -#define yynerrs __gettextnerrs -#define EQUOP2 257 -#define CMPOP2 258 -#define ADDOP2 259 -#define MULOP2 260 -#define NUMBER 261 - -#line 1 "plural.y" - -/* Expression parsing for plural form selection. - Copyright (C) 2000, 2001 Free Software Foundation, Inc. - Written by Ulrich Drepper , 2000. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library 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. */ - -/* The bison generated parser uses alloca. AIX 3 forces us to put this - declaration at the beginning of the file. The declaration in bison's - skeleton file comes too late. This must come before - because may include arbitrary system headers. */ -#if defined _AIX && !defined __GNUC__ - #pragma alloca -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include "gettextP.h" - -/* Names for the libintl functions are a problem. They must not clash - with existing names and they should follow ANSI C. But this source - code is also used in GNU C Library where the names have a __ - prefix. So we have to make a difference here. */ -#ifdef _LIBC -# define FREE_EXPRESSION __gettext_free_exp -#else -# define FREE_EXPRESSION gettext_free_exp__ -# define __gettextparse gettextparse__ -#endif - -#define YYLEX_PARAM &((struct parse_args *) arg)->cp -#define YYPARSE_PARAM arg - -#line 53 "plural.y" -typedef union { - unsigned long int num; - enum operator op; - struct expression *exp; -} YYSTYPE; -#line 59 "plural.y" - -/* Prototypes for local functions. */ -static struct expression *new_exp PARAMS ((int nargs, enum operator op, - struct expression * const *args)); -static inline struct expression *new_exp_0 PARAMS ((enum operator op)); -static inline struct expression *new_exp_1 PARAMS ((enum operator op, - struct expression *right)); -static struct expression *new_exp_2 PARAMS ((enum operator op, - struct expression *left, - struct expression *right)); -static inline struct expression *new_exp_3 PARAMS ((enum operator op, - struct expression *bexp, - struct expression *tbranch, - struct expression *fbranch)); -static int yylex PARAMS ((YYSTYPE *lval, const char **pexp)); -static void yyerror PARAMS ((const char *str)); - -/* Allocation of expressions. */ - -static struct expression * -new_exp (nargs, op, args) - int nargs; - enum operator op; - struct expression * const *args; -{ - int i; - struct expression *newp; - - /* If any of the argument could not be malloc'ed, just return NULL. */ - for (i = nargs - 1; i >= 0; i--) - if (args[i] == NULL) - goto fail; - - /* Allocate a new expression. */ - newp = (struct expression *) malloc (sizeof (*newp)); - if (newp != NULL) - { - newp->nargs = nargs; - newp->operation = op; - for (i = nargs - 1; i >= 0; i--) - newp->val.args[i] = args[i]; - return newp; - } - - fail: - for (i = nargs - 1; i >= 0; i--) - FREE_EXPRESSION (args[i]); - - return NULL; -} - -static inline struct expression * -new_exp_0 (op) - enum operator op; -{ - return new_exp (0, op, NULL); -} - -static inline struct expression * -new_exp_1 (op, right) - enum operator op; - struct expression *right; -{ - struct expression *args[1]; - - args[0] = right; - return new_exp (1, op, args); -} - -static struct expression * -new_exp_2 (op, left, right) - enum operator op; - struct expression *left; - struct expression *right; -{ - struct expression *args[2]; - - args[0] = left; - args[1] = right; - return new_exp (2, op, args); -} - -static inline struct expression * -new_exp_3 (op, bexp, tbranch, fbranch) - enum operator op; - struct expression *bexp; - struct expression *tbranch; - struct expression *fbranch; -{ - struct expression *args[3]; - - args[0] = bexp; - args[1] = tbranch; - args[2] = fbranch; - return new_exp (3, op, args); -} - -#include - -#ifndef __cplusplus -#ifndef __STDC__ -#define const -#endif -#endif - - - -#define YYFINAL 27 -#define YYFLAG -32768 -#define YYNTBASE 16 - -#define YYTRANSLATE(x) ((unsigned)(x) <= 261 ? yytranslate[x] : 18) - -static const char yytranslate[] = { 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 10, 2, 2, 2, 2, 5, 2, 14, - 15, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 12, 2, 2, - 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 13, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 1, 6, 7, 8, 9, - 11 -}; - -#if YYDEBUG != 0 -static const short yyprhs[] = { 0, - 0, 2, 8, 12, 16, 20, 24, 28, 32, 35, - 37, 39 -}; - -static const short yyrhs[] = { 17, - 0, 17, 3, 17, 12, 17, 0, 17, 4, 17, - 0, 17, 5, 17, 0, 17, 6, 17, 0, 17, - 7, 17, 0, 17, 8, 17, 0, 17, 9, 17, - 0, 10, 17, 0, 13, 0, 11, 0, 14, 17, - 15, 0 -}; - -#endif - -#if YYDEBUG != 0 -static const short yyrline[] = { 0, - 178, 186, 190, 194, 198, 202, 206, 210, 214, 218, - 222, 227 -}; -#endif - - -#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) - -static const char * const yytname[] = { "$","error","$undefined.","'?'","'|'", -"'&'","EQUOP2","CMPOP2","ADDOP2","MULOP2","'!'","NUMBER","':'","'n'","'('","')'", -"start","exp", NULL -}; -#endif - -static const short yyr1[] = { 0, - 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17 -}; - -static const short yyr2[] = { 0, - 1, 5, 3, 3, 3, 3, 3, 3, 2, 1, - 1, 3 -}; - -static const short yydefact[] = { 0, - 0, 11, 10, 0, 1, 9, 0, 0, 0, 0, - 0, 0, 0, 0, 12, 0, 3, 4, 5, 6, - 7, 8, 0, 2, 0, 0, 0 -}; - -static const short yydefgoto[] = { 25, - 5 -}; - -static const short yypact[] = { -9, - -9,-32768,-32768, -9, 34,-32768, 11, -9, -9, -9, - -9, -9, -9, -9,-32768, 24, 39, 43, 16, 26, - -3,-32768, -9, 34, 21, 53,-32768 -}; - -static const short yypgoto[] = {-32768, - -1 -}; - - -#define YYLAST 53 - - -static const short yytable[] = { 6, - 1, 2, 7, 3, 4, 14, 16, 17, 18, 19, - 20, 21, 22, 8, 9, 10, 11, 12, 13, 14, - 26, 24, 12, 13, 14, 15, 8, 9, 10, 11, - 12, 13, 14, 13, 14, 23, 8, 9, 10, 11, - 12, 13, 14, 10, 11, 12, 13, 14, 11, 12, - 13, 14, 27 -}; - -static const short yycheck[] = { 1, - 10, 11, 4, 13, 14, 9, 8, 9, 10, 11, - 12, 13, 14, 3, 4, 5, 6, 7, 8, 9, - 0, 23, 7, 8, 9, 15, 3, 4, 5, 6, - 7, 8, 9, 8, 9, 12, 3, 4, 5, 6, - 7, 8, 9, 5, 6, 7, 8, 9, 6, 7, - 8, 9, 0 -}; -#define YYPURE 1 - -/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/home/haible/gnu/arch/linuxlibc6/share/bison.simple" -/* This file comes from bison-1.28. */ - -/* Skeleton output parser for bison, - Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ - -/* This is the parser code that is written into each bison parser - when the %semantic_parser declaration is not specified in the grammar. - It was written by Richard Stallman by simplifying the hairy parser - used when %semantic_parser is specified. */ - -#ifndef YYSTACK_USE_ALLOCA -#ifdef alloca -#define YYSTACK_USE_ALLOCA -#else /* alloca not defined */ -#ifdef __GNUC__ -#define YYSTACK_USE_ALLOCA -#define alloca __builtin_alloca -#else /* not GNU C. */ -#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) -#define YYSTACK_USE_ALLOCA -#include -#else /* not sparc */ -/* We think this test detects Watcom and Microsoft C. */ -/* This used to test MSDOS, but that is a bad idea - since that symbol is in the user namespace. */ -#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) -#if 0 /* No need for malloc.h, which pollutes the namespace; - instead, just don't use alloca. */ -#include -#endif -#else /* not MSDOS, or __TURBOC__ */ -#if defined(_AIX) -/* I don't know what this was needed for, but it pollutes the namespace. - So I turned it off. rms, 2 May 1997. */ -/* #include */ - #pragma alloca -#define YYSTACK_USE_ALLOCA -#else /* not MSDOS, or __TURBOC__, or _AIX */ -#if 0 -#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, - and on HPUX 10. Eventually we can turn this on. */ -#define YYSTACK_USE_ALLOCA -#define alloca __builtin_alloca -#endif /* __hpux */ -#endif -#endif /* not _AIX */ -#endif /* not MSDOS, or __TURBOC__ */ -#endif /* not sparc */ -#endif /* not GNU C */ -#endif /* alloca not defined */ -#endif /* YYSTACK_USE_ALLOCA not defined */ - -#ifdef YYSTACK_USE_ALLOCA -#define YYSTACK_ALLOC alloca -#else -#define YYSTACK_ALLOC malloc -#endif - -/* Note: there must be only one dollar sign in this file. - It is replaced by the list of actions, each action - as one case of the switch. */ - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY -2 -#define YYEOF 0 -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrlab1 -/* Like YYERROR except do call yyerror. - This remains here temporarily to ease the - transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ -#define YYFAIL goto yyerrlab -#define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(token, value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { yychar = (token), yylval = (value); \ - yychar1 = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ - goto yybackup; \ - } \ - else \ - { yyerror ("syntax error: cannot back up"); YYERROR; } \ -while (0) - -#define YYTERROR 1 -#define YYERRCODE 256 - -#ifndef YYPURE -#define YYLEX yylex() -#endif - -#ifdef YYPURE -#ifdef YYLSP_NEEDED -#ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) -#else -#define YYLEX yylex(&yylval, &yylloc) -#endif -#else /* not YYLSP_NEEDED */ -#ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, YYLEX_PARAM) -#else -#define YYLEX yylex(&yylval) -#endif -#endif /* not YYLSP_NEEDED */ -#endif - -/* If nonreentrant, generate the variables here */ - -#ifndef YYPURE - -int yychar; /* the lookahead symbol */ -YYSTYPE yylval; /* the semantic value of the */ - /* lookahead symbol */ - -#ifdef YYLSP_NEEDED -YYLTYPE yylloc; /* location data for the lookahead */ - /* symbol */ -#endif - -int yynerrs; /* number of parse errors so far */ -#endif /* not YYPURE */ - -#if YYDEBUG != 0 -int yydebug; /* nonzero means print parse trace */ -/* Since this is uninitialized, it does not stop multiple parsers - from coexisting. */ -#endif - -/* YYINITDEPTH indicates the initial size of the parser's stacks */ - -#ifndef YYINITDEPTH -#define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH is the maximum size the stacks can grow to - (effective only if the built-in stack extension method is used). */ - -#if YYMAXDEPTH == 0 -#undef YYMAXDEPTH -#endif - -#ifndef YYMAXDEPTH -#define YYMAXDEPTH 10000 -#endif - -/* Define __yy_memcpy. Note that the size argument - should be passed with type unsigned int, because that is what the non-GCC - definitions require. With GCC, __builtin_memcpy takes an arg - of type size_t, but it can handle unsigned int. */ - -#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ -#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) -#else /* not GNU C or C++ */ -#ifndef __cplusplus - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (to, from, count) - char *to; - char *from; - unsigned int count; -{ - register char *f = from; - register char *t = to; - register int i = count; - - while (i-- > 0) - *t++ = *f++; -} - -#else /* __cplusplus */ - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (char *to, char *from, unsigned int count) -{ - register char *t = to; - register char *f = from; - register int i = count; - - while (i-- > 0) - *t++ = *f++; -} - -#endif -#endif - -#line 217 "/home/haible/gnu/arch/linuxlibc6/share/bison.simple" - -/* The user can define YYPARSE_PARAM as the name of an argument to be passed - into yyparse. The argument should have type void *. - It should actually point to an object. - Grammar actions can access the variable by casting it - to the proper pointer type. */ - -#ifdef YYPARSE_PARAM -#ifdef __cplusplus -#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM -#define YYPARSE_PARAM_DECL -#else /* not __cplusplus */ -#define YYPARSE_PARAM_ARG YYPARSE_PARAM -#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; -#endif /* not __cplusplus */ -#else /* not YYPARSE_PARAM */ -#define YYPARSE_PARAM_ARG -#define YYPARSE_PARAM_DECL -#endif /* not YYPARSE_PARAM */ - -/* Prevent warning if -Wstrict-prototypes. */ -#ifdef __GNUC__ -#ifdef YYPARSE_PARAM -int yyparse (void *); -#else -int yyparse (void); -#endif -#endif - -int -yyparse(YYPARSE_PARAM_ARG) - YYPARSE_PARAM_DECL -{ - register int yystate; - register int yyn; - register short *yyssp; - register YYSTYPE *yyvsp; - int yyerrstatus; /* number of tokens to shift before error messages enabled */ - int yychar1 = 0; /* lookahead token as an internal (translated) token number */ - - short yyssa[YYINITDEPTH]; /* the state stack */ - YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ - - short *yyss = yyssa; /* refer to the stacks thru separate pointers */ - YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ - -#ifdef YYLSP_NEEDED - YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - -#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) -#else -#define YYPOPSTACK (yyvsp--, yyssp--) -#endif - - int yystacksize = YYINITDEPTH; - int yyfree_stacks = 0; - -#ifdef YYPURE - int yychar; - YYSTYPE yylval; - int yynerrs; -#ifdef YYLSP_NEEDED - YYLTYPE yylloc; -#endif -#endif - - YYSTYPE yyval; /* the variable used to return */ - /* semantic values from the action */ - /* routines */ - - int yylen; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Starting parse\n"); -#endif - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - - yyssp = yyss - 1; - yyvsp = yyvs; -#ifdef YYLSP_NEEDED - yylsp = yyls; -#endif - -/* Push a new state, which is found in yystate . */ -/* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. */ -yynewstate: - - *++yyssp = yystate; - - if (yyssp >= yyss + yystacksize - 1) - { - /* Give user a chance to reallocate the stack */ - /* Use copies of these so that the &'s don't force the real ones into memory. */ - YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; -#ifdef YYLSP_NEEDED - YYLTYPE *yyls1 = yyls; -#endif - - /* Get the current used size of the three stacks, in elements. */ - int size = yyssp - yyss + 1; - -#ifdef yyoverflow - /* Each stack pointer address is followed by the size of - the data in use in that stack, in bytes. */ -#ifdef YYLSP_NEEDED - /* This used to be a conditional around just the two extra args, - but that might be undefined if yyoverflow is a macro. */ - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yyls1, size * sizeof (*yylsp), - &yystacksize); -#else - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yystacksize); -#endif - - yyss = yyss1; yyvs = yyvs1; -#ifdef YYLSP_NEEDED - yyls = yyls1; -#endif -#else /* no yyoverflow */ - /* Extend the stack our own way. */ - if (yystacksize >= YYMAXDEPTH) - { - yyerror("parser stack overflow"); - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 2; - } - yystacksize *= 2; - if (yystacksize > YYMAXDEPTH) - yystacksize = YYMAXDEPTH; -#ifndef YYSTACK_USE_ALLOCA - yyfree_stacks = 1; -#endif - yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); - __yy_memcpy ((char *)yyss, (char *)yyss1, - size * (unsigned int) sizeof (*yyssp)); - yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); - __yy_memcpy ((char *)yyvs, (char *)yyvs1, - size * (unsigned int) sizeof (*yyvsp)); -#ifdef YYLSP_NEEDED - yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); - __yy_memcpy ((char *)yyls, (char *)yyls1, - size * (unsigned int) sizeof (*yylsp)); -#endif -#endif /* no yyoverflow */ - - yyssp = yyss + size - 1; - yyvsp = yyvs + size - 1; -#ifdef YYLSP_NEEDED - yylsp = yyls + size - 1; -#endif - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Stack size increased to %d\n", yystacksize); -#endif - - if (yyssp >= yyss + yystacksize - 1) - YYABORT; - } - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Entering state %d\n", yystate); -#endif - - goto yybackup; - yybackup: - -/* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ -/* yyresume: */ - - /* First try to decide what to do without reference to lookahead token. */ - - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* yychar is either YYEMPTY or YYEOF - or a valid token in external form. */ - - if (yychar == YYEMPTY) - { -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Reading a token: "); -#endif - yychar = YYLEX; - } - - /* Convert token to internal form (in yychar1) for indexing tables with */ - - if (yychar <= 0) /* This means end of input. */ - { - yychar1 = 0; - yychar = YYEOF; /* Don't call YYLEX any more */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Now at end of input.\n"); -#endif - } - else - { - yychar1 = YYTRANSLATE(yychar); - -#if YYDEBUG != 0 - if (yydebug) - { - fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); - /* Give the individual parser a way to print the precise meaning - of a token, for further debugging info. */ -#ifdef YYPRINT - YYPRINT (stderr, yychar, yylval); -#endif - fprintf (stderr, ")\n"); - } -#endif - } - - yyn += yychar1; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) - goto yydefault; - - yyn = yytable[yyn]; - - /* yyn is what to do for this token type in this state. - Negative => reduce, -yyn is rule number. - Positive => shift, yyn is new state. - New state is final state => don't bother to shift, - just return success. - 0, or most negative number => error. */ - - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - else if (yyn == 0) - goto yyerrlab; - - if (yyn == YYFINAL) - YYACCEPT; - - /* Shift the lookahead token. */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); -#endif - - /* Discard the token being shifted unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif - - /* count tokens shifted since error; after three, turn off error status. */ - if (yyerrstatus) yyerrstatus--; - - yystate = yyn; - goto yynewstate; - -/* Do the default action for the current state. */ -yydefault: - - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - -/* Do a reduction. yyn is the number of a rule to reduce with. */ -yyreduce: - yylen = yyr2[yyn]; - if (yylen > 0) - yyval = yyvsp[1-yylen]; /* implement default value of the action */ - -#if YYDEBUG != 0 - if (yydebug) - { - int i; - - fprintf (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); - - /* Print the symbols being reduced, and their result. */ - for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) - fprintf (stderr, "%s ", yytname[yyrhs[i]]); - fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); - } -#endif - - - switch (yyn) { - -case 1: -#line 179 "plural.y" -{ - if (yyvsp[0].exp == NULL) - YYABORT; - ((struct parse_args *) arg)->res = yyvsp[0].exp; - ; - break;} -case 2: -#line 187 "plural.y" -{ - yyval.exp = new_exp_3 (qmop, yyvsp[-4].exp, yyvsp[-2].exp, yyvsp[0].exp); - ; - break;} -case 3: -#line 191 "plural.y" -{ - yyval.exp = new_exp_2 (lor, yyvsp[-2].exp, yyvsp[0].exp); - ; - break;} -case 4: -#line 195 "plural.y" -{ - yyval.exp = new_exp_2 (land, yyvsp[-2].exp, yyvsp[0].exp); - ; - break;} -case 5: -#line 199 "plural.y" -{ - yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); - ; - break;} -case 6: -#line 203 "plural.y" -{ - yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); - ; - break;} -case 7: -#line 207 "plural.y" -{ - yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); - ; - break;} -case 8: -#line 211 "plural.y" -{ - yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); - ; - break;} -case 9: -#line 215 "plural.y" -{ - yyval.exp = new_exp_1 (lnot, yyvsp[0].exp); - ; - break;} -case 10: -#line 219 "plural.y" -{ - yyval.exp = new_exp_0 (var); - ; - break;} -case 11: -#line 223 "plural.y" -{ - if ((yyval.exp = new_exp_0 (num)) != NULL) - yyval.exp->val.num = yyvsp[0].num; - ; - break;} -case 12: -#line 228 "plural.y" -{ - yyval.exp = yyvsp[-1].exp; - ; - break;} -} - /* the action file gets copied in in place of this dollarsign */ -#line 543 "/home/haible/gnu/arch/linuxlibc6/share/bison.simple" - - yyvsp -= yylen; - yyssp -= yylen; -#ifdef YYLSP_NEEDED - yylsp -= yylen; -#endif - -#if YYDEBUG != 0 - if (yydebug) - { - short *ssp1 = yyss - 1; - fprintf (stderr, "state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif - - *++yyvsp = yyval; - -#ifdef YYLSP_NEEDED - yylsp++; - if (yylen == 0) - { - yylsp->first_line = yylloc.first_line; - yylsp->first_column = yylloc.first_column; - yylsp->last_line = (yylsp-1)->last_line; - yylsp->last_column = (yylsp-1)->last_column; - yylsp->text = 0; - } - else - { - yylsp->last_line = (yylsp+yylen-1)->last_line; - yylsp->last_column = (yylsp+yylen-1)->last_column; - } -#endif - - /* Now "shift" the result of the reduction. - Determine what state that goes to, - based on the state we popped back to - and the rule number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTBASE] + *yyssp; - if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTBASE]; - - goto yynewstate; - -yyerrlab: /* here on detecting error */ - - if (! yyerrstatus) - /* If not already recovering from an error, report this error. */ - { - ++yynerrs; - -#ifdef YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (yyn > YYFLAG && yyn < YYLAST) - { - int size = 0; - char *msg; - int x, count; - - count = 0; - /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - size += strlen(yytname[x]) + 15, count++; - msg = (char *) malloc(size + 15); - if (msg != 0) - { - strcpy(msg, "parse error"); - - if (count < 5) - { - count = 0; - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - { - strcat(msg, count == 0 ? ", expecting `" : " or `"); - strcat(msg, yytname[x]); - strcat(msg, "'"); - count++; - } - } - yyerror(msg); - free(msg); - } - else - yyerror ("parse error; also virtual memory exceeded"); - } - else -#endif /* YYERROR_VERBOSE */ - yyerror("parse error"); - } - - goto yyerrlab1; -yyerrlab1: /* here on error raised explicitly by an action */ - - if (yyerrstatus == 3) - { - /* if just tried and failed to reuse lookahead token after an error, discard it. */ - - /* return failure if at end of input */ - if (yychar == YYEOF) - YYABORT; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); -#endif - - yychar = YYEMPTY; - } - - /* Else will try to reuse lookahead token - after shifting the error token. */ - - yyerrstatus = 3; /* Each real token shifted decrements this */ - - goto yyerrhandle; - -yyerrdefault: /* current state does not do anything special for the error token. */ - -#if 0 - /* This is wrong; only states that explicitly want error tokens - should shift them. */ - yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ - if (yyn) goto yydefault; -#endif - -yyerrpop: /* pop the current state because it cannot handle the error token */ - - if (yyssp == yyss) YYABORT; - yyvsp--; - yystate = *--yyssp; -#ifdef YYLSP_NEEDED - yylsp--; -#endif - -#if YYDEBUG != 0 - if (yydebug) - { - short *ssp1 = yyss - 1; - fprintf (stderr, "Error: state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif - -yyerrhandle: - - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yyerrdefault; - - yyn += YYTERROR; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) - goto yyerrdefault; - - yyn = yytable[yyn]; - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrpop; - yyn = -yyn; - goto yyreduce; - } - else if (yyn == 0) - goto yyerrpop; - - if (yyn == YYFINAL) - YYACCEPT; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting error token, "); -#endif - - *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif - - yystate = yyn; - goto yynewstate; - - yyacceptlab: - /* YYACCEPT comes here. */ - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 0; - - yyabortlab: - /* YYABORT comes here. */ - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 1; -} -#line 233 "plural.y" - - -void -internal_function -FREE_EXPRESSION (exp) - struct expression *exp; -{ - if (exp == NULL) - return; - - /* Handle the recursive case. */ - switch (exp->nargs) - { - case 3: - FREE_EXPRESSION (exp->val.args[2]); - /* FALLTHROUGH */ - case 2: - FREE_EXPRESSION (exp->val.args[1]); - /* FALLTHROUGH */ - case 1: - FREE_EXPRESSION (exp->val.args[0]); - /* FALLTHROUGH */ - default: - break; - } - - free (exp); -} - - -static int -yylex (lval, pexp) - YYSTYPE *lval; - const char **pexp; -{ - const char *exp = *pexp; - int result; - - while (1) - { - if (exp[0] == '\0') - { - *pexp = exp; - return YYEOF; - } - - if (exp[0] != ' ' && exp[0] != '\t') - break; - - ++exp; - } - - result = *exp++; - switch (result) - { - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - { - unsigned long int n = result - '0'; - while (exp[0] >= '0' && exp[0] <= '9') - { - n *= 10; - n += exp[0] - '0'; - ++exp; - } - lval->num = n; - result = NUMBER; - } - break; - - case '=': - if (exp[0] == '=') - { - ++exp; - lval->op = equal; - result = EQUOP2; - } - else - result = YYERRCODE; - break; - - case '!': - if (exp[0] == '=') - { - ++exp; - lval->op = not_equal; - result = EQUOP2; - } - break; - - case '&': - case '|': - if (exp[0] == result) - ++exp; - else - result = YYERRCODE; - break; - - case '<': - if (exp[0] == '=') - { - ++exp; - lval->op = less_or_equal; - } - else - lval->op = less_than; - result = CMPOP2; - break; - - case '>': - if (exp[0] == '=') - { - ++exp; - lval->op = greater_or_equal; - } - else - lval->op = greater_than; - result = CMPOP2; - break; - - case '*': - lval->op = mult; - result = MULOP2; - break; - - case '/': - lval->op = divide; - result = MULOP2; - break; - - case '%': - lval->op = module; - result = MULOP2; - break; - - case '+': - lval->op = plus; - result = ADDOP2; - break; - - case '-': - lval->op = minus; - result = ADDOP2; - break; - - case 'n': - case '?': - case ':': - case '(': - case ')': - /* Nothing, just return the character. */ - break; - - case ';': - case '\n': - case '\0': - /* Be safe and let the user call this function again. */ - --exp; - result = YYEOF; - break; - - default: - result = YYERRCODE; -#if YYDEBUG != 0 - --exp; -#endif - break; - } - - *pexp = exp; - - return result; -} - - -static void -yyerror (str) - const char *str; -{ - /* Do nothing. We don't print error messages here. */ -} diff --git a/intl/plural.y b/intl/plural.y deleted file mode 100644 index be049a6..0000000 --- a/intl/plural.y +++ /dev/null @@ -1,413 +0,0 @@ -%{ -/* Expression parsing for plural form selection. - Copyright (C) 2000, 2001 Free Software Foundation, Inc. - Written by Ulrich Drepper , 2000. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library 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. */ - -/* The bison generated parser uses alloca. AIX 3 forces us to put this - declaration at the beginning of the file. The declaration in bison's - skeleton file comes too late. This must come before - because may include arbitrary system headers. */ -#if defined _AIX && !defined __GNUC__ - #pragma alloca -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include "gettextP.h" - -/* Names for the libintl functions are a problem. They must not clash - with existing names and they should follow ANSI C. But this source - code is also used in GNU C Library where the names have a __ - prefix. So we have to make a difference here. */ -#ifdef _LIBC -# define FREE_EXPRESSION __gettext_free_exp -#else -# define FREE_EXPRESSION gettext_free_exp__ -# define __gettextparse gettextparse__ -#endif - -#define YYLEX_PARAM &((struct parse_args *) arg)->cp -#define YYPARSE_PARAM arg -%} -%pure_parser -%expect 10 - -%union { - unsigned long int num; - enum operator op; - struct expression *exp; -} - -%{ -/* Prototypes for local functions. */ -static struct expression *new_exp PARAMS ((int nargs, enum operator op, - struct expression * const *args)); -static inline struct expression *new_exp_0 PARAMS ((enum operator op)); -static inline struct expression *new_exp_1 PARAMS ((enum operator op, - struct expression *right)); -static struct expression *new_exp_2 PARAMS ((enum operator op, - struct expression *left, - struct expression *right)); -static inline struct expression *new_exp_3 PARAMS ((enum operator op, - struct expression *bexp, - struct expression *tbranch, - struct expression *fbranch)); -static int yylex PARAMS ((YYSTYPE *lval, const char **pexp)); -static void yyerror PARAMS ((const char *str)); - -/* Allocation of expressions. */ - -static struct expression * -new_exp (nargs, op, args) - int nargs; - enum operator op; - struct expression * const *args; -{ - int i; - struct expression *newp; - - /* If any of the argument could not be malloc'ed, just return NULL. */ - for (i = nargs - 1; i >= 0; i--) - if (args[i] == NULL) - goto fail; - - /* Allocate a new expression. */ - newp = (struct expression *) malloc (sizeof (*newp)); - if (newp != NULL) - { - newp->nargs = nargs; - newp->operation = op; - for (i = nargs - 1; i >= 0; i--) - newp->val.args[i] = args[i]; - return newp; - } - - fail: - for (i = nargs - 1; i >= 0; i--) - FREE_EXPRESSION (args[i]); - - return NULL; -} - -static inline struct expression * -new_exp_0 (op) - enum operator op; -{ - return new_exp (0, op, NULL); -} - -static inline struct expression * -new_exp_1 (op, right) - enum operator op; - struct expression *right; -{ - struct expression *args[1]; - - args[0] = right; - return new_exp (1, op, args); -} - -static struct expression * -new_exp_2 (op, left, right) - enum operator op; - struct expression *left; - struct expression *right; -{ - struct expression *args[2]; - - args[0] = left; - args[1] = right; - return new_exp (2, op, args); -} - -static inline struct expression * -new_exp_3 (op, bexp, tbranch, fbranch) - enum operator op; - struct expression *bexp; - struct expression *tbranch; - struct expression *fbranch; -{ - struct expression *args[3]; - - args[0] = bexp; - args[1] = tbranch; - args[2] = fbranch; - return new_exp (3, op, args); -} - -%} - -/* This declares that all operators have the same associativity and the - precedence order as in C. See [Harbison, Steele: C, A Reference Manual]. - There is no unary minus and no bitwise operators. - Operators with the same syntactic behaviour have been merged into a single - token, to save space in the array generated by bison. */ -%right '?' /* ? */ -%left '|' /* || */ -%left '&' /* && */ -%left EQUOP2 /* == != */ -%left CMPOP2 /* < > <= >= */ -%left ADDOP2 /* + - */ -%left MULOP2 /* * / % */ -%right '!' /* ! */ - -%token EQUOP2 CMPOP2 ADDOP2 MULOP2 -%token NUMBER -%type exp - -%% - -start: exp - { - if ($1 == NULL) - YYABORT; - ((struct parse_args *) arg)->res = $1; - } - ; - -exp: exp '?' exp ':' exp - { - $$ = new_exp_3 (qmop, $1, $3, $5); - } - | exp '|' exp - { - $$ = new_exp_2 (lor, $1, $3); - } - | exp '&' exp - { - $$ = new_exp_2 (land, $1, $3); - } - | exp EQUOP2 exp - { - $$ = new_exp_2 ($2, $1, $3); - } - | exp CMPOP2 exp - { - $$ = new_exp_2 ($2, $1, $3); - } - | exp ADDOP2 exp - { - $$ = new_exp_2 ($2, $1, $3); - } - | exp MULOP2 exp - { - $$ = new_exp_2 ($2, $1, $3); - } - | '!' exp - { - $$ = new_exp_1 (lnot, $2); - } - | 'n' - { - $$ = new_exp_0 (var); - } - | NUMBER - { - if (($$ = new_exp_0 (num)) != NULL) - $$->val.num = $1; - } - | '(' exp ')' - { - $$ = $2; - } - ; - -%% - -void -internal_function -FREE_EXPRESSION (exp) - struct expression *exp; -{ - if (exp == NULL) - return; - - /* Handle the recursive case. */ - switch (exp->nargs) - { - case 3: - FREE_EXPRESSION (exp->val.args[2]); - /* FALLTHROUGH */ - case 2: - FREE_EXPRESSION (exp->val.args[1]); - /* FALLTHROUGH */ - case 1: - FREE_EXPRESSION (exp->val.args[0]); - /* FALLTHROUGH */ - default: - break; - } - - free (exp); -} - - -static int -yylex (lval, pexp) - YYSTYPE *lval; - const char **pexp; -{ - const char *exp = *pexp; - int result; - - while (1) - { - if (exp[0] == '\0') - { - *pexp = exp; - return YYEOF; - } - - if (exp[0] != ' ' && exp[0] != '\t') - break; - - ++exp; - } - - result = *exp++; - switch (result) - { - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - { - unsigned long int n = result - '0'; - while (exp[0] >= '0' && exp[0] <= '9') - { - n *= 10; - n += exp[0] - '0'; - ++exp; - } - lval->num = n; - result = NUMBER; - } - break; - - case '=': - if (exp[0] == '=') - { - ++exp; - lval->op = equal; - result = EQUOP2; - } - else - result = YYERRCODE; - break; - - case '!': - if (exp[0] == '=') - { - ++exp; - lval->op = not_equal; - result = EQUOP2; - } - break; - - case '&': - case '|': - if (exp[0] == result) - ++exp; - else - result = YYERRCODE; - break; - - case '<': - if (exp[0] == '=') - { - ++exp; - lval->op = less_or_equal; - } - else - lval->op = less_than; - result = CMPOP2; - break; - - case '>': - if (exp[0] == '=') - { - ++exp; - lval->op = greater_or_equal; - } - else - lval->op = greater_than; - result = CMPOP2; - break; - - case '*': - lval->op = mult; - result = MULOP2; - break; - - case '/': - lval->op = divide; - result = MULOP2; - break; - - case '%': - lval->op = module; - result = MULOP2; - break; - - case '+': - lval->op = plus; - result = ADDOP2; - break; - - case '-': - lval->op = minus; - result = ADDOP2; - break; - - case 'n': - case '?': - case ':': - case '(': - case ')': - /* Nothing, just return the character. */ - break; - - case ';': - case '\n': - case '\0': - /* Be safe and let the user call this function again. */ - --exp; - result = YYEOF; - break; - - default: - result = YYERRCODE; -#if YYDEBUG != 0 - --exp; -#endif - break; - } - - *pexp = exp; - - return result; -} - - -static void -yyerror (str) - const char *str; -{ - /* Do nothing. We don't print error messages here. */ -} diff --git a/intl/ref-add.sin b/intl/ref-add.sin deleted file mode 100644 index 167374e..0000000 --- a/intl/ref-add.sin +++ /dev/null @@ -1,31 +0,0 @@ -# Add this package to a list of references stored in a text file. -# -# Copyright (C) 2000 Free Software Foundation, Inc. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU Library General Public License as published -# by the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Library General Public License for more details. -# -# You should have received a copy of the GNU Library 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. -# -# Written by Bruno Haible . -# -/^# Packages using this file: / { - s/# Packages using this file:// - ta - :a - s/ @PACKAGE@ / @PACKAGE@ / - tb - s/ $/ @PACKAGE@ / - :b - s/^/# Packages using this file:/ -} diff --git a/intl/ref-del.sin b/intl/ref-del.sin deleted file mode 100644 index 613cf37..0000000 --- a/intl/ref-del.sin +++ /dev/null @@ -1,26 +0,0 @@ -# Remove this package from a list of references stored in a text file. -# -# Copyright (C) 2000 Free Software Foundation, Inc. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU Library General Public License as published -# by the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Library General Public License for more details. -# -# You should have received a copy of the GNU Library 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. -# -# Written by Bruno Haible . -# -/^# Packages using this file: / { - s/# Packages using this file:// - s/ @PACKAGE@ / / - s/^/# Packages using this file:/ -} diff --git a/intl/textdomain.c b/intl/textdomain.c deleted file mode 100644 index 2e420ad..0000000 --- a/intl/textdomain.c +++ /dev/null @@ -1,142 +0,0 @@ -/* Implementation of the textdomain(3) function. - Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include - -#ifdef _LIBC -# include -#else -# include "libgnuintl.h" -#endif -#include "gettextP.h" - -#ifdef _LIBC -/* We have to handle multi-threaded applications. */ -# include -#else -/* Provide dummy implementation if this is outside glibc. */ -# define __libc_rwlock_define(CLASS, NAME) -# define __libc_rwlock_wrlock(NAME) -# define __libc_rwlock_unlock(NAME) -#endif - -/* The internal variables in the standalone libintl.a must have different - names than the internal variables in GNU libc, otherwise programs - using libintl.a cannot be linked statically. */ -#if !defined _LIBC -# define _nl_default_default_domain _nl_default_default_domain__ -# define _nl_current_default_domain _nl_current_default_domain__ -#endif - -/* @@ end of prolog @@ */ - -/* Name of the default text domain. */ -extern const char _nl_default_default_domain[]; - -/* Default text domain in which entries for gettext(3) are to be found. */ -extern const char *_nl_current_default_domain; - - -/* Names for the libintl functions are a problem. They must not clash - with existing names and they should follow ANSI C. But this source - code is also used in GNU C Library where the names have a __ - prefix. So we have to make a difference here. */ -#ifdef _LIBC -# define TEXTDOMAIN __textdomain -# ifndef strdup -# define strdup(str) __strdup (str) -# endif -#else -# define TEXTDOMAIN textdomain__ -#endif - -/* Lock variable to protect the global data in the gettext implementation. */ -__libc_rwlock_define (extern, _nl_state_lock) - -/* Set the current default message catalog to DOMAINNAME. - If DOMAINNAME is null, return the current default. - If DOMAINNAME is "", reset to the default of "messages". */ -char * -TEXTDOMAIN (domainname) - const char *domainname; -{ - char *new_domain; - char *old_domain; - - /* A NULL pointer requests the current setting. */ - if (domainname == NULL) - return (char *) _nl_current_default_domain; - - __libc_rwlock_wrlock (_nl_state_lock); - - old_domain = (char *) _nl_current_default_domain; - - /* If domain name is the null string set to default domain "messages". */ - if (domainname[0] == '\0' - || strcmp (domainname, _nl_default_default_domain) == 0) - { - _nl_current_default_domain = _nl_default_default_domain; - new_domain = (char *) _nl_current_default_domain; - } - else if (strcmp (domainname, old_domain) == 0) - /* This can happen and people will use it to signal that some - environment variable changed. */ - new_domain = old_domain; - else - { - /* If the following malloc fails `_nl_current_default_domain' - will be NULL. This value will be returned and so signals we - are out of core. */ -#if defined _LIBC || defined HAVE_STRDUP - new_domain = strdup (domainname); -#else - size_t len = strlen (domainname) + 1; - new_domain = (char *) malloc (len); - if (new_domain != NULL) - memcpy (new_domain, domainname, len); -#endif - - if (new_domain != NULL) - _nl_current_default_domain = new_domain; - } - - /* We use this possibility to signal a change of the loaded catalogs - since this is most likely the case and there is no other easy we - to do it. Do it only when the call was successful. */ - if (new_domain != NULL) - { - ++_nl_msg_cat_cntr; - - if (old_domain != new_domain && old_domain != _nl_default_default_domain) - free (old_domain); - } - - __libc_rwlock_unlock (_nl_state_lock); - - return new_domain; -} - -#ifdef _LIBC -/* Alias for function name in GNU C Library. */ -weak_alias (__textdomain, textdomain); -#endif diff --git a/lib/Makefile.am b/lib/Makefile.am index aa4d55a..59261ae 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,15 +1,15 @@ ## Process this file with automake to produce Makefile.in -# $Id: Makefile.am,v 1.2.4.7 2001/02/11 11:50:09 guus Exp $ +# $Id: Makefile.am 1374 2004-03-21 14:21:22Z guus $ noinst_LIBRARIES = libvpn.a -INCLUDES = @INCLUDES@ -I. -I$(top_builddir) -I$(top_srcdir)/intl +INCLUDES = @INCLUDES@ -I. -I$(top_builddir) -libvpn_a_SOURCES = xmalloc.c pidfile.c utils.c getopt.c getopt1.c list.c avl_tree.c dropin.c +libvpn_a_SOURCES = xmalloc.c pidfile.c utils.c getopt.c getopt1.c list.c avl_tree.c dropin.c fake-getaddrinfo.c fake-getnameinfo.c libvpn_a_LIBADD = @LIBOBJS@ @ALLOCA@ libvpn_a_DEPENDENCIES = $(libvpn_a_LIBADD) -noinst_HEADERS = xalloc.h pidfile.h utils.h getopt.h list.h avl_tree.h dropin.h +noinst_HEADERS = xalloc.h pidfile.h utils.h getopt.h list.h avl_tree.h dropin.h fake-getaddrinfo.h fake-getnameinfo.h fake-gai-errnos.h gettext.h ipv6.h ipv4.h ethernet.h -EXTRA_DIST = README +EXTRA_DIST = diff --git a/lib/Makefile.in b/lib/Makefile.in index 0ae461d..4e29a89 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -1,7 +1,8 @@ -# Makefile.in generated automatically by automake 1.5 from Makefile.am. +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -13,152 +14,218 @@ @SET_MAKE@ -# $Id: Makefile.am,v 1.2.4.7 2001/02/11 11:50:09 guus Exp $ +# $Id: Makefile.am 1374 2004-03-21 14:21:22Z guus $ -SHELL = @SHELL@ + +SOURCES = $(libvpn_a_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) -transform = @program_transform_name@ +transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -host_alias = @host_alias@ host_triplet = @host@ -AMTAR = @AMTAR@ -AWK = @AWK@ -BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CPP = @CPP@ -DATADIRNAME = @DATADIRNAME@ -DEPDIR = @DEPDIR@ -EXEEXT = @EXEEXT@ -GENCAT = @GENCAT@ -GLIBC21 = @GLIBC21@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -HAVE_TUNTAP = @HAVE_TUNTAP@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLBISON = @INTLBISON@ -INTLLIBS = @INTLLIBS@ -INTLOBJS = @INTLOBJS@ -INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ -LIBICONV = @LIBICONV@ -LINUX_IF_TUN_H = @LINUX_IF_TUN_H@ -LN_S = @LN_S@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PERL = @PERL@ -POFILES = @POFILES@ -POSUB = @POSUB@ -RANLIB = @RANLIB@ -USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ -USE_NLS = @USE_NLS@ -VERSION = @VERSION@ -am__include = @am__include@ -am__quote = @am__quote@ -install_sh = @install_sh@ - -INCLUDES = @INCLUDES@ -I. -I$(top_builddir) -I$(top_srcdir)/intl - -noinst_LIBRARIES = libvpn.a - -libvpn_a_SOURCES = xmalloc.c pidfile.c utils.c getopt.c getopt1.c list.c avl_tree.c dropin.c - -libvpn_a_LIBADD = @LIBOBJS@ @ALLOCA@ -libvpn_a_DEPENDENCIES = $(libvpn_a_LIBADD) - -noinst_HEADERS = xalloc.h pidfile.h utils.h getopt.h list.h avl_tree.h dropin.h - -EXTRA_DIST = README subdir = lib +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in alloca.c malloc.c memcmp.c realloc.c +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \ + $(top_srcdir)/m4/attribute.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/lzo.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/openssl.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/tuntap.m4 \ + $(top_srcdir)/m4/zlib.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) - -libvpn_a_AR = $(AR) cru +AR = ar +ARFLAGS = cru +libvpn_a_AR = $(AR) $(ARFLAGS) am_libvpn_a_OBJECTS = xmalloc.$(OBJEXT) pidfile.$(OBJEXT) \ utils.$(OBJEXT) getopt.$(OBJEXT) getopt1.$(OBJEXT) \ - list.$(OBJEXT) avl_tree.$(OBJEXT) dropin.$(OBJEXT) + list.$(OBJEXT) avl_tree.$(OBJEXT) dropin.$(OBJEXT) \ + fake-getaddrinfo.$(OBJEXT) fake-getnameinfo.$(OBJEXT) libvpn_a_OBJECTS = $(am_libvpn_a_OBJECTS) - -DEFS = @DEFS@ -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp -@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/alloca.Po $(DEPDIR)/avl_tree.Po \ -@AMDEP_TRUE@ $(DEPDIR)/dropin.Po $(DEPDIR)/getopt.Po \ -@AMDEP_TRUE@ $(DEPDIR)/getopt1.Po $(DEPDIR)/list.Po \ -@AMDEP_TRUE@ $(DEPDIR)/malloc.Po $(DEPDIR)/memcmp.Po \ -@AMDEP_TRUE@ $(DEPDIR)/pidfile.Po $(DEPDIR)/realloc.Po \ -@AMDEP_TRUE@ $(DEPDIR)/utils.Po $(DEPDIR)/xmalloc.Po +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/alloca.Po $(DEPDIR)/malloc.Po \ +@AMDEP_TRUE@ $(DEPDIR)/memcmp.Po $(DEPDIR)/realloc.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/avl_tree.Po ./$(DEPDIR)/dropin.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/fake-getaddrinfo.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/fake-getnameinfo.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/getopt.Po ./$(DEPDIR)/getopt1.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/list.Po ./$(DEPDIR)/pidfile.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/utils.Po ./$(DEPDIR)/xmalloc.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -CFLAGS = @CFLAGS@ +SOURCES = $(libvpn_a_SOURCES) DIST_SOURCES = $(libvpn_a_SOURCES) HEADERS = $(noinst_HEADERS) - -DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in alloca.c \ - malloc.c memcmp.c realloc.c -SOURCES = $(libvpn_a_SOURCES) - +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GMSGFMT = @GMSGFMT@ +HAVE_TUNTAP = @HAVE_TUNTAP@ +INCLUDES = @INCLUDES@ -I. -I$(top_builddir) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LINUX_IF_TUN_H = @LINUX_IF_TUN_H@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +noinst_LIBRARIES = libvpn.a +libvpn_a_SOURCES = xmalloc.c pidfile.c utils.c getopt.c getopt1.c list.c avl_tree.c dropin.c fake-getaddrinfo.c fake-getnameinfo.c +libvpn_a_LIBADD = @LIBOBJS@ @ALLOCA@ +libvpn_a_DEPENDENCIES = $(libvpn_a_LIBADD) +noinst_HEADERS = xalloc.h pidfile.h utils.h getopt.h list.h avl_tree.h dropin.h fake-getaddrinfo.h fake-getnameinfo.h fake-gai-errnos.h gettext.h ipv6.h ipv4.h ethernet.h +EXTRA_DIST = all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu lib/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && \ - CONFIG_HEADERS= CONFIG_LINKS= \ - CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; -AR = ar +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) @@ -168,88 +235,112 @@ libvpn.a: $(libvpn_a_OBJECTS) $(libvpn_a_DEPENDENCIES) $(RANLIB) libvpn.a mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core + -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/alloca.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/avl_tree.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/dropin.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt1.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/malloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/memcmp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pidfile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/realloc.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/utils.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/xmalloc.Po@am__quote@ - -distclean-depend: - -rm -rf $(DEPDIR) +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl_tree.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dropin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fake-getaddrinfo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fake-getnameinfo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pidfile.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc.Po@am__quote@ .c.o: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c `cygpath -w $<` -CCDEPMODE = @CCDEPMODE@ +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` uninstall-info-am: -tags: TAGS - ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - mkid -fID $$unique $(LISP) + mkid -fID $$unique +tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique GTAGS: - here=`CDPATH=: && cd $(top_builddir) && pwd` \ + here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = .. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - $(mkinstalldirs) "$(distdir)/$$dir"; \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ fi; \ if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir) \ - || exit 1; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ @@ -259,9 +350,7 @@ distdir: $(DISTFILES) check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(HEADERS) - installdirs: - install: install-am install-exec: install-exec-am install-data: install-data-am @@ -273,6 +362,7 @@ install-am: all-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: @@ -280,7 +370,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* + -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -290,14 +380,17 @@ clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am - -distclean-am: clean-am distclean-compile distclean-depend \ - distclean-generic distclean-tags + -rm -rf $(DEPDIR) ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags dvi: dvi-am dvi-am: +html: html-am + info: info-am info-am: @@ -313,25 +406,34 @@ install-man: installcheck-am: maintainer-clean: maintainer-clean-am - + -rm -rf $(DEPDIR) ./$(DEPDIR) + -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + uninstall-am: uninstall-info-am -.PHONY: GTAGS all all-am check check-am clean clean-generic \ - clean-noinstLIBRARIES distclean distclean-compile \ - distclean-depend distclean-generic distclean-tags distdir dvi \ - dvi-am info info-am install install-am install-data \ +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic tags uninstall uninstall-am \ - uninstall-info-am + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/lib/README b/lib/README deleted file mode 100644 index d842e59..0000000 --- a/lib/README +++ /dev/null @@ -1 +0,0 @@ -The files in this directory were merely copied from fileutils 4.0. \ No newline at end of file diff --git a/lib/avl_tree.c b/lib/avl_tree.c index a4f0051..efcb080 100644 --- a/lib/avl_tree.c +++ b/lib/avl_tree.c @@ -1,9 +1,9 @@ /* avl_tree.c -- avl_ tree and linked list convenience Copyright (C) 1998 Michael H. Buselli - 2000,2001 Ivo Timmermans , - 2000,2001 Guus Sliepen - 2000,2001 Wessel Dankers + 2000-2004 Ivo Timmermans , + 2000-2004 Guus Sliepen + 2000-2004 Wessel Dankers 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 @@ -21,22 +21,21 @@ Original AVL tree library by Michael H. Buselli . - Modified 2000-11-28 by Wessel Dankers to use counts + Modified 2000-11-28 by Wessel Dankers to use counts instead of depths, to add the ->next and ->prev and to generally obfuscate the code. Mail me if you found a bug. Cleaned up and incorporated some of the ideas from the red-black tree - library for inclusion into tinc (http://tinc.nl.linux.org/) by - Guus Sliepen . + library for inclusion into tinc (http://www.tinc-vpn.org/) by + Guus Sliepen . - $Id: avl_tree.c,v 1.1.2.8 2002/02/10 21:57:51 guus Exp $ + $Id: avl_tree.c 1374 2004-03-21 14:21:22Z guus $ */ -#include -#include -#include +#include "system.h" #include "avl_tree.h" +#include "xalloc.h" #ifdef AVL_COUNT #define AVL_NODE_COUNT(n) ((n) ? (n)->count : 0) @@ -53,671 +52,690 @@ #endif #ifndef AVL_DEPTH -int lg(unsigned int u) +static int lg(unsigned int u) __attribute__ ((__const__)); + +static int lg(unsigned int u) { - int r = 1; - if (!u) - return 0; - if (u & 0xffff0000) - { - u >>= 16; - r += 16; - } - if (u & 0x0000ff00) - { - u >>= 8; - r += 8; - } - if (u & 0x000000f0) - { - u >>= 4; - r += 4; - } - if (u & 0x0000000c) - { - u >>= 2; - r += 2; - } - if (u & 0x00000002) - r++; - return r; + int r = 1; + + if(!u) + return 0; + + if(u & 0xffff0000) { + u >>= 16; + r += 16; + } + + if(u & 0x0000ff00) { + u >>= 8; + r += 8; + } + + if(u & 0x000000f0) { + u >>= 4; + r += 4; + } + + if(u & 0x0000000c) { + u >>= 2; + r += 2; + } + + if(u & 0x00000002) + r++; + + return r; } #endif /* Internal helper functions */ -int avl_check_balance(avl_node_t *node) +static int avl_check_balance(const avl_node_t *node) { #ifdef AVL_DEPTH - int d; - d = R_AVL_DEPTH(node) - L_AVL_DEPTH(node); - return d < -1 ? -1 : d > 1 ? 1 : 0; + int d; + + d = R_AVL_DEPTH(node) - L_AVL_DEPTH(node); + + return d < -1 ? -1 : d > 1 ? 1 : 0; #else /* int d; * d = lg(AVL_R_COUNT(node)) - lg(AVL_L_COUNT(node)); * d = d<-1?-1:d>1?1:0; */ - int pl, r; + int pl, r; - pl = lg(AVL_L_COUNT(node)); - r = AVL_R_COUNT(node); + pl = lg(AVL_L_COUNT(node)); + r = AVL_R_COUNT(node); - if (r >> pl + 1) - return 1; - if (pl < 2 || r >> pl - 2) - return 0; - return -1; + if(r >> pl + 1) + return 1; + + if(pl < 2 || r >> pl - 2) + return 0; + + return -1; #endif } -void avl_rebalance(avl_tree_t *tree, avl_node_t *node) +static void avl_rebalance(avl_tree_t *tree, avl_node_t *node) { - avl_node_t *child; - avl_node_t *gchild; - avl_node_t *parent; - avl_node_t **superparent; + avl_node_t *child; + avl_node_t *gchild; + avl_node_t *parent; + avl_node_t **superparent; - parent = node; + parent = node; - while (node) - { - parent = node->parent; + while(node) { + parent = node->parent; - superparent = parent ? node == parent->left ? &parent->left : &parent->right : &tree->root; + superparent = + parent ? node == + parent->left ? &parent->left : &parent->right : &tree->root; - switch (avl_check_balance(node)) - { - case -1: - child = node->left; + switch (avl_check_balance(node)) { + case -1: + child = node->left; #ifdef AVL_DEPTH - if(L_AVL_DEPTH(child) >= R_AVL_DEPTH(child)) { + if(L_AVL_DEPTH(child) >= R_AVL_DEPTH(child)) { #else - if (AVL_L_COUNT(child) >= AVL_R_COUNT(child)) - { + if(AVL_L_COUNT(child) >= AVL_R_COUNT(child)) { #endif - node->left = child->right; - if (node->left) - node->left->parent = node; - child->right = node; - node->parent = child; - *superparent = child; - child->parent = parent; + node->left = child->right; + if(node->left) + node->left->parent = node; + + child->right = node; + node->parent = child; + *superparent = child; + child->parent = parent; #ifdef AVL_COUNT - node->count = AVL_CALC_COUNT(node); - child->count = AVL_CALC_COUNT(child); + node->count = AVL_CALC_COUNT(node); + child->count = AVL_CALC_COUNT(child); #endif #ifdef AVL_DEPTH - node->depth = AVL_CALC_DEPTH(node); - child->depth = AVL_CALC_DEPTH(child); + node->depth = AVL_CALC_DEPTH(node); + child->depth = AVL_CALC_DEPTH(child); #endif - } else - { - gchild = child->right; - node->left = gchild->right; - if (node->left) - node->left->parent = node; - child->right = gchild->left; - if (child->right) - child->right->parent = child; - gchild->right = node; - if (gchild->right) - gchild->right->parent = gchild; - gchild->left = child; - if (gchild->left) - gchild->left->parent = gchild; - *superparent = gchild; - gchild->parent = parent; + } else { + gchild = child->right; + node->left = gchild->right; + + if(node->left) + node->left->parent = node; + child->right = gchild->left; + + if(child->right) + child->right->parent = child; + gchild->right = node; + + if(gchild->right) + gchild->right->parent = gchild; + gchild->left = child; + + if(gchild->left) + gchild->left->parent = gchild; + *superparent = gchild; + + gchild->parent = parent; #ifdef AVL_COUNT - node->count = AVL_CALC_COUNT(node); - child->count = AVL_CALC_COUNT(child); - gchild->count = AVL_CALC_COUNT(gchild); + node->count = AVL_CALC_COUNT(node); + child->count = AVL_CALC_COUNT(child); + gchild->count = AVL_CALC_COUNT(gchild); #endif #ifdef AVL_DEPTH - node->depth = AVL_CALC_DEPTH(node); - child->depth = AVL_CALC_DEPTH(child); - gchild->depth = AVL_CALC_DEPTH(gchild); + node->depth = AVL_CALC_DEPTH(node); + child->depth = AVL_CALC_DEPTH(child); + gchild->depth = AVL_CALC_DEPTH(gchild); #endif - } - break; - case 1: - child = node->right; + } + break; + + case 1: + child = node->right; #ifdef AVL_DEPTH - if(R_AVL_DEPTH(child) >= L_AVL_DEPTH(child)) { + if(R_AVL_DEPTH(child) >= L_AVL_DEPTH(child)) { #else - if (AVL_R_COUNT(child) >= AVL_L_COUNT(child)) - { + if(AVL_R_COUNT(child) >= AVL_L_COUNT(child)) { #endif - node->right = child->left; - if (node->right) - node->right->parent = node; - child->left = node; - node->parent = child; - *superparent = child; - child->parent = parent; + node->right = child->left; + if(node->right) + node->right->parent = node; + child->left = node; + node->parent = child; + *superparent = child; + child->parent = parent; #ifdef AVL_COUNT - node->count = AVL_CALC_COUNT(node); - child->count = AVL_CALC_COUNT(child); + node->count = AVL_CALC_COUNT(node); + child->count = AVL_CALC_COUNT(child); #endif #ifdef AVL_DEPTH - node->depth = AVL_CALC_DEPTH(node); - child->depth = AVL_CALC_DEPTH(child); + node->depth = AVL_CALC_DEPTH(node); + child->depth = AVL_CALC_DEPTH(child); #endif - } else - { - gchild = child->left; - node->right = gchild->left; - if (node->right) - node->right->parent = node; - child->left = gchild->right; - if (child->left) - child->left->parent = child; - gchild->left = node; - if (gchild->left) - gchild->left->parent = gchild; - gchild->right = child; - if (gchild->right) - gchild->right->parent = gchild; - *superparent = gchild; - gchild->parent = parent; + } else { + gchild = child->left; + node->right = gchild->left; + + if(node->right) + node->right->parent = node; + child->left = gchild->right; + + if(child->left) + child->left->parent = child; + gchild->left = node; + + if(gchild->left) + gchild->left->parent = gchild; + gchild->right = child; + + if(gchild->right) + gchild->right->parent = gchild; + + *superparent = gchild; + gchild->parent = parent; #ifdef AVL_COUNT - node->count = AVL_CALC_COUNT(node); - child->count = AVL_CALC_COUNT(child); - gchild->count = AVL_CALC_COUNT(gchild); + node->count = AVL_CALC_COUNT(node); + child->count = AVL_CALC_COUNT(child); + gchild->count = AVL_CALC_COUNT(gchild); #endif #ifdef AVL_DEPTH - node->depth = AVL_CALC_DEPTH(node); - child->depth = AVL_CALC_DEPTH(child); - gchild->depth = AVL_CALC_DEPTH(gchild); + node->depth = AVL_CALC_DEPTH(node); + child->depth = AVL_CALC_DEPTH(child); + gchild->depth = AVL_CALC_DEPTH(gchild); #endif - } - break; - default: + } + break; + + default: #ifdef AVL_COUNT - node->count = AVL_CALC_COUNT(node); + node->count = AVL_CALC_COUNT(node); #endif #ifdef AVL_DEPTH - node->depth = AVL_CALC_DEPTH(node); + node->depth = AVL_CALC_DEPTH(node); #endif - } - node = parent; - } + } + node = parent; + } } /* (De)constructors */ avl_tree_t *avl_alloc_tree(avl_compare_t compare, avl_action_t delete) { - avl_tree_t *tree; - - tree = xmalloc_and_zero(sizeof(avl_tree_t)); - tree->compare = compare; - tree->delete = delete; + avl_tree_t *tree; - return tree; + tree = xmalloc_and_zero(sizeof(avl_tree_t)); + tree->compare = compare; + tree->delete = delete; + + return tree; } void avl_free_tree(avl_tree_t *tree) { - free(tree); + free(tree); } avl_node_t *avl_alloc_node(void) { - avl_node_t *node; - - node = xmalloc_and_zero(sizeof(avl_node_t)); - - return node; + return xmalloc_and_zero(sizeof(avl_node_t)); } void avl_free_node(avl_tree_t *tree, avl_node_t *node) { - if(node->data && tree->delete) - tree->delete(node->data); - free(node); + if(node->data && tree->delete) + tree->delete(node->data); + + free(node); } /* Searching */ void *avl_search(const avl_tree_t *tree, const void *data) { - avl_node_t *node; - - node = avl_search_node(tree, data); + avl_node_t *node; - return node?node->data:NULL; + node = avl_search_node(tree, data); + + return node ? node->data : NULL; } void *avl_search_closest(const avl_tree_t *tree, const void *data, int *result) { - avl_node_t *node; - - node = avl_search_closest_node(tree, data, result); + avl_node_t *node; - return node?node->data:NULL; + node = avl_search_closest_node(tree, data, result); + + return node ? node->data : NULL; } void *avl_search_closest_smaller(const avl_tree_t *tree, const void *data) { - avl_node_t *node; - - node = avl_search_closest_smaller_node(tree, data); + avl_node_t *node; - return node?node->data:NULL; + node = avl_search_closest_smaller_node(tree, data); + + return node ? node->data : NULL; } void *avl_search_closest_greater(const avl_tree_t *tree, const void *data) { - avl_node_t *node; - - node = avl_search_closest_greater_node(tree, data); + avl_node_t *node; - return node?node->data:NULL; + node = avl_search_closest_greater_node(tree, data); + + return node ? node->data : NULL; } avl_node_t *avl_search_node(const avl_tree_t *tree, const void *data) { - avl_node_t *node; - int result; - - node = avl_search_closest_node(tree, data, &result); - - return result?NULL:node; + avl_node_t *node; + int result; + + node = avl_search_closest_node(tree, data, &result); + + return result ? NULL : node; } -avl_node_t *avl_search_closest_node(const avl_tree_t *tree, const void *data, int *result) +avl_node_t *avl_search_closest_node(const avl_tree_t *tree, const void *data, + int *result) { - avl_node_t *node; - int c; + avl_node_t *node; + int c; - node = tree->root; + node = tree->root; - if (!node) - { - if(result) - *result = 0; - return NULL; - } + if(!node) { + if(result) + *result = 0; + return NULL; + } - for (;;) - { - c = tree->compare(data, node->data); + for(;;) { + c = tree->compare(data, node->data); - if (c < 0) - { - if (node->left) - node = node->left; - else - { - if(result) - *result = -1; - break; - } - } - else if (c > 0) - { - if (node->right) - node = node->right; - else - { - if(result) - *result = 1; - break; - } - } - else - { - if(result) - *result = 0; - break; - } - } + if(c < 0) { + if(node->left) + node = node->left; + else { + if(result) + *result = -1; + break; + } + } else if(c > 0) { + if(node->right) + node = node->right; + else { + if(result) + *result = 1; + break; + } + } else { + if(result) + *result = 0; + break; + } + } - return node; + return node; } -avl_node_t *avl_search_closest_smaller_node(const avl_tree_t *tree, const void *data) +avl_node_t *avl_search_closest_smaller_node(const avl_tree_t *tree, + const void *data) { - avl_node_t *node; - int result; - - node = avl_search_closest_node(tree, data, &result); - - if(result < 0) - node = node->prev; - - return node; + avl_node_t *node; + int result; + + node = avl_search_closest_node(tree, data, &result); + + if(result < 0) + node = node->prev; + + return node; } -avl_node_t *avl_search_closest_greater_node(const avl_tree_t *tree, const void *data) +avl_node_t *avl_search_closest_greater_node(const avl_tree_t *tree, + const void *data) { - avl_node_t *node; - int result; - - node = avl_search_closest_node(tree, data, &result); - - if(result > 0) - node = node->next; - - return node; + avl_node_t *node; + int result; + + node = avl_search_closest_node(tree, data, &result); + + if(result > 0) + node = node->next; + + return node; } /* Insertion and deletion */ avl_node_t *avl_insert(avl_tree_t *tree, void *data) { - avl_node_t *closest, *new; - int result; + avl_node_t *closest, *new; + int result; + + if(!tree->root) { + new = avl_alloc_node(); + new->data = data; + avl_insert_top(tree, new); + } else { + closest = avl_search_closest_node(tree, data, &result); + + switch (result) { + case -1: + new = avl_alloc_node(); + new->data = data; + avl_insert_before(tree, closest, new); + break; + + case 1: + new = avl_alloc_node(); + new->data = data; + avl_insert_after(tree, closest, new); + break; + + default: + return NULL; + } + } - if (!tree->root) - { - new = avl_alloc_node(); - new->data = data; - avl_insert_top(tree, new); - } - else - { - closest = avl_search_closest_node(tree, data, &result); - switch(result) - { - case -1: - new = avl_alloc_node(); - new->data = data; - avl_insert_before(tree, closest, new); - break; - case 1: - new = avl_alloc_node(); - new->data = data; - avl_insert_after(tree, closest, new); - break; - default: - return NULL; - } - } - #ifdef AVL_COUNT - new->count = 1; + new->count = 1; #endif #ifdef AVL_DEPTH - new->depth = 1; + new->depth = 1; #endif - return new; + return new; } avl_node_t *avl_insert_node(avl_tree_t *tree, avl_node_t *node) { - avl_node_t *closest; - int result; + avl_node_t *closest; + int result; + + if(!tree->root) + avl_insert_top(tree, node); + else { + closest = avl_search_closest_node(tree, node->data, &result); + + switch (result) { + case -1: + avl_insert_before(tree, closest, node); + break; + + case 1: + avl_insert_after(tree, closest, node); + break; + + case 0: + return NULL; + } + } - if (!tree->root) - avl_insert_top(tree, node); - else - { - closest = avl_search_closest_node(tree, node->data, &result); - switch(result) - { - case -1: - avl_insert_before(tree, closest, node); - break; - case 1: - avl_insert_after(tree, closest, node); - break; - case 0: - return NULL; - } - } - #ifdef AVL_COUNT - node->count = 1; + node->count = 1; #endif #ifdef AVL_DEPTH - node->depth = 1; + node->depth = 1; #endif - return node; + return node; } void avl_insert_top(avl_tree_t *tree, avl_node_t *node) { - node->prev = node->next = node->parent = NULL; - tree->head = tree->tail = tree->root = node; + node->prev = node->next = node->parent = NULL; + tree->head = tree->tail = tree->root = node; } -void avl_insert_before(avl_tree_t *tree, avl_node_t *before, avl_node_t *node) +void avl_insert_before(avl_tree_t *tree, avl_node_t *before, + avl_node_t *node) { - if (!before) - return tree->tail ? avl_insert_after(tree, tree->tail, node) : avl_insert_top(tree, node); + if(!before) { + if(tree->tail) + avl_insert_after(tree, tree->tail, node); + else + avl_insert_top(tree, node); + return; + } - node->next = before; - node->parent = before; - node->prev = before->prev; + node->next = before; + node->parent = before; + node->prev = before->prev; - if(before->left) - return avl_insert_after(tree, before->prev, node); + if(before->left) { + avl_insert_after(tree, before->prev, node); + return; + } - if (before->prev) - before->prev->next = node; - else - tree->head = node; + if(before->prev) + before->prev->next = node; + else + tree->head = node; - before->prev = node; - before->left = node; + before->prev = node; + before->left = node; - avl_rebalance(tree, before->parent); + avl_rebalance(tree, before); } void avl_insert_after(avl_tree_t *tree, avl_node_t *after, avl_node_t *node) { - if (!after) - return tree->head ? avl_insert_before(tree, tree->head, node) : avl_insert_top(tree, node); + if(!after) { + if(tree->head) + avl_insert_before(tree, tree->head, node); + else + avl_insert_top(tree, node); + return; + } - if(after->right) - return avl_insert_before(tree, after->next, node); + if(after->right) { + avl_insert_before(tree, after->next, node); + return; + } - node->prev = after; - node->parent = after; - node->next = after->next; + node->prev = after; + node->parent = after; + node->next = after->next; - if (after->next) - after->next->prev = node; - else - tree->tail = node; - - after->next = node; - after->right = node; + if(after->next) + after->next->prev = node; + else + tree->tail = node; - avl_rebalance(tree, after->parent); + after->next = node; + after->right = node; + + avl_rebalance(tree, after); } avl_node_t *avl_unlink(avl_tree_t *tree, void *data) { - avl_node_t *node; - - node = avl_search_node(tree, data); + avl_node_t *node; - if(node) - avl_unlink_node(tree, node); + node = avl_search_node(tree, data); - return node; + if(node) + avl_unlink_node(tree, node); + + return node; } void avl_unlink_node(avl_tree_t *tree, avl_node_t *node) { - avl_node_t *parent; - avl_node_t **superparent; - avl_node_t *subst, *left, *right; - avl_node_t *balnode; + avl_node_t *parent; + avl_node_t **superparent; + avl_node_t *subst, *left, *right; + avl_node_t *balnode; - if (node->prev) - node->prev->next = node->next; - else - tree->head = node->next; - if (node->next) - node->next->prev = node->prev; - else - tree->tail = node->prev; + if(node->prev) + node->prev->next = node->next; + else + tree->head = node->next; + if(node->next) + node->next->prev = node->prev; + else + tree->tail = node->prev; - parent = node->parent; + parent = node->parent; - superparent = parent ? node == parent->left ? &parent->left : &parent->right : &tree->root; + superparent = + parent ? node == + parent->left ? &parent->left : &parent->right : &tree->root; - left = node->left; - right = node->right; - if (!left) - { - *superparent = right; - if (right) - right->parent = parent; - balnode = parent; - } else if (!right) - { - *superparent = left; - left->parent = parent; - balnode = parent; - } else - { - subst = node->prev; - if (subst == left) - { - balnode = subst; - } else - { - balnode = subst->parent; - balnode->right = subst->left; - if (balnode->right) - balnode->right->parent = balnode; - subst->left = left; - left->parent = subst; - } - subst->right = right; - subst->parent = parent; - right->parent = subst; - *superparent = subst; - } + left = node->left; + right = node->right; + if(!left) { + *superparent = right; - avl_rebalance(tree, balnode); - - node->next = node->prev = node->parent = node->left = node->right = NULL; + if(right) + right->parent = parent; + + balnode = parent; + } else if(!right) { + *superparent = left; + left->parent = parent; + balnode = parent; + } else { + subst = node->prev; + + if(subst == left) { + balnode = subst; + } else { + balnode = subst->parent; + balnode->right = subst->left; + + if(balnode->right) + balnode->right->parent = balnode; + + subst->left = left; + left->parent = subst; + } + + subst->right = right; + subst->parent = parent; + right->parent = subst; + *superparent = subst; + } + + avl_rebalance(tree, balnode); + + node->next = node->prev = node->parent = node->left = node->right = NULL; #ifdef AVL_COUNT - node->count = 0; + node->count = 0; #endif #ifdef AVL_DEPTH - node->depth = 0; + node->depth = 0; #endif } void avl_delete_node(avl_tree_t *tree, avl_node_t *node) { - avl_unlink_node(tree, node); - avl_free_node(tree, node); + avl_unlink_node(tree, node); + avl_free_node(tree, node); } void avl_delete(avl_tree_t *tree, void *data) { - avl_node_t *node; + avl_node_t *node; - node = avl_search_node(tree, data); + node = avl_search_node(tree, data); - if (node) - avl_delete_node(tree, node); + if(node) + avl_delete_node(tree, node); } /* Fast tree cleanup */ void avl_delete_tree(avl_tree_t *tree) { - avl_node_t *node, *next; - - for(node = tree->root; node; node = next) - { - next = node->next; - avl_free_node(tree, node); - } - - avl_free_tree(tree); + avl_node_t *node, *next; + + for(node = tree->root; node; node = next) { + next = node->next; + avl_free_node(tree, node); + } + + avl_free_tree(tree); } /* Tree walking */ -void avl_foreach(avl_tree_t *tree, avl_action_t action) +void avl_foreach(const avl_tree_t *tree, avl_action_t action) { - avl_node_t *node, *next; - - for(node = tree->head; node; node = next) - { - next = node->next; - action(node->data); - } + avl_node_t *node, *next; + + for(node = tree->head; node; node = next) { + next = node->next; + action(node->data); + } } -void avl_foreach_node(avl_tree_t *tree, avl_action_t action) +void avl_foreach_node(const avl_tree_t *tree, avl_action_t action) { - avl_node_t *node, *next; - - for(node = tree->head; node; node = next) - { - next = node->next; - action(node); - } + avl_node_t *node, *next; + + for(node = tree->head; node; node = next) { + next = node->next; + action(node); + } } /* Indexing */ #ifdef AVL_COUNT -unsigned int avl_count(avl_tree_t *tree) +unsigned int avl_count(const avl_tree_t *tree) { - return AVL_NODE_COUNT(tree->root); + return AVL_NODE_COUNT(tree->root); } avl_node_t *avl_get_node(const avl_tree_t *tree, unsigned int index) { - avl_node_t *node; - unsigned int c; + avl_node_t *node; + unsigned int c; - node = tree->root; + node = tree->root; - while (node) - { - c = AVL_L_COUNT(node); + while(node) { + c = AVL_L_COUNT(node); - if (index < c) - { - node = node->left; - } else if (index > c) - { - node = node->right; - index -= c + 1; - } else - { - return node; - } - } - - return NULL; + if(index < c) { + node = node->left; + } else if(index > c) { + node = node->right; + index -= c + 1; + } else { + return node; + } + } + + return NULL; } unsigned int avl_index(const avl_node_t *node) { - avl_node_t *next; - unsigned int index; + avl_node_t *next; + unsigned int index; - index = AVL_L_COUNT(node); + index = AVL_L_COUNT(node); - while ((next = node->parent)) - { - if (node == next->right) - index += AVL_L_COUNT(next) + 1; - node = next; - } + while((next = node->parent)) { + if(node == next->right) + index += AVL_L_COUNT(next) + 1; + node = next; + } - return index; + return index; } #endif #ifdef AVL_DEPTH -unsigned int avl_depth(avl_tree_t *tree) +unsigned int avl_depth(const avl_tree_t *tree) { - return AVL_NODE_DEPTH(tree->root); + return AVL_NODE_DEPTH(tree->root); } #endif diff --git a/lib/avl_tree.h b/lib/avl_tree.h index d1ad618..405f450 100644 --- a/lib/avl_tree.h +++ b/lib/avl_tree.h @@ -1,9 +1,9 @@ /* avl_tree.h -- header file for avl_tree.c Copyright (C) 1998 Michael H. Buselli - 2000,2001 Ivo Timmermans , - 2000,2001 Guus Sliepen - 2000,2001 Wessel Dankers + 2000-2004 Ivo Timmermans , + 2000-2004 Guus Sliepen + 2000-2004 Wessel Dankers 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 @@ -21,15 +21,15 @@ Original AVL tree library by Michael H. Buselli . - Modified 2000-11-28 by Wessel Dankers to use counts + Modified 2000-11-28 by Wessel Dankers to use counts instead of depths, to add the ->next and ->prev and to generally obfuscate the code. Mail me if you found a bug. Cleaned up and incorporated some of the ideas from the red-black tree - library for inclusion into tinc (http://tinc.nl.linux.org/) by - Guus Sliepen . + library for inclusion into tinc (http://www.tinc-vpn.org/) by + Guus Sliepen . - $Id: avl_tree.h,v 1.1.2.4 2001/02/06 10:13:22 guus Exp $ + $Id: avl_tree.h 1374 2004-03-21 14:21:22Z guus $ */ @@ -37,54 +37,54 @@ #define __AVL_TREE_H__ #ifndef AVL_DEPTH - #ifndef AVL_COUNT - #define AVL_DEPTH - #endif +#ifndef AVL_COUNT +#define AVL_DEPTH +#endif #endif typedef struct avl_node_t { - /* Linked list part */ + /* Linked list part */ - struct avl_node_t *next; - struct avl_node_t *prev; + struct avl_node_t *next; + struct avl_node_t *prev; - /* Tree part */ + /* Tree part */ - struct avl_node_t *parent; - struct avl_node_t *left; - struct avl_node_t *right; + struct avl_node_t *parent; + struct avl_node_t *left; + struct avl_node_t *right; #ifdef AVL_COUNT - unsigned int count; + unsigned int count; #endif #ifdef AVL_DEPTH - unsigned char depth; + unsigned char depth; #endif - /* Payload */ + /* Payload */ - void *data; + void *data; } avl_node_t; -typedef int (*avl_compare_t) (const void *, const void *); -typedef void (*avl_action_t) (const void *); -typedef void (*avl_action_node_t) (const avl_node_t *); +typedef int (*avl_compare_t)(const void *, const void *); +typedef void (*avl_action_t)(const void *); +typedef void (*avl_action_node_t)(const avl_node_t *); typedef struct avl_tree_t { - /* Linked list part */ + /* Linked list part */ - avl_node_t *head; - avl_node_t *tail; + avl_node_t *head; + avl_node_t *tail; - /* Tree part */ + /* Tree part */ - avl_node_t *root; + avl_node_t *root; - avl_compare_t compare; - avl_action_t delete; + avl_compare_t compare; + avl_action_t delete; } avl_tree_t; @@ -128,18 +128,18 @@ extern avl_node_t *avl_search_closest_greater_node(const avl_tree_t *, const voi /* Tree walking */ -extern void avl_foreach(avl_tree_t *, avl_action_t); -extern void avl_foreach_node(avl_tree_t *, avl_action_t); +extern void avl_foreach(const avl_tree_t *, avl_action_t); +extern void avl_foreach_node(const avl_tree_t *, avl_action_t); /* Indexing */ #ifdef AVL_COUNT -extern unsigned int avl_count(avl_tree_t *); +extern unsigned int avl_count(const avl_tree_t *); extern avl_node_t *avl_get_node(const avl_tree_t *, unsigned int); extern unsigned int avl_index(const avl_node_t *); #endif #ifdef AVL_DEPTH -extern unsigned int avl_depth(avl_tree_t *); +extern unsigned int avl_depth(const avl_tree_t *); #endif -#endif /* __AVL_TREE_H__ */ +#endif /* __AVL_TREE_H__ */ diff --git a/lib/dropin.c b/lib/dropin.c index 66aaa31..4007c14 100644 --- a/lib/dropin.c +++ b/lib/dropin.c @@ -1,7 +1,7 @@ /* dropin.c -- a set of drop-in replacements for libc functions - Copyright (C) 2000,2001 Ivo Timmermans , - 2000,2001 Guus Sliepen + Copyright (C) 2000-2004 Ivo Timmermans , + 2000-2004 Guus Sliepen 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 @@ -17,23 +17,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: dropin.c,v 1.1.2.8 2002/02/10 21:57:51 guus Exp $ + $Id: dropin.c 1374 2004-03-21 14:21:22Z guus $ */ -#include "config.h" +#include "system.h" -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include +#include "xalloc.h" #ifndef HAVE_DAEMON /* @@ -51,61 +40,55 @@ */ int daemon(int nochdir, int noclose) { - pid_t pid; - int fd; - - pid = fork(); - - /* Check if forking failed */ - if(pid < 0) - { - perror("fork"); - exit(-1); - } +#ifdef HAVE_FORK + pid_t pid; + int fd; - /* If we are the parent, terminate */ - if(pid) - exit(0); + pid = fork(); - /* Detach by becoming the new process group leader */ - if(setsid() < 0) - { - perror("setsid"); - return -1; - } - - /* Change working directory to the root (to avoid keeping mount - points busy) */ - if(!nochdir) - { - chdir("/"); - } - - /* Redirect stdin/out/err to /dev/null */ - if(!noclose) - { - fd = open("/dev/null", O_RDWR); + /* Check if forking failed */ + if(pid < 0) { + perror("fork"); + exit(-1); + } - if(fd < 0) - { - perror("opening /dev/null"); - return -1; - } - else - { - dup2(fd, 0); - dup2(fd, 1); - dup2(fd, 2); - } - } + /* If we are the parent, terminate */ + if(pid) + exit(0); - return 0; + /* Detach by becoming the new process group leader */ + if(setsid() < 0) { + perror("setsid"); + return -1; + } + + /* Change working directory to the root (to avoid keeping mount + points busy) */ + if(!nochdir) { + chdir("/"); + } + + /* Redirect stdin/out/err to /dev/null */ + if(!noclose) { + fd = open("/dev/null", O_RDWR); + + if(fd < 0) { + perror("opening /dev/null"); + return -1; + } else { + dup2(fd, 0); + dup2(fd, 1); + dup2(fd, 2); + } + } + + return 0; +#else + return -1; +#endif } #endif - - - #ifndef HAVE_GET_CURRENT_DIR_NAME /* Replacement for the GNU get_current_dir_name function: @@ -116,56 +99,75 @@ int daemon(int nochdir, int noclose) */ char *get_current_dir_name(void) { - size_t size; - char *buf; - char *r; + size_t size; + char *buf; + char *r; - /* Start with 100 bytes. If this turns out to be insufficient to - contain the working directory, double the size. */ - size = 100; - buf = xmalloc(size); + /* Start with 100 bytes. If this turns out to be insufficient to + contain the working directory, double the size. */ + size = 100; + buf = xmalloc(size); - errno = 0; /* Success */ - r = getcwd(buf, size); - /* getcwd returns NULL and sets errno to ERANGE if the bufferspace - is insufficient to contain the entire working directory. */ - while(r == NULL && errno == ERANGE) - { - free(buf); - size <<= 1; /* double the size */ - buf = xmalloc(size); - r = getcwd(buf, size); - } + errno = 0; /* Success */ + r = getcwd(buf, size); - return buf; + /* getcwd returns NULL and sets errno to ERANGE if the bufferspace + is insufficient to contain the entire working directory. */ + while(r == NULL && errno == ERANGE) { + free(buf); + size <<= 1; /* double the size */ + buf = xmalloc(size); + r = getcwd(buf, size); + } + + return buf; } #endif #ifndef HAVE_ASPRINTF int asprintf(char **buf, const char *fmt, ...) { - int status; - va_list ap; - int len; - - len = 4096; - *buf = xmalloc(len); + int status; + va_list ap; + int len; - va_start(ap, fmt); - status = vsnprintf (*buf, len, fmt, ap); - va_end (ap); + len = 4096; + *buf = xmalloc(len); - if(status >= 0) - *buf = xrealloc(*buf, status); + va_start(ap, fmt); + status = vsnprintf(*buf, len, fmt, ap); + va_end(ap); - if(status > len-1) - { - len = status; - va_start(ap, fmt); - status = vsnprintf (*buf, len, fmt, ap); - va_end (ap); - } + if(status >= 0) + *buf = xrealloc(*buf, status + 1); - return status; + if(status > len - 1) { + len = status; + va_start(ap, fmt); + status = vsnprintf(*buf, len, fmt, ap); + va_end(ap); + } + + return status; +} +#endif + +#ifndef HAVE_GETTIMEOFDAY +int gettimeofday(struct timeval *tv, void *tz) { + tv->tv_sec = time(NULL); + tv->tv_usec = 0; + return 0; +} +#endif + +#ifndef HAVE_RANDOM +#include + +long int random(void) { + long int x; + + RAND_pseudo_bytes((unsigned char *)&x, sizeof(x)); + + return x; } #endif diff --git a/lib/dropin.h b/lib/dropin.h index ad66d99..cedfb44 100644 --- a/lib/dropin.h +++ b/lib/dropin.h @@ -1,7 +1,7 @@ /* dropin.h -- header file for dropin.c - Copyright (C) 2000,2001 Ivo Timmermans , - 2000,2001 Guus Sliepen + Copyright (C) 2000-2004 Ivo Timmermans , + 2000-2004 Guus Sliepen 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 @@ -17,22 +17,38 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: dropin.h,v 1.1.2.6 2002/02/10 21:57:51 guus Exp $ + $Id: dropin.h 1374 2004-03-21 14:21:22Z guus $ */ #ifndef __DROPIN_H__ #define __DROPIN_H__ +#include "fake-getaddrinfo.h" +#include "fake-getnameinfo.h" + #ifndef HAVE_DAEMON extern int daemon(int, int); #endif #ifndef HAVE_GET_CURRENT_DIR_NAME -extern char* get_current_dir_name(void); +extern char *get_current_dir_name(void); #endif #ifndef HAVE_ASPRINTF extern int asprintf(char **, const char *, ...); #endif -#endif /* __DROPIN_H__ */ +#ifndef HAVE_GETNAMEINFO +extern int getnameinfo(const struct sockaddr *sa, size_t salen, char *host, + size_t hostlen, char *serv, size_t servlen, int flags); +#endif + +#ifndef HAVE_GETTIMEOFDAY +extern int gettimeofday(struct timeval *, void *); +#endif + +#ifndef HAVE_RANDOM +extern long int random(void); +#endif + +#endif /* __DROPIN_H__ */ diff --git a/lib/ethernet.h b/lib/ethernet.h new file mode 100644 index 0000000..c59c7c3 --- /dev/null +++ b/lib/ethernet.h @@ -0,0 +1,87 @@ +/* + ethernet.h -- missing Ethernet related definitions + Copyright (C) 2004 Ivo Timmermans + 2004 Guus Sliepen + + 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., 675 Mass Ave, Cambridge, MA 02139, USA. + + $Id: ethernet.h 1374 2004-03-21 14:21:22Z guus $ +*/ + +#ifndef __TINC_ETHERNET_H__ +#define __TINC_ETHERNET_H__ + +#ifndef ETH_ALEN +#define ETH_ALEN 6 +#endif + +#ifndef ARPHRD_ETHER +#define ARPHRD_ETHER 1 +#endif + +#ifndef ETH_P_IP +#define ETH_P_IP 0x0800 +#endif + +#ifndef ETH_P_ARP +#define ETH_P_ARP 0x0806 +#endif + +#ifndef ETH_P_IPV6 +#define ETH_P_IPV6 0x86DD +#endif + +#ifndef HAVE_STRUCT_ETHER_HEADER +struct ether_header { + uint8_t ether_dhost[ETH_ALEN]; + uint8_t ether_shost[ETH_ALEN]; + uint16_t ether_type; +} __attribute__ ((__packed__)); +#endif + +#ifndef HAVE_STRUCT_ARPHDR +struct arphdr { + uint16_t ar_hrd; + uint16_t ar_pro; + uint8_t ar_hln; + uint8_t ar_pln; + uint16_t ar_op; +} __attribute__ ((__packed__)); + +#define ARPOP_REQUEST 1 +#define ARPOP_REPLY 2 +#define ARPOP_RREQUEST 3 +#define ARPOP_RREPLY 4 +#define ARPOP_InREQUEST 8 +#define ARPOP_InREPLY 9 +#define ARPOP_NAK 10 +#endif + +#ifndef HAVE_STRUCT_ETHER_ARP +struct ether_arp { + struct arphdr ea_hdr; + uint8_t arp_sha[ETH_ALEN]; + uint8_t arp_spa[4]; + uint8_t arp_tha[ETH_ALEN]; + uint8_t arp_tpa[4]; +} __attribute__ ((__packed__)); +#define arp_hrd ea_hdr.ar_hrd +#define arp_pro ea_hdr.ar_pro +#define arp_hln ea_hdr.ar_hln +#define arp_pln ea_hdr.ar_pln +#define arp_op ea_hdr.ar_op +#endif + +#endif /* __TINC_ETHERNET_H__ */ diff --git a/lib/fake-gai-errnos.h b/lib/fake-gai-errnos.h new file mode 100644 index 0000000..61af9f9 --- /dev/null +++ b/lib/fake-gai-errnos.h @@ -0,0 +1,15 @@ +/* + * fake library for ssh + * + * This file is included in getaddrinfo.c and getnameinfo.c. + * See getaddrinfo.c and getnameinfo.c. + */ + +/* $Id: fake-gai-errnos.h 1374 2004-03-21 14:21:22Z guus $ */ + +/* for old netdb.h */ +#ifndef EAI_NODATA +#define EAI_NODATA 1 +#define EAI_MEMORY 2 +#define EAI_FAMILY 3 +#endif diff --git a/lib/fake-getaddrinfo.c b/lib/fake-getaddrinfo.c new file mode 100644 index 0000000..14420b5 --- /dev/null +++ b/lib/fake-getaddrinfo.c @@ -0,0 +1,105 @@ +/* + * fake library for ssh + * + * This file includes getaddrinfo(), freeaddrinfo() and gai_strerror(). + * These funtions are defined in rfc2133. + * + * But these functions are not implemented correctly. The minimum subset + * is implemented for ssh use only. For exapmle, this routine assumes + * that ai_family is AF_INET. Don't use it for another purpose. + */ + +#include "system.h" + +#include "ipv4.h" +#include "ipv6.h" +#include "fake-getaddrinfo.h" +#include "xalloc.h" + +#ifndef HAVE_GAI_STRERROR +char *gai_strerror(int ecode) +{ + switch (ecode) { + case EAI_NODATA: + return "No address associated with hostname"; + case EAI_MEMORY: + return "Memory allocation failure"; + case EAI_FAMILY: + return "Address family not supported"; + default: + return "Unknown error"; + } +} +#endif /* !HAVE_GAI_STRERROR */ + +#ifndef HAVE_FREEADDRINFO +void freeaddrinfo(struct addrinfo *ai) +{ + struct addrinfo *next; + + while(ai) { + next = ai->ai_next; + free(ai); + ai = next; + } +} +#endif /* !HAVE_FREEADDRINFO */ + +#ifndef HAVE_GETADDRINFO +static struct addrinfo *malloc_ai(uint16_t port, uint32_t addr) +{ + struct addrinfo *ai; + + ai = xmalloc_and_zero(sizeof(struct addrinfo) + sizeof(struct sockaddr_in)); + + ai->ai_addr = (struct sockaddr *)(ai + 1); + ai->ai_addrlen = sizeof(struct sockaddr_in); + ai->ai_addr->sa_family = ai->ai_family = AF_INET; + + ((struct sockaddr_in *)(ai)->ai_addr)->sin_port = port; + ((struct sockaddr_in *)(ai)->ai_addr)->sin_addr.s_addr = addr; + + return ai; +} + +int getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *hints, struct addrinfo **res) +{ + struct addrinfo *prev = NULL; + struct hostent *hp; + struct in_addr in = {0}; + int i; + uint16_t port = 0; + + if(hints && hints->ai_family != AF_INET && hints->ai_family != AF_UNSPEC) + return EAI_FAMILY; + + if (servname) + port = htons(atoi(servname)); + + if (hints && hints->ai_flags & AI_PASSIVE) { + *res = malloc_ai(port, htonl(0x00000000)); + return 0; + } + + if (!hostname) { + *res = malloc_ai(port, htonl(0x7f000001)); + return 0; + } + + hp = gethostbyname(hostname); + + if(!hp || !hp->h_addr_list || !hp->h_addr_list[0]) + return EAI_NODATA; + + for (i = 0; hp->h_addr_list[i]; i++) { + *res = malloc_ai(port, ((struct in_addr *)hp->h_addr_list[i])->s_addr); + + if(prev) + prev->ai_next = *res; + + prev = *res; + } + + return 0; +} +#endif /* !HAVE_GETADDRINFO */ diff --git a/lib/fake-getaddrinfo.h b/lib/fake-getaddrinfo.h new file mode 100644 index 0000000..112689f --- /dev/null +++ b/lib/fake-getaddrinfo.h @@ -0,0 +1,49 @@ +/* $Id: fake-getaddrinfo.h 1374 2004-03-21 14:21:22Z guus $ */ + +#ifndef _FAKE_GETADDRINFO_H +#define _FAKE_GETADDRINFO_H + +#include "fake-gai-errnos.h" + +#ifndef AI_PASSIVE +# define AI_PASSIVE 1 +# define AI_CANONNAME 2 +#endif + +#ifndef NI_NUMERICHOST +# define NI_NUMERICHOST 2 +# define NI_NAMEREQD 4 +# define NI_NUMERICSERV 8 +#endif + +#ifndef AI_NUMERICHOST +#define AI_NUMERICHOST 4 +#endif + +#ifndef HAVE_STRUCT_ADDRINFO +struct addrinfo { + int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ + int ai_family; /* PF_xxx */ + int ai_socktype; /* SOCK_xxx */ + int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ + size_t ai_addrlen; /* length of ai_addr */ + char *ai_canonname; /* canonical name for hostname */ + struct sockaddr *ai_addr; /* binary address */ + struct addrinfo *ai_next; /* next structure in linked list */ +}; +#endif /* !HAVE_STRUCT_ADDRINFO */ + +#ifndef HAVE_GETADDRINFO +int getaddrinfo(const char *hostname, const char *servname, + const struct addrinfo *hints, struct addrinfo **res); +#endif /* !HAVE_GETADDRINFO */ + +#ifndef HAVE_GAI_STRERROR +char *gai_strerror(int ecode); +#endif /* !HAVE_GAI_STRERROR */ + +#ifndef HAVE_FREEADDRINFO +void freeaddrinfo(struct addrinfo *ai); +#endif /* !HAVE_FREEADDRINFO */ + +#endif /* _FAKE_GETADDRINFO_H */ diff --git a/lib/fake-getnameinfo.c b/lib/fake-getnameinfo.c new file mode 100644 index 0000000..796efdf --- /dev/null +++ b/lib/fake-getnameinfo.c @@ -0,0 +1,55 @@ +/* + * fake library for ssh + * + * This file includes getnameinfo(). + * These funtions are defined in rfc2133. + * + * But these functions are not implemented correctly. The minimum subset + * is implemented for ssh use only. For exapmle, this routine assumes + * that ai_family is AF_INET. Don't use it for another purpose. + */ + +#include "system.h" + +#include "fake-getnameinfo.h" +#include "fake-getaddrinfo.h" + +#ifndef HAVE_GETNAMEINFO + +int getnameinfo(const struct sockaddr *sa, size_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags) +{ + struct sockaddr_in *sin = (struct sockaddr_in *)sa; + struct hostent *hp; + int len; + + if(sa->sa_family != AF_INET) + return EAI_FAMILY; + + if(serv && servlen) { + len = snprintf(serv, servlen, "%d", ntohs(sin->sin_port)); + if(len < 0 || len >= servlen) + return EAI_MEMORY; + } + + if(!host || !hostlen) + return 0; + + if(flags & NI_NUMERICHOST) { + len = snprintf(host, hostlen, "%s", inet_ntoa(sin->sin_addr)); + if(len < 0 || len >= hostlen) + return EAI_MEMORY; + return 0; + } + + hp = gethostbyaddr((char *)&sin->sin_addr, sizeof(struct in_addr), AF_INET); + + if(!hp || !hp->h_name || !hp->h_name[0]) + return EAI_NODATA; + + len = snprintf(host, hostlen, "%s", hp->h_name); + if(len < 0 || len >= hostlen) + return EAI_MEMORY; + + return 0; +} +#endif /* !HAVE_GETNAMEINFO */ diff --git a/lib/fake-getnameinfo.h b/lib/fake-getnameinfo.h new file mode 100644 index 0000000..5c3b0f3 --- /dev/null +++ b/lib/fake-getnameinfo.h @@ -0,0 +1,18 @@ +/* $Id: fake-getnameinfo.h 1374 2004-03-21 14:21:22Z guus $ */ + +#ifndef _FAKE_GETNAMEINFO_H +#define _FAKE_GETNAMEINFO_H + +#ifndef HAVE_GETNAMEINFO +int getnameinfo(const struct sockaddr *sa, size_t salen, char *host, + size_t hostlen, char *serv, size_t servlen, int flags); +#endif /* !HAVE_GETNAMEINFO */ + +#ifndef NI_MAXSERV +# define NI_MAXSERV 32 +#endif /* !NI_MAXSERV */ +#ifndef NI_MAXHOST +# define NI_MAXHOST 1025 +#endif /* !NI_MAXHOST */ + +#endif /* _FAKE_GETNAMEINFO_H */ diff --git a/lib/getopt.c b/lib/getopt.c index 300f86d..5e397ba 100644 --- a/lib/getopt.c +++ b/lib/getopt.c @@ -85,16 +85,7 @@ USA. */ #define getpid() GetCurrentProcessId() #endif -#ifndef _ -/* This is for other GNU distributions with internationalized messages. - When compiling libc, the _ macro is predefined. */ -#ifdef HAVE_LIBINTL_H -# include -# define _(msgid) gettext (msgid) -#else -# define _(msgid) (msgid) -#endif -#endif +#include "gettext.h" /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user @@ -268,7 +259,7 @@ extern pid_t __libc_pid; is valid for the getopt call we must make sure that the ARGV passed to getopt is that one passed to the process. */ static void -__attribute__ ((unused)) +__attribute__ ((__unused__)) store_args_and_env (int argc, char *const *argv) { /* XXX This is no good solution. We should rather copy the args so diff --git a/lib/gettext.h b/lib/gettext.h new file mode 100644 index 0000000..a907403 --- /dev/null +++ b/lib/gettext.h @@ -0,0 +1,79 @@ +/* Convenience header for conditional use of GNU . + Copyright (C) 1995-1998, 2000-2003 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published + by the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library 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 _LIBGETTEXT_H +#define _LIBGETTEXT_H 1 + +/* NLS can be disabled through the configure --disable-nls option. */ +#if ENABLE_NLS + +/* Get declarations of GNU message catalog functions. */ +# include +# include + +/* Shorthand notation */ + +# define _(Text) gettext (Text) + +#else + +/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which + chokes if dcgettext is defined as a macro. So include it now, to make + later inclusions of a NOP. We don't include + as well because people using "gettext.h" will not include , + and also including would fail on SunOS 4, whereas + is OK. */ +#if defined(__sun) +# include +#endif + +/* Disabled NLS. + The casts to 'const char *' serve the purpose of producing warnings + for invalid uses of the value returned from these functions. + On pre-ANSI systems without 'const', the config.h file is supposed to + contain "#define const". */ +# define gettext(Msgid) ((const char *) (Msgid)) +# define dgettext(Domainname, Msgid) ((const char *) (Msgid)) +# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) +# define ngettext(Msgid1, Msgid2, N) \ + ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) +# define dngettext(Domainname, Msgid1, Msgid2, N) \ + ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) +# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ + ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) +# define textdomain(Domainname) ((const char *) (Domainname)) +# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname)) +# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset)) + +# define _(Text) Text +# define setlocale(Category, Locale) ((const char *) (Locale)) + +#endif + +/* A pseudo function call that serves as a marker for the automated + extraction of messages, but does not call gettext(). The run-time + translation is done at a different place in the code. + The argument, String, should be a literal string. Concatenated strings + and other string expressions won't work. + The macro's expansion is not parenthesized, so that it is suitable as + initializer for static 'char[]' or 'const char[]' variables. */ +#define gettext_noop(String) String + +#define N_(Text) Text + +#endif /* _LIBGETTEXT_H */ diff --git a/lib/ipv4.h b/lib/ipv4.h new file mode 100644 index 0000000..2b71e1b --- /dev/null +++ b/lib/ipv4.h @@ -0,0 +1,139 @@ +/* + ipv4.h -- missing IPv4 related definitions + Copyright (C) 2004 Ivo Timmermans + 2004 Guus Sliepen + + 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., 675 Mass Ave, Cambridge, MA 02139, USA. + + $Id: ipv4.h 1412 2004-11-10 21:14:08Z guus $ +*/ + +#ifndef __TINC_IPV4_H__ +#define __TINC_IPV4_H__ + +#ifndef AF_INET +#define AF_INET 2 +#endif + +#ifndef IPPROTO_ICMP +#define IPPROTO_ICMP 1 +#endif + +#ifndef ICMP_DEST_UNREACH +#define ICMP_DEST_UNREACH 3 +#endif + +#ifndef ICMP_FRAG_NEEDED +#define ICMP_FRAG_NEEDED 4 +#endif + +#ifndef ICMP_NET_UNKNOWN +#define ICMP_NET_UNKNOWN 6 +#endif + +#ifndef ICMP_NET_UNREACH +#define ICMP_NET_UNREACH 0 +#endif + +#ifndef IP_MSS +#define IP_MSS 576 +#endif + +#ifndef HAVE_STRUCT_IP +struct ip { +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int ip_hl:4; + unsigned int ip_v:4; +#else + unsigned int ip_v:4; + unsigned int ip_hl:4; +#endif + uint8_t ip_tos; + uint16_t ip_len; + uint16_t ip_id; + uint16_t ip_off; +#define IP_RF 0x8000 +#define IP_DF 0x4000 +#define IP_MF 0x2000 + uint8_t ip_ttl; + uint8_t ip_p; + uint16_t ip_sum; + struct in_addr ip_src, ip_dst; +} __attribute__ ((__packed__)); +#endif + +#ifndef IP_OFFMASK +#define IP_OFFMASK 0x1fff +#endif + +#ifndef HAVE_STRUCT_ICMP +struct icmp { + uint8_t icmp_type; + uint8_t icmp_code; + uint16_t icmp_cksum; + union { + uint8_t ih_pptr; + struct in_addr ih_gwaddr; + struct ih_idseq { + uint16_t icd_id; + uint16_t icd_seq; + } ih_idseq; + uint32_t ih_void; + + + struct ih_pmtu { + uint16_t ipm_void; + uint16_t ipm_nextmtu; + } ih_pmtu; + + struct ih_rtradv { + uint8_t irt_num_addrs; + uint8_t irt_wpa; + uint16_t irt_lifetime; + } ih_rtradv; + } icmp_hun; +#define icmp_pptr icmp_hun.ih_pptr +#define icmp_gwaddr icmp_hun.ih_gwaddr +#define icmp_id icmp_hun.ih_idseq.icd_id +#define icmp_seq icmp_hun.ih_idseq.icd_seq +#define icmp_void icmp_hun.ih_void +#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void +#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu +#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs +#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa +#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime + union { + struct { + uint32_t its_otime; + uint32_t its_rtime; + uint32_t its_ttime; + } id_ts; + struct { + struct ip idi_ip; + } id_ip; + uint32_t id_mask; + uint8_t id_data[1]; + } icmp_dun; +#define icmp_otime icmp_dun.id_ts.its_otime +#define icmp_rtime icmp_dun.id_ts.its_rtime +#define icmp_ttime icmp_dun.id_ts.its_ttime +#define icmp_ip icmp_dun.id_ip.idi_ip +#define icmp_radv icmp_dun.id_radv +#define icmp_mask icmp_dun.id_mask +#define icmp_data icmp_dun.id_data +} __attribute__ ((__packed__)); +#endif + +#endif /* __TINC_IPV4_H__ */ diff --git a/lib/ipv6.h b/lib/ipv6.h new file mode 100644 index 0000000..b6ab4bf --- /dev/null +++ b/lib/ipv6.h @@ -0,0 +1,129 @@ +/* + ipv6.h -- missing IPv6 related definitions + Copyright (C) 2004 Ivo Timmermans + 2004 Guus Sliepen + + 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., 675 Mass Ave, Cambridge, MA 02139, USA. + + $Id: ipv6.h 1374 2004-03-21 14:21:22Z guus $ +*/ + +#ifndef __TINC_IPV6_H__ +#define __TINC_IPV6_H__ + +#ifndef AF_INET6 +#define AF_INET6 10 +#endif + +#ifndef IPPROTO_ICMPV6 +#define IPPROTO_ICMPV6 58 +#endif + +#ifndef HAVE_STRUCT_IN6_ADDR +struct in6_addr { + union { + uint8_t u6_addr8[16]; + uint16_t u6_addr16[8]; + uint32_t u6_addr32[4]; + } in6_u; +} __attribute__ ((__packed__)); +#define s6_addr in6_u.u6_addr8 +#define s6_addr16 in6_u.u6_addr16 +#define s6_addr32 in6_u.u6_addr32 +#endif + +#ifndef HAVE_STRUCT_SOCKADDR_IN6 +struct sockaddr_in6 { + uint16_t sin6_family; + uint16_t sin6_port; + uint32_t sin6_flowinfo; + struct in6_addr sin6_addr; + uint32_t sin6_scope_id; +} __attribute__ ((__packed__)); +#endif + +#ifndef IN6_IS_ADDR_V4MAPPED +#define IN6_IS_ADDR_V4MAPPED(a) \ + ((((__const uint32_t *) (a))[0] == 0) \ + && (((__const uint32_t *) (a))[1] == 0) \ + && (((__const uint32_t *) (a))[2] == htonl (0xffff))) +#endif + +#ifndef HAVE_STRUCT_IP6_HDR +struct ip6_hdr { + union { + struct ip6_hdrctl { + uint32_t ip6_un1_flow; + uint16_t ip6_un1_plen; + uint8_t ip6_un1_nxt; + uint8_t ip6_un1_hlim; + } ip6_un1; + uint8_t ip6_un2_vfc; + } ip6_ctlun; + struct in6_addr ip6_src; + struct in6_addr ip6_dst; +} __attribute__ ((__packed__)); +#define ip6_vfc ip6_ctlun.ip6_un2_vfc +#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow +#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen +#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt +#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim +#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim +#endif + +#ifndef HAVE_STRUCT_ICMP6_HDR +struct icmp6_hdr { + uint8_t icmp6_type; + uint8_t icmp6_code; + uint16_t icmp6_cksum; + union { + uint32_t icmp6_un_data32[1]; + uint16_t icmp6_un_data16[2]; + uint8_t icmp6_un_data8[4]; + } icmp6_dataun; +} __attribute__ ((__packed__)); +#define ICMP6_DST_UNREACH_NOROUTE 0 +#define ICMP6_DST_UNREACH 1 +#define ICMP6_PACKET_TOO_BIG 2 +#define ICMP6_DST_UNREACH_ADDR 3 +#define ND_NEIGHBOR_SOLICIT 135 +#define ND_NEIGHBOR_ADVERT 136 +#define icmp6_data32 icmp6_dataun.icmp6_un_data32 +#define icmp6_data16 icmp6_dataun.icmp6_un_data16 +#define icmp6_data8 icmp6_dataun.icmp6_un_data8 +#define icmp6_mtu icmp6_data32[0] +#endif + +#ifndef HAVE_STRUCT_ND_NEIGHBOR_SOLICIT +struct nd_neighbor_solicit { + struct icmp6_hdr nd_ns_hdr; + struct in6_addr nd_ns_target; +} __attribute__ ((__packed__)); +#define ND_OPT_SOURCE_LINKADDR 1 +#define ND_OPT_TARGET_LINKADDR 2 +#define nd_ns_type nd_ns_hdr.icmp6_type +#define nd_ns_code nd_ns_hdr.icmp6_code +#define nd_ns_cksum nd_ns_hdr.icmp6_cksum +#define nd_ns_reserved nd_ns_hdr.icmp6_data32[0] +#endif + +#ifndef HAVE_STRUCT_ND_OPT_HDR +struct nd_opt_hdr { + uint8_t nd_opt_type; + uint8_t nd_opt_len; +} __attribute__ ((__packed__)); +#endif + +#endif /* __TINC_IPV6_H__ */ diff --git a/lib/list.c b/lib/list.c index cb2d4d2..ffb62fc 100644 --- a/lib/list.c +++ b/lib/list.c @@ -1,7 +1,7 @@ /* list.c -- functions to deal with double linked lists - Copyright (C) 2000,2001 Ivo Timmermans - 2000,2001 Guus Sliepen + Copyright (C) 2000-2004 Ivo Timmermans + 2000-2004 Guus Sliepen 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 @@ -17,181 +17,170 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: list.c,v 1.1.2.10 2002/03/27 15:01:16 guus Exp $ + $Id: list.c 1374 2004-03-21 14:21:22Z guus $ */ -#include "config.h" - -#include - -#include -#include +#include "system.h" #include "list.h" +#include "xalloc.h" /* (De)constructors */ list_t *list_alloc(list_action_t delete) { - list_t *list; + list_t *list; - list = xmalloc_and_zero(sizeof(list_t)); - list->delete = delete; + list = xmalloc_and_zero(sizeof(list_t)); + list->delete = delete; - return list; + return list; } void list_free(list_t *list) { - free(list); + free(list); } list_node_t *list_alloc_node(void) { - list_node_t *node; - - node = xmalloc_and_zero(sizeof(list_node_t)); - - return node; + return xmalloc_and_zero(sizeof(list_node_t)); } void list_free_node(list_t *list, list_node_t *node) { - if(node->data && list->delete) - list->delete(node->data); - - free(node); + if(node->data && list->delete) + list->delete(node->data); + + free(node); } /* Insertion and deletion */ list_node_t *list_insert_head(list_t *list, void *data) { - list_node_t *node; - - node = list_alloc_node(); - - node->data = data; - node->prev = NULL; - node->next = list->head; - list->head = node; - - if(node->next) - node->next->prev = node; - else - list->tail = node; + list_node_t *node; - list->count++; + node = list_alloc_node(); - return node; + node->data = data; + node->prev = NULL; + node->next = list->head; + list->head = node; + + if(node->next) + node->next->prev = node; + else + list->tail = node; + + list->count++; + + return node; } list_node_t *list_insert_tail(list_t *list, void *data) { - list_node_t *node; - - node = list_alloc_node(); - - node->data = data; - node->next = NULL; - node->prev = list->tail; - list->tail = node; - - if(node->prev) - node->prev->next = node; - else - list->head = node; + list_node_t *node; - list->count++; - - return node; + node = list_alloc_node(); + + node->data = data; + node->next = NULL; + node->prev = list->tail; + list->tail = node; + + if(node->prev) + node->prev->next = node; + else + list->head = node; + + list->count++; + + return node; } void list_unlink_node(list_t *list, list_node_t *node) { - if(node->prev) - node->prev->next = node->next; - else - list->head = node->next; - - if(node->next) - node->next->prev = node->prev; - else - list->tail = node->prev; + if(node->prev) + node->prev->next = node->next; + else + list->head = node->next; - list->count--; + if(node->next) + node->next->prev = node->prev; + else + list->tail = node->prev; + + list->count--; } void list_delete_node(list_t *list, list_node_t *node) { - list_unlink_node(list, node); - list_free_node(list, node); + list_unlink_node(list, node); + list_free_node(list, node); } void list_delete_head(list_t *list) { - list_delete_node(list, list->head); + list_delete_node(list, list->head); } void list_delete_tail(list_t *list) { - list_delete_node(list, list->tail); + list_delete_node(list, list->tail); } /* Head/tail lookup */ void *list_get_head(list_t *list) { - if(list->head) - return list->head->data; - else - return NULL; + if(list->head) + return list->head->data; + else + return NULL; } void *list_get_tail(list_t *list) { - if(list->tail) - return list->tail->data; - else - return NULL; + if(list->tail) + return list->tail->data; + else + return NULL; } /* Fast list deletion */ void list_delete_list(list_t *list) { - list_node_t *node, *next; - - for(node = list->head; node; node = next) - { - next = node->next; - list_free_node(list, node); - } + list_node_t *node, *next; - list_free(list); + for(node = list->head; node; node = next) { + next = node->next; + list_free_node(list, node); + } + + list_free(list); } /* Traversing */ void list_foreach_node(list_t *list, list_action_node_t action) { - list_node_t *node, *next; + list_node_t *node, *next; - for(node = list->head; node; node = next) - { - next = node->next; - action(node); - } + for(node = list->head; node; node = next) { + next = node->next; + action(node); + } } void list_foreach(list_t *list, list_action_t action) { - list_node_t *node, *next; + list_node_t *node, *next; - for(node = list->head; node; node = next) - { - next = node->next; - if(node->data) - action(node->data); - } + for(node = list->head; node; node = next) { + next = node->next; + if(node->data) + action(node->data); + } } diff --git a/lib/list.h b/lib/list.h index 3e1735b..f5a9297 100644 --- a/lib/list.h +++ b/lib/list.h @@ -1,7 +1,7 @@ /* list.h -- header file for list.c - Copyright (C) 2000,2001 Ivo Timmermans - 2000,2001 Guus Sliepen + Copyright (C) 2000-2004 Ivo Timmermans + 2000-2004 Guus Sliepen 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 @@ -17,39 +17,37 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: list.h,v 1.1.2.5 2002/03/27 15:01:16 guus Exp $ + $Id: list.h 1374 2004-03-21 14:21:22Z guus $ */ #ifndef __TINC_LIST_H__ #define __TINC_LIST_H__ -typedef struct list_node_t -{ - struct list_node_t *prev; - struct list_node_t *next; +typedef struct list_node_t { + struct list_node_t *prev; + struct list_node_t *next; - /* Payload */ + /* Payload */ - void *data; + void *data; } list_node_t; -typedef void (*list_action_t) (const void *); -typedef void (*list_action_node_t) (const list_node_t *); +typedef void (*list_action_t)(const void *); +typedef void (*list_action_node_t)(const list_node_t *); -typedef struct list_t -{ - list_node_t *head; - list_node_t *tail; - int count; +typedef struct list_t { + list_node_t *head; + list_node_t *tail; + int count; - /* Callbacks */ + /* Callbacks */ - list_action_t delete; + list_action_t delete; } list_t; /* (De)constructors */ -extern list_t *list_alloc(list_action_t); +extern list_t *list_alloc(list_action_t) __attribute__ ((__malloc__)); extern void list_free(list_t *); extern list_node_t *list_alloc_node(void); extern void list_free_node(list_t *, list_node_t *); @@ -79,4 +77,4 @@ extern void list_delete_list(list_t *); extern void list_foreach(list_t *, list_action_t); extern void list_foreach_node(list_t *, list_action_node_t); -#endif /* __TINC_LIST_H__ */ +#endif /* __TINC_LIST_H__ */ diff --git a/lib/pidfile.c b/lib/pidfile.c index a954d18..61a802f 100644 --- a/lib/pidfile.c +++ b/lib/pidfile.c @@ -25,30 +25,23 @@ * First version (v0.2) released */ -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "system.h" +#ifndef HAVE_MINGW /* read_pid * * Reads the specified pidfile and returns the read pid. * 0 is returned if either there's no pidfile, it's empty * or no pid can be read. */ -int read_pid (char *pidfile) +pid_t read_pid (char *pidfile) { FILE *f; - int pid; + long pid; if (!(f=fopen(pidfile,"r"))) return 0; - fscanf(f,"%d", &pid); + fscanf(f,"%ld", &pid); fclose(f); return pid; } @@ -57,11 +50,11 @@ int read_pid (char *pidfile) * * Reads the pid using read_pid and looks up the pid in the process * table (using /proc) to determine if the process already exists. If - * so 1 is returned, otherwise 0. + * so the pid is returned, otherwise 0. */ -int check_pid (char *pidfile) +pid_t check_pid (char *pidfile) { - int pid = read_pid(pidfile); + pid_t pid = read_pid(pidfile); /* Amazing ! _I_ am already holding the pid file... */ if ((!pid) || (pid == getpid ())) @@ -75,7 +68,7 @@ int check_pid (char *pidfile) /* But... errno is usually changed only on error.. */ errno = 0; if (kill(pid, 0) && errno == ESRCH) - return(0); + return 0; return pid; } @@ -85,30 +78,26 @@ int check_pid (char *pidfile) * Writes the pid to the specified file. If that fails 0 is * returned, otherwise the pid. */ -int write_pid (char *pidfile) +pid_t write_pid (char *pidfile) { FILE *f; int fd; - int pid; + pid_t pid; if ( ((fd = open(pidfile, O_RDWR|O_CREAT, 0644)) == -1) || ((f = fdopen(fd, "r+")) == NULL) ) { - fprintf(stderr, "Can't open or create %s.\n", pidfile); return 0; } #ifdef HAVE_FLOCK if (flock(fd, LOCK_EX|LOCK_NB) == -1) { - fscanf(f, "%d", &pid); fclose(f); - printf("Can't lock, lock is held by pid %d.\n", pid); return 0; } #endif pid = getpid(); - if (!fprintf(f,"%d\n", pid)) { - printf("Can't write pid , %s.\n", strerror(errno)); + if (!fprintf(f,"%ld\n", (long)pid)) { close(fd); return 0; } @@ -116,7 +105,6 @@ int write_pid (char *pidfile) #ifdef HAVE_FLOCK if (flock(fd, LOCK_UN) == -1) { - printf("Can't unlock pidfile %s, %s.\n", pidfile, strerror(errno)); close(fd); return 0; } @@ -135,4 +123,4 @@ int remove_pid (char *pidfile) { return unlink (pidfile); } - +#endif diff --git a/lib/pidfile.h b/lib/pidfile.h index 19d19c1..152ae2c 100644 --- a/lib/pidfile.h +++ b/lib/pidfile.h @@ -19,13 +19,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ +#ifndef HAVE_MINGW /* read_pid * * Reads the specified pidfile and returns the read pid. * 0 is returned if either there's no pidfile, it's empty * or no pid can be read. */ -int read_pid (char *pidfile); +pid_t read_pid (char *pidfile); /* check_pid * @@ -33,14 +34,14 @@ int read_pid (char *pidfile); * table (using /proc) to determine if the process already exists. If * so 1 is returned, otherwise 0. */ -int check_pid (char *pidfile); +pid_t check_pid (char *pidfile); /* write_pid * * Writes the pid to the specified file. If that fails 0 is * returned, otherwise the pid. */ -int write_pid (char *pidfile); +pid_t write_pid (char *pidfile); /* remove_pid * @@ -48,3 +49,4 @@ int write_pid (char *pidfile); * is returned */ int remove_pid (char *pidfile); +#endif diff --git a/lib/utils.c b/lib/utils.c index d79532b..19c86a9 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -1,7 +1,7 @@ /* utils.c -- gathering of some stupid small functions - Copyright (C) 1999-2001 Ivo Timmermans - 2000,2001 Guus Sliepen + Copyright (C) 1999-2004 Ivo Timmermans + 2000-2004 Guus Sliepen 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 @@ -18,15 +18,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include +#include "system.h" -#include "config.h" - -#include -#include -#include +#include "../src/logger.h" +#include "utils.h" #ifdef ENABLE_TRACING volatile int (cp_line[]) = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; @@ -38,50 +33,70 @@ char *hexadecimals = "0123456789ABCDEF"; int charhex2bin(char c) { - if(isdigit(c)) - return c - '0'; - else - return toupper(c) - 'A' + 10; + if(isdigit(c)) + return c - '0'; + else + return toupper(c) - 'A' + 10; } void hex2bin(char *src, char *dst, int length) { - int i; - for(i=0; i=0; i--) - { - dst[i*2+1] = hexadecimals[(unsigned char)src[i] & 15]; - dst[i*2] = hexadecimals[(unsigned char)src[i]>>4]; - } + int i; + for(i = length - 1; i >= 0; i--) { + dst[i * 2 + 1] = hexadecimals[(unsigned char) src[i] & 15]; + dst[i * 2] = hexadecimals[(unsigned char) src[i] >> 4]; + } } #ifdef ENABLE_TRACING void cp_trace() { - syslog(LOG_DEBUG, "Checkpoint trace: %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d...", - cp_file[(cp_index+15)%16], cp_line[(cp_index+15)%16], - cp_file[(cp_index+14)%16], cp_line[(cp_index+14)%16], - cp_file[(cp_index+13)%16], cp_line[(cp_index+13)%16], - cp_file[(cp_index+12)%16], cp_line[(cp_index+12)%16], - cp_file[(cp_index+11)%16], cp_line[(cp_index+11)%16], - cp_file[(cp_index+10)%16], cp_line[(cp_index+10)%16], - cp_file[(cp_index+9)%16], cp_line[(cp_index+9)%16], - cp_file[(cp_index+8)%16], cp_line[(cp_index+8)%16], - cp_file[(cp_index+7)%16], cp_line[(cp_index+7)%16], - cp_file[(cp_index+6)%16], cp_line[(cp_index+6)%16], - cp_file[(cp_index+5)%16], cp_line[(cp_index+5)%16], - cp_file[(cp_index+4)%16], cp_line[(cp_index+4)%16], - cp_file[(cp_index+3)%16], cp_line[(cp_index+3)%16], - cp_file[(cp_index+2)%16], cp_line[(cp_index+2)%16], - cp_file[(cp_index+1)%16], cp_line[(cp_index+1)%16], - cp_file[cp_index], cp_line[cp_index] - ); + logger(LOG_DEBUG, "Checkpoint trace: %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d...", + cp_file[(cp_index + 15) % 16], cp_line[(cp_index + 15) % 16], + cp_file[(cp_index + 14) % 16], cp_line[(cp_index + 14) % 16], + cp_file[(cp_index + 13) % 16], cp_line[(cp_index + 13) % 16], + cp_file[(cp_index + 12) % 16], cp_line[(cp_index + 12) % 16], + cp_file[(cp_index + 11) % 16], cp_line[(cp_index + 11) % 16], + cp_file[(cp_index + 10) % 16], cp_line[(cp_index + 10) % 16], + cp_file[(cp_index + 9) % 16], cp_line[(cp_index + 9) % 16], + cp_file[(cp_index + 8) % 16], cp_line[(cp_index + 8) % 16], + cp_file[(cp_index + 7) % 16], cp_line[(cp_index + 7) % 16], + cp_file[(cp_index + 6) % 16], cp_line[(cp_index + 6) % 16], + cp_file[(cp_index + 5) % 16], cp_line[(cp_index + 5) % 16], + cp_file[(cp_index + 4) % 16], cp_line[(cp_index + 4) % 16], + cp_file[(cp_index + 3) % 16], cp_line[(cp_index + 3) % 16], + cp_file[(cp_index + 2) % 16], cp_line[(cp_index + 2) % 16], + cp_file[(cp_index + 1) % 16], cp_line[(cp_index + 1) % 16], + cp_file[cp_index], cp_line[cp_index] + ); } #endif + +#if defined(HAVE_MINGW) || defined(HAVE_CYGWIN) +#ifdef HAVE_CYGWIN +#include +#endif + +char *winerror(int err) { + static char buf[1024], *newline; + + if (!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, sizeof(buf), NULL)) { + strncpy(buf, _("(unable to format errormessage)"), sizeof(buf)); + }; + + if((newline = strchr(buf, '\r'))) + *newline = '\0'; + + return buf; +} +#endif + diff --git a/lib/utils.h b/lib/utils.h index 0b79bfa..a47f91a 100644 --- a/lib/utils.h +++ b/lib/utils.h @@ -1,7 +1,7 @@ /* utils.h -- header file for utils.c - Copyright (C) 1999-2001 Ivo Timmermans - 2000,2001 Guus Sliepen + Copyright (C) 1999-2004 Ivo Timmermans + 2000-2004 Guus Sliepen 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 @@ -21,37 +21,26 @@ #ifndef __TINC_UTILS_H__ #define __TINC_UTILS_H__ -#include - -enum { - DEBUG_NOTHING = 0, /* Quiet mode, only show starting/stopping of the daemon */ - DEBUG_CONNECTIONS = 1, /* Show (dis)connects of other tinc daemons via TCP */ - DEBUG_ERROR = 2, /* Show error messages received from other hosts */ - DEBUG_STATUS = 2, /* Show status messages received from other hosts */ - DEBUG_PROTOCOL = 3, /* Show the requests that are sent/received */ - DEBUG_META = 4, /* Show contents of every request that is sent/received */ - DEBUG_TRAFFIC = 5, /* Show network traffic information */ - DEBUG_PACKET = 6, /* Show contents of each packet that is being sent/received */ - DEBUG_SCARY_THINGS = 10 /* You have been warned */ -}; - -#define min(a,b) (((a)<(b))?(a):(b)) - #ifdef ENABLE_TRACING extern volatile int cp_line[]; extern volatile char *cp_file[]; extern volatile int cp_index; extern void cp_trace(void); - #define cp { cp_line[cp_index] = __LINE__; cp_file[cp_index] = __FILE__; cp_index++; cp_index %= 16; } - #define ecp { fprintf(stderr, "Explicit checkpoint in %s line %d\n", __FILE__, __LINE__); } +#define cp() { cp_line[cp_index] = __LINE__; cp_file[cp_index] = __FILE__; cp_index++; cp_index %= 16; } +#define ecp() { fprintf(stderr, "Explicit checkpoint in %s line %d\n", __FILE__, __LINE__); } #else - #define cp - #define ecp - #define cp_trace() +#define cp() +#define ecp() +#define cp_trace() #endif extern void hex2bin(char *src, char *dst, int length); extern void bin2hex(char *src, char *dst, int length); -#endif /* __TINC_UTILS_H__ */ +#ifdef HAVE_MINGW +extern char *winerror(int); +#define strerror(x) ((x)>0?strerror(x):winerror(GetLastError())) +#endif + +#endif /* __TINC_UTILS_H__ */ diff --git a/lib/xalloc.h b/lib/xalloc.h index caf0f37..7cb486a 100644 --- a/lib/xalloc.h +++ b/lib/xalloc.h @@ -18,9 +18,9 @@ extern char *const xalloc_msg_memory_exhausted; /* FIXME: describe */ extern void (*xalloc_fail_func) (); -void *xmalloc PARAMS ((size_t n)); -void *xmalloc_and_zero PARAMS ((size_t n)); +void *xmalloc PARAMS ((size_t n)) __attribute__ ((__malloc__)); +void *xmalloc_and_zero PARAMS ((size_t n)) __attribute__ ((__malloc__)); void *xcalloc PARAMS ((size_t n, size_t s)); -void *xrealloc PARAMS ((void *p, size_t n)); +void *xrealloc PARAMS ((void *p, size_t n)) __attribute__ ((__malloc__)); -char *xstrdup PARAMS ((const char *s)); +char *xstrdup PARAMS ((const char *s)) __attribute__ ((__malloc__)); diff --git a/lib/xmalloc.c b/lib/xmalloc.c index e1ab314..e7541bd 100644 --- a/lib/xmalloc.c +++ b/lib/xmalloc.c @@ -32,15 +32,7 @@ void *realloc (); void free (); #endif -#if ENABLE_NLS -# include -# define _(Text) gettext (Text) -#else -# define textdomain(Domain) -# define _(Text) Text -#endif -#define N_(Text) Text - +#include "gettext.h" #include "xalloc.h" #ifndef EXIT_FAILURE diff --git a/m4/Makefile.am b/m4/Makefile.am index 216417b..0f58aef 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -1,19 +1,4 @@ ## Process this file with automake to produce Makefile.in -*-Makefile-*- -##m4-files-begin -EXTRA_DIST = README Makefile.am.in aclocal-include.m4 malloc.m4 openssl.m4 \ -perl.m4 realloc.m4 tuntap.m4 zlib.m4 +EXTRA_DIST = README *.m4 -##m4-files-end - -Makefile.am: Makefile.am.in - rm -f $@ $@t - sed -n '1,/^##m4-files-begin/p' $< > $@t - ( echo EXTRA_DIST = README Makefile.am.in; \ - find . -type f -name '*.m4' -print |sed 's,^\./,,' |sort ) \ - |fmt | (tr '\012' @; echo) \ - |sed 's/@$$/%/;s/@/ \\@/g' |tr @% '\012\012' \ - >> $@t - sed -n '/^##m4-files-end/,$$p' $< >> $@t - chmod a-w $@t - mv $@t $@ diff --git a/m4/Makefile.am.in b/m4/Makefile.am.in deleted file mode 100644 index 9ee9c43..0000000 --- a/m4/Makefile.am.in +++ /dev/null @@ -1,16 +0,0 @@ -## Process this file with automake to produce Makefile.in -*-Makefile-*- - -##m4-files-begin -##m4-files-end - -Makefile.am: Makefile.am.in - rm -f $@ $@t - sed -n '1,/^##m4-files-begin/p' $< > $@t - ( echo EXTRA_DIST = README Makefile.am.in; \ - find . -type f -name '*.m4' -print |sed 's,^\./,,' |sort ) \ - |fmt | (tr '\012' @; echo) \ - |sed 's/@$$/%/;s/@/ \\@/g' |tr @% '\012\012' \ - >> $@t - sed -n '/^##m4-files-end/,$$p' $< >> $@t - chmod a-w $@t - mv $@t $@ diff --git a/m4/Makefile.in b/m4/Makefile.in index 6c80fe3..864141c 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -1,7 +1,8 @@ -# Makefile.in generated automatically by automake 1.5 from Makefile.am. +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -12,130 +13,208 @@ # PARTICULAR PURPOSE. @SET_MAKE@ - -SHELL = @SHELL@ - srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) -transform = @program_transform_name@ +transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -host_alias = @host_alias@ host_triplet = @host@ -AMTAR = @AMTAR@ -AWK = @AWK@ -BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CPP = @CPP@ -DATADIRNAME = @DATADIRNAME@ -DEPDIR = @DEPDIR@ -EXEEXT = @EXEEXT@ -GENCAT = @GENCAT@ -GLIBC21 = @GLIBC21@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -HAVE_TUNTAP = @HAVE_TUNTAP@ -INCLUDES = @INCLUDES@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLBISON = @INTLBISON@ -INTLLIBS = @INTLLIBS@ -INTLOBJS = @INTLOBJS@ -INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ -LIBICONV = @LIBICONV@ -LINUX_IF_TUN_H = @LINUX_IF_TUN_H@ -LN_S = @LN_S@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PERL = @PERL@ -POFILES = @POFILES@ -POSUB = @POSUB@ -RANLIB = @RANLIB@ -USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ -USE_NLS = @USE_NLS@ -VERSION = @VERSION@ -am__include = @am__include@ -am__quote = @am__quote@ -install_sh = @install_sh@ - -EXTRA_DIST = README Makefile.am.in aclocal-include.m4 malloc.m4 openssl.m4 \ -perl.m4 realloc.m4 tuntap.m4 zlib.m4 - subdir = m4 +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \ + $(top_srcdir)/m4/attribute.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/lzo.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/openssl.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/tuntap.m4 \ + $(top_srcdir)/m4/zlib.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = +SOURCES = DIST_SOURCES = -DIST_COMMON = README Makefile.am Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GMSGFMT = @GMSGFMT@ +HAVE_TUNTAP = @HAVE_TUNTAP@ +INCLUDES = @INCLUDES@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LINUX_IF_TUN_H = @LINUX_IF_TUN_H@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +EXTRA_DIST = README *.m4 all: all-am .SUFFIXES: -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu m4/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu m4/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && \ - CONFIG_HEADERS= CONFIG_LINKS= \ - CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: tags: TAGS TAGS: +ctags: CTAGS +CTAGS: -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = .. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - $(mkinstalldirs) "$(distdir)/$$dir"; \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ fi; \ if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir) \ - || exit 1; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ @@ -145,9 +224,7 @@ distdir: $(DISTFILES) check-am: all-am check: check-am all-am: Makefile - installdirs: - install: install-am install-exec: install-exec-am install-data: install-data-am @@ -159,6 +236,7 @@ install-am: all-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: @@ -166,7 +244,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* + -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -176,13 +254,15 @@ clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am - + -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: +html: html-am + info: info-am info-am: @@ -198,35 +278,32 @@ install-man: installcheck-am: maintainer-clean: maintainer-clean-am - + -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + uninstall-am: uninstall-info-am .PHONY: all all-am check check-am clean clean-generic distclean \ - distclean-generic distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic uninstall uninstall-am uninstall-info-am + mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ + uninstall-info-am - -Makefile.am: Makefile.am.in - rm -f $@ $@t - sed -n '1,/^##m4-files-begin/p' $< > $@t - ( echo EXTRA_DIST = README Makefile.am.in; \ - find . -type f -name '*.m4' -print |sed 's,^\./,,' |sort ) \ - |fmt | (tr '\012' @; echo) \ - |sed 's/@$$/%/;s/@/ \\@/g' |tr @% '\012\012' \ - >> $@t - sed -n '/^##m4-files-end/,$$p' $< >> $@t - chmod a-w $@t - mv $@t $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/m4/attribute.m4 b/m4/attribute.m4 new file mode 100644 index 0000000..6a8f555 --- /dev/null +++ b/m4/attribute.m4 @@ -0,0 +1,25 @@ +dnl Check to find out whether function attributes are supported. +dnl If they are not, #define them to be nothing. + +AC_DEFUN([tinc_ATTRIBUTE], +[ + AC_CACHE_CHECK([for working $1 attribute], tinc_cv_attribute_$1, + [ + tempcflags="$CFLAGS" + CFLAGS="$CFLAGS -Wall -Werror" + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [void test(void) __attribute__ (($1)); + void test(void) { return; } + ], + )], + [tinc_cv_attribute_$1=yes], + [tinc_cv_attribute_$1=no] + ) + CFLAGS="$tempcflags" + ]) + + if test ${tinc_cv_attribute_$1} = no; then + AC_DEFINE([$1], [], [Defined if the $1 attribute is not supported.]) + fi +]) diff --git a/m4/codeset.m4 b/m4/codeset.m4 new file mode 100644 index 0000000..59535eb --- /dev/null +++ b/m4/codeset.m4 @@ -0,0 +1,23 @@ +# codeset.m4 serial AM1 (gettext-0.10.40) +dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +AC_DEFUN([AM_LANGINFO_CODESET], +[ + AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, + [AC_TRY_LINK([#include ], + [char* cs = nl_langinfo(CODESET);], + am_cv_langinfo_codeset=yes, + am_cv_langinfo_codeset=no) + ]) + if test $am_cv_langinfo_codeset = yes; then + AC_DEFINE(HAVE_LANGINFO_CODESET, 1, + [Define if you have and nl_langinfo(CODESET).]) + fi +]) diff --git a/m4/gettext.m4 b/m4/gettext.m4 new file mode 100644 index 0000000..16070b4 --- /dev/null +++ b/m4/gettext.m4 @@ -0,0 +1,415 @@ +# gettext.m4 serial 20 (gettext-0.12) +dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2003. + +dnl Macro to add for using GNU gettext. + +dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). +dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The +dnl default (if it is not specified or empty) is 'no-libtool'. +dnl INTLSYMBOL should be 'external' for packages with no intl directory, +dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. +dnl If INTLSYMBOL is 'use-libtool', then a libtool library +dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, +dnl depending on --{enable,disable}-{shared,static} and on the presence of +dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library +dnl $(top_builddir)/intl/libintl.a will be created. +dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext +dnl implementations (in libc or libintl) without the ngettext() function +dnl will be ignored. If NEEDSYMBOL is specified and is +dnl 'need-formatstring-macros', then GNU gettext implementations that don't +dnl support the ISO C 99 formatstring macros will be ignored. +dnl INTLDIR is used to find the intl libraries. If empty, +dnl the value `$(top_builddir)/intl/' is used. +dnl +dnl The result of the configuration is one of three cases: +dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled +dnl and used. +dnl Catalog format: GNU --> install in $(datadir) +dnl Catalog extension: .mo after installation, .gmo in source tree +dnl 2) GNU gettext has been found in the system's C library. +dnl Catalog format: GNU --> install in $(datadir) +dnl Catalog extension: .mo after installation, .gmo in source tree +dnl 3) No internationalization, always use English msgid. +dnl Catalog format: none +dnl Catalog extension: none +dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. +dnl The use of .gmo is historical (it was needed to avoid overwriting the +dnl GNU format catalogs when building on a platform with an X/Open gettext), +dnl but we keep it in order not to force irrelevant filename changes on the +dnl maintainers. +dnl +AC_DEFUN([AM_GNU_GETTEXT], +[ + dnl Argument checking. + ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , + [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT +])])])])]) + ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , + [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT +])])])]) + define(gt_included_intl, ifelse([$1], [external], [no], [yes])) + define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], [])) + + AC_REQUIRE([AM_PO_SUBDIRS])dnl + ifelse(gt_included_intl, yes, [ + AC_REQUIRE([AM_INTL_SUBDIR])dnl + ]) + + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Sometimes libintl requires libiconv, so first search for libiconv. + dnl Ideally we would do this search only after the + dnl if test "$USE_NLS" = "yes"; then + dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then + dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT + dnl the configure script would need to contain the same shell code + dnl again, outside any 'if'. There are two solutions: + dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. + dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. + dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not + dnl documented, we avoid it. + ifelse(gt_included_intl, yes, , [ + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + ]) + + dnl Set USE_NLS. + AM_NLS + + ifelse(gt_included_intl, yes, [ + BUILD_INCLUDED_LIBINTL=no + USE_INCLUDED_LIBINTL=no + ]) + LIBINTL= + LTLIBINTL= + POSUB= + + dnl If we use NLS figure out what method + if test "$USE_NLS" = "yes"; then + gt_use_preinstalled_gnugettext=no + ifelse(gt_included_intl, yes, [ + AC_MSG_CHECKING([whether included gettext is requested]) + AC_ARG_WITH(included-gettext, + [ --with-included-gettext use the GNU gettext library included here], + nls_cv_force_use_gnu_gettext=$withval, + nls_cv_force_use_gnu_gettext=no) + AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + ]) + dnl User does not insist on using GNU NLS library. Figure out what + dnl to use. If GNU gettext is available we use this. Else we have + dnl to fall back to GNU NLS library. + + dnl Add a version number to the cache macros. + define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1))) + define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc]) + define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl]) + + AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, + [AC_TRY_LINK([#include +]ifelse([$2], [need-formatstring-macros], +[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +changequote(,)dnl +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +changequote([,])dnl +], [])[extern int _nl_msg_cat_cntr; +extern int *_nl_domain_bindings;], + [bindtextdomain ("", ""); +return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], + gt_cv_func_gnugettext_libc=yes, + gt_cv_func_gnugettext_libc=no)]) + + if test "$gt_cv_func_gnugettext_libc" != "yes"; then + dnl Sometimes libintl requires libiconv, so first search for libiconv. + ifelse(gt_included_intl, yes, , [ + AM_ICONV_LINK + ]) + dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL + dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) + dnl because that would add "-liconv" to LIBINTL and LTLIBINTL + dnl even if libiconv doesn't exist. + AC_LIB_LINKFLAGS_BODY([intl]) + AC_CACHE_CHECK([for GNU gettext in libintl], + gt_cv_func_gnugettext_libintl, + [gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCINTL" + gt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBINTL" + dnl Now see whether libintl exists and does not depend on libiconv. + AC_TRY_LINK([#include +]ifelse([$2], [need-formatstring-macros], +[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +changequote(,)dnl +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +changequote([,])dnl +], [])[extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias ();], + [bindtextdomain ("", ""); +return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], + gt_cv_func_gnugettext_libintl=yes, + gt_cv_func_gnugettext_libintl=no) + dnl Now see whether libintl exists and depends on libiconv. + if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then + LIBS="$LIBS $LIBICONV" + AC_TRY_LINK([#include +]ifelse([$2], [need-formatstring-macros], +[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +changequote(,)dnl +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +changequote([,])dnl +], [])[extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias ();], + [bindtextdomain ("", ""); +return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], + [LIBINTL="$LIBINTL $LIBICONV" + LTLIBINTL="$LTLIBINTL $LTLIBICONV" + gt_cv_func_gnugettext_libintl=yes + ]) + fi + CPPFLAGS="$gt_save_CPPFLAGS" + LIBS="$gt_save_LIBS"]) + fi + + dnl If an already present or preinstalled GNU gettext() is found, + dnl use it. But if this macro is used in GNU gettext, and GNU + dnl gettext is already preinstalled in libintl, we update this + dnl libintl. (Cf. the install rule in intl/Makefile.in.) + if test "$gt_cv_func_gnugettext_libc" = "yes" \ + || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ + && test "$PACKAGE" != gettext-runtime \ + && test "$PACKAGE" != gettext-tools; }; then + gt_use_preinstalled_gnugettext=yes + else + dnl Reset the values set by searching for libintl. + LIBINTL= + LTLIBINTL= + INCINTL= + fi + + ifelse(gt_included_intl, yes, [ + if test "$gt_use_preinstalled_gnugettext" != "yes"; then + dnl GNU gettext is not found in the C library. + dnl Fall back on included GNU gettext library. + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions used to generate GNU NLS library. + BUILD_INCLUDED_LIBINTL=yes + USE_INCLUDED_LIBINTL=yes + LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" + LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV" + LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` + fi + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions to use GNU gettext tools. + CATOBJEXT=.gmo + fi + ]) + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + AC_DEFINE(ENABLE_NLS, 1, + [Define to 1 if translation of program messages to the user's native language + is requested.]) + else + USE_NLS=no + fi + fi + + AC_MSG_CHECKING([whether to use NLS]) + AC_MSG_RESULT([$USE_NLS]) + if test "$USE_NLS" = "yes"; then + AC_MSG_CHECKING([where the gettext function comes from]) + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if test "$gt_cv_func_gnugettext_libintl" = "yes"; then + gt_source="external libintl" + else + gt_source="libc" + fi + else + gt_source="included intl directory" + fi + AC_MSG_RESULT([$gt_source]) + fi + + if test "$USE_NLS" = "yes"; then + + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if test "$gt_cv_func_gnugettext_libintl" = "yes"; then + AC_MSG_CHECKING([how to link with libintl]) + AC_MSG_RESULT([$LIBINTL]) + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) + fi + + dnl For backward compatibility. Some packages may be using this. + AC_DEFINE(HAVE_GETTEXT, 1, + [Define if the GNU gettext() function is already present or preinstalled.]) + AC_DEFINE(HAVE_DCGETTEXT, 1, + [Define if the GNU dcgettext() function is already present or preinstalled.]) + fi + + dnl We need to process the po/ directory. + POSUB=po + fi + + ifelse(gt_included_intl, yes, [ + dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL + dnl to 'yes' because some of the testsuite requires it. + if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then + BUILD_INCLUDED_LIBINTL=yes + fi + + dnl Make all variables we use known to autoconf. + AC_SUBST(BUILD_INCLUDED_LIBINTL) + AC_SUBST(USE_INCLUDED_LIBINTL) + AC_SUBST(CATOBJEXT) + + dnl For backward compatibility. Some configure.ins may be using this. + nls_cv_header_intl= + nls_cv_header_libgt= + + dnl For backward compatibility. Some Makefiles may be using this. + DATADIRNAME=share + AC_SUBST(DATADIRNAME) + + dnl For backward compatibility. Some Makefiles may be using this. + INSTOBJEXT=.mo + AC_SUBST(INSTOBJEXT) + + dnl For backward compatibility. Some Makefiles may be using this. + GENCAT=gencat + AC_SUBST(GENCAT) + + dnl For backward compatibility. Some Makefiles may be using this. + if test "$USE_INCLUDED_LIBINTL" = yes; then + INTLOBJS="\$(GETTOBJS)" + fi + AC_SUBST(INTLOBJS) + + dnl Enable libtool support if the surrounding package wishes it. + INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix + AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) + ]) + + dnl For backward compatibility. Some Makefiles may be using this. + INTLLIBS="$LIBINTL" + AC_SUBST(INTLLIBS) + + dnl Make all documented variables known to autoconf. + AC_SUBST(LIBINTL) + AC_SUBST(LTLIBINTL) + AC_SUBST(POSUB) +]) + + +dnl Checks for all prerequisites of the intl subdirectory, +dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, +dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. +AC_DEFUN([AM_INTL_SUBDIR], +[ + AC_REQUIRE([AC_PROG_INSTALL])dnl + AC_REQUIRE([AM_MKINSTALLDIRS])dnl + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl + AC_REQUIRE([AC_PROG_RANLIB])dnl + AC_REQUIRE([AC_ISC_POSIX])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_REQUIRE([AC_C_CONST])dnl + AC_REQUIRE([AC_C_INLINE])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([jm_GLIBC21])dnl + AC_REQUIRE([gt_INTDIV0])dnl + AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl + AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl + AC_REQUIRE([gt_INTTYPES_PRI])dnl + + AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ +stdlib.h string.h unistd.h sys/param.h]) + AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ +geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ +strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next \ +__fsetlocking]) + + AM_ICONV + AM_LANGINFO_CODESET + if test $ac_cv_header_locale_h = yes; then + AM_LC_MESSAGES + fi + + dnl intl/plural.c is generated from intl/plural.y. It requires bison, + dnl because plural.y uses bison specific features. It requires at least + dnl bison-1.26 because earlier versions generate a plural.c that doesn't + dnl compile. + dnl bison is only needed for the maintainer (who touches plural.y). But in + dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put + dnl the rule in general Makefile. Now, some people carelessly touch the + dnl files or have a broken "make" program, hence the plural.c rule will + dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not + dnl present or too old. + AC_CHECK_PROGS([INTLBISON], [bison]) + if test -z "$INTLBISON"; then + ac_verc_fail=yes + else + dnl Found it, now check the version. + AC_MSG_CHECKING([version of bison]) +changequote(<<,>>)dnl + ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) +changequote([,])dnl + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; + esac + AC_MSG_RESULT([$ac_prog_version]) + fi + if test $ac_verc_fail = yes; then + INTLBISON=: + fi +]) + + +dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) +AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) diff --git a/m4/glibc21.m4 b/m4/glibc21.m4 new file mode 100644 index 0000000..9c9f3db --- /dev/null +++ b/m4/glibc21.m4 @@ -0,0 +1,32 @@ +# glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40) +dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +# Test for the GNU C Library, version 2.1 or newer. +# From Bruno Haible. + +AC_DEFUN([jm_GLIBC21], + [ + AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, + ac_cv_gnu_library_2_1, + [AC_EGREP_CPP([Lucky GNU user], + [ +#include +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) + Lucky GNU user + #endif +#endif + ], + ac_cv_gnu_library_2_1=yes, + ac_cv_gnu_library_2_1=no) + ] + ) + AC_SUBST(GLIBC21) + GLIBC21="$ac_cv_gnu_library_2_1" + ] +) diff --git a/m4/iconv.m4 b/m4/iconv.m4 new file mode 100644 index 0000000..c5f3579 --- /dev/null +++ b/m4/iconv.m4 @@ -0,0 +1,103 @@ +# iconv.m4 serial AM4 (gettext-0.11.3) +dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], +[ + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([iconv]) +]) + +AC_DEFUN([AM_ICONV_LINK], +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable GNU libiconv installed). + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + + dnl Add $INCICONV to CPPFLAGS before performing the following checks, + dnl because if the user has installed libiconv and not disabled its use + dnl via --without-libiconv-prefix, he wants to use it. The first + dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. + am_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) + + AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_func_iconv=yes) + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_lib_iconv=yes + am_cv_func_iconv=yes) + LIBS="$am_save_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) + fi + if test "$am_cv_lib_iconv" = yes; then + AC_MSG_CHECKING([how to link with libiconv]) + AC_MSG_RESULT([$LIBICONV]) + else + dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV + dnl either. + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + AC_SUBST(LIBICONV) + AC_SUBST(LTLIBICONV) +]) + +AC_DEFUN([AM_ICONV], +[ + AM_ICONV_LINK + if test "$am_cv_func_iconv" = yes; then + AC_MSG_CHECKING([for iconv declaration]) + AC_CACHE_VAL(am_cv_proto_iconv, [ + AC_TRY_COMPILE([ +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif +], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) + am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + AC_MSG_RESULT([$]{ac_t:- + }[$]am_cv_proto_iconv) + AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, + [Define as const if the declaration of iconv() needs const.]) + fi +]) diff --git a/m4/intdiv0.m4 b/m4/intdiv0.m4 new file mode 100644 index 0000000..55dddcf --- /dev/null +++ b/m4/intdiv0.m4 @@ -0,0 +1,72 @@ +# intdiv0.m4 serial 1 (gettext-0.11.3) +dnl Copyright (C) 2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +AC_DEFUN([gt_INTDIV0], +[ + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl + + AC_CACHE_CHECK([whether integer division by zero raises SIGFPE], + gt_cv_int_divbyzero_sigfpe, + [ + AC_TRY_RUN([ +#include +#include + +static void +#ifdef __cplusplus +sigfpe_handler (int sig) +#else +sigfpe_handler (sig) int sig; +#endif +{ + /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ + exit (sig != SIGFPE); +} + +int x = 1; +int y = 0; +int z; +int nan; + +int main () +{ + signal (SIGFPE, sigfpe_handler); +/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ +#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) + signal (SIGTRAP, sigfpe_handler); +#endif +/* Linux/SPARC yields signal SIGILL. */ +#if defined (__sparc__) && defined (__linux__) + signal (SIGILL, sigfpe_handler); +#endif + + z = x / y; + nan = y / y; + exit (1); +} +], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no, + [ + # Guess based on the CPU. + case "$host_cpu" in + alpha* | i[34567]86 | m68k | s390*) + gt_cv_int_divbyzero_sigfpe="guessing yes";; + *) + gt_cv_int_divbyzero_sigfpe="guessing no";; + esac + ]) + ]) + case "$gt_cv_int_divbyzero_sigfpe" in + *yes) value=1;; + *) value=0;; + esac + AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value, + [Define if integer division by zero raises signal SIGFPE.]) +]) diff --git a/m4/inttypes-pri.m4 b/m4/inttypes-pri.m4 new file mode 100644 index 0000000..fd007c3 --- /dev/null +++ b/m4/inttypes-pri.m4 @@ -0,0 +1,32 @@ +# inttypes-pri.m4 serial 1 (gettext-0.11.4) +dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +# Define PRI_MACROS_BROKEN if exists and defines the PRI* +# macros to non-string values. This is the case on AIX 4.3.3. + +AC_DEFUN([gt_INTTYPES_PRI], +[ + AC_REQUIRE([gt_HEADER_INTTYPES_H]) + if test $gt_cv_header_inttypes_h = yes; then + AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], + gt_cv_inttypes_pri_broken, + [ + AC_TRY_COMPILE([#include +#ifdef PRId32 +char *p = PRId32; +#endif +], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes) + ]) + fi + if test "$gt_cv_inttypes_pri_broken" = yes; then + AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1, + [Define if exists and defines unusable PRI* macros.]) + fi +]) diff --git a/m4/inttypes.m4 b/m4/inttypes.m4 new file mode 100644 index 0000000..ab370ff --- /dev/null +++ b/m4/inttypes.m4 @@ -0,0 +1,27 @@ +# inttypes.m4 serial 1 (gettext-0.11.4) +dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +# Define HAVE_INTTYPES_H if exists and doesn't clash with +# . + +AC_DEFUN([gt_HEADER_INTTYPES_H], +[ + AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h, + [ + AC_TRY_COMPILE( + [#include +#include ], + [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no) + ]) + if test $gt_cv_header_inttypes_h = yes; then + AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1, + [Define if exists and doesn't clash with .]) + fi +]) diff --git a/m4/inttypes_h.m4 b/m4/inttypes_h.m4 new file mode 100644 index 0000000..f342eba --- /dev/null +++ b/m4/inttypes_h.m4 @@ -0,0 +1,28 @@ +# inttypes_h.m4 serial 5 (gettext-0.12) +dnl Copyright (C) 1997-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +# Define HAVE_INTTYPES_H_WITH_UINTMAX if exists, +# doesn't clash with , and declares uintmax_t. + +AC_DEFUN([jm_AC_HEADER_INTTYPES_H], +[ + AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h, + [AC_TRY_COMPILE( + [#include +#include ], + [uintmax_t i = (uintmax_t) -1;], + jm_ac_cv_header_inttypes_h=yes, + jm_ac_cv_header_inttypes_h=no)]) + if test $jm_ac_cv_header_inttypes_h = yes; then + AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1, + [Define if exists, doesn't clash with , + and declares uintmax_t. ]) + fi +]) diff --git a/m4/isc-posix.m4 b/m4/isc-posix.m4 new file mode 100644 index 0000000..1319dd1 --- /dev/null +++ b/m4/isc-posix.m4 @@ -0,0 +1,26 @@ +# isc-posix.m4 serial 2 (gettext-0.11.2) +dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +# This file is not needed with autoconf-2.53 and newer. Remove it in 2005. + +# This test replaces the one in autoconf. +# Currently this macro should have the same name as the autoconf macro +# because gettext's gettext.m4 (distributed in the automake package) +# still uses it. Otherwise, the use in gettext.m4 makes autoheader +# give these diagnostics: +# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX +# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX + +undefine([AC_ISC_POSIX]) + +AC_DEFUN([AC_ISC_POSIX], + [ + dnl This test replaces the obsolescent AC_ISC_POSIX kludge. + AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) + ] +) diff --git a/m4/lcmessage.m4 b/m4/lcmessage.m4 new file mode 100644 index 0000000..ffd4008 --- /dev/null +++ b/m4/lcmessage.m4 @@ -0,0 +1,32 @@ +# lcmessage.m4 serial 3 (gettext-0.11.3) +dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995. + +# Check whether LC_MESSAGES is available in . + +AC_DEFUN([AM_LC_MESSAGES], +[ + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include ], [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 file defines LC_MESSAGES.]) + fi +]) diff --git a/m4/lib-ld.m4 b/m4/lib-ld.m4 new file mode 100644 index 0000000..11d0ce7 --- /dev/null +++ b/m4/lib-ld.m4 @@ -0,0 +1,110 @@ +# lib-ld.m4 serial 2 (gettext-0.12) +dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl Subroutines of libtool.m4, +dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision +dnl with libtool.m4. + +dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. +AC_DEFUN([AC_LIB_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + acl_cv_prog_gnu_ld=yes +else + acl_cv_prog_gnu_ld=no +fi]) +with_gnu_ld=$acl_cv_prog_gnu_ld +]) + +dnl From libtool-1.4. Sets the variable LD. +AC_DEFUN([AC_LIB_PROG_LD], +[AC_ARG_WITH(gnu-ld, +[ --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([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi +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 GCC]) + 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. + [[\\/]* | [A-Za-z]:[\\/]*)] + [re_direlt='/[^/][^/]*/\.\./'] + # Canonicalize the path 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(acl_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_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. + if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + acl_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$acl_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_LIB_PROG_LD_GNU +]) diff --git a/m4/lib-link.m4 b/m4/lib-link.m4 new file mode 100644 index 0000000..eeb200d --- /dev/null +++ b/m4/lib-link.m4 @@ -0,0 +1,551 @@ +# lib-link.m4 serial 4 (gettext-0.12) +dnl Copyright (C) 2001-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and +dnl augments the CPPFLAGS variable. +AC_DEFUN([AC_LIB_LINKFLAGS], +[ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + define([Name],[translit([$1],[./-], [___])]) + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + ac_cv_lib[]Name[]_libs="$LIB[]NAME" + ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" + ac_cv_lib[]Name[]_cppflags="$INC[]NAME" + ]) + LIB[]NAME="$ac_cv_lib[]Name[]_libs" + LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" + INC[]NAME="$ac_cv_lib[]Name[]_cppflags" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) + AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) + dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the + dnl results of this search when this library appears as a dependency. + HAVE_LIB[]NAME=yes + undefine([Name]) + undefine([NAME]) +]) + +dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) +dnl searches for libname and the libraries corresponding to explicit and +dnl implicit dependencies, together with the specified include files and +dnl the ability to compile and link the specified testcode. If found, it +dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and +dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and +dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs +dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. +AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], +[ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + define([Name],[translit([$1],[./-], [___])]) + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + + dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + + dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, + dnl because if the user has installed lib[]Name and not disabled its use + dnl via --without-lib[]Name-prefix, he wants to use it. + ac_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) + + AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ + ac_save_LIBS="$LIBS" + LIBS="$LIBS $LIB[]NAME" + AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) + LIBS="$ac_save_LIBS" + ]) + if test "$ac_cv_lib[]Name" = yes; then + HAVE_LIB[]NAME=yes + AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) + AC_MSG_CHECKING([how to link with lib[]$1]) + AC_MSG_RESULT([$LIB[]NAME]) + else + HAVE_LIB[]NAME=no + dnl If $LIB[]NAME didn't lead to a usable library, we don't need + dnl $INC[]NAME either. + CPPFLAGS="$ac_save_CPPFLAGS" + LIB[]NAME= + LTLIB[]NAME= + fi + AC_SUBST([HAVE_LIB]NAME) + AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) + undefine([Name]) + undefine([NAME]) +]) + +dnl Determine the platform dependent parameters needed to use rpath: +dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, +dnl hardcode_direct, hardcode_minus_L. +AC_DEFUN([AC_LIB_RPATH], +[ + AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS + AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld + AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host + AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir + AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + ]) + wl="$acl_cv_wl" + libext="$acl_cv_libext" + shlibext="$acl_cv_shlibext" + hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + hardcode_direct="$acl_cv_hardcode_direct" + hardcode_minus_L="$acl_cv_hardcode_minus_L" + dnl Determine whether the user wants rpath handling at all. + AC_ARG_ENABLE(rpath, + [ --disable-rpath do not hardcode runtime library paths], + :, enable_rpath=yes) +]) + +dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. +AC_DEFUN([AC_LIB_LINKFLAGS_BODY], +[ + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_LIB_ARG_WITH([lib$1-prefix], +[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib + --without-lib$1-prefix don't search for lib$1 in includedir and libdir], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi +]) + dnl Search the library and its dependencies in $additional_libdir and + dnl $LDFLAGS. Using breadth-first-seach. + LIB[]NAME= + LTLIB[]NAME= + INC[]NAME= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='$1 $2' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + dnl See if it was already located by an earlier AC_LIB_LINKFLAGS + dnl or AC_LIB_HAVE_LINKFLAGS call. + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" + else + dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined + dnl that this library doesn't exist. So just drop it. + : + fi + else + dnl Search the library lib$name in $additional_libdir and $LDFLAGS + dnl and the already constructed $LIBNAME/$LTLIBNAME. + found_dir= + found_la= + found_so= + found_a= + if test $use_additional = yes; then + if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + found_dir="$additional_libdir" + found_so="$additional_libdir/lib$name.$shlibext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + else + if test -f "$additional_libdir/lib$name.$libext"; then + found_dir="$additional_libdir" + found_a="$additional_libdir/lib$name.$libext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + found_dir="$dir" + found_so="$dir/lib$name.$shlibext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + else + if test -f "$dir/lib$name.$libext"; then + found_dir="$dir" + found_a="$dir/lib$name.$libext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + dnl Found the library. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + dnl Linking with a shared library. We attempt to hardcode its + dnl directory into the executable's runpath, unless it's the + dnl standard /usr/lib. + if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then + dnl No hardcoding is needed. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + dnl The hardcoding into $LIBNAME is system dependent. + if test "$hardcode_direct" = yes; then + dnl Using DIR/libNAME.so during linking hardcodes DIR into the + dnl resulting binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + dnl Rely on "-L$found_dir". + dnl But don't add it if it's already contained in the LDFLAGS + dnl or the already constructed $LIBNAME + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" + fi + if test "$hardcode_minus_L" != no; then + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH + dnl here, because this doesn't fit in flags passed to the + dnl compiler. So give up. No hardcoding. This affects only + dnl very old systems. + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + dnl Linking with a static library. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" + else + dnl We shouldn't come here, but anyway it's good to have a + dnl fallback. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" + fi + fi + dnl Assume the include files are nearby. + additional_includedir= + case "$found_dir" in + */lib | */lib/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + dnl Potentially add $additional_includedir to $INCNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's /usr/local/include and we are using GCC on Linux, + dnl 3. if it's already present in $CPPFLAGS or the already + dnl constructed $INCNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INC[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $INCNAME. + INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + dnl Look for dependencies. + if test -n "$found_la"; then + dnl Read the .la file. It defines the variables + dnl dlname, library_names, old_library, dependency_libs, current, + dnl age, revision, installed, dlopen, dlpreopen, libdir. + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + dnl We use only dependency_libs. + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's /usr/local/lib and we are using GCC on Linux, + dnl 3. if it's already present in $LDFLAGS or the already + dnl constructed $LIBNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LIBNAME. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LTLIBNAME. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + dnl Handle this in the next round. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + dnl Handle this in the next round. Throw away the .la's + dnl directory; it is already contained in a preceding -L + dnl option. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + dnl Most likely an immediate library name. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" + ;; + esac + done + fi + else + dnl Didn't find the library; assume it is in the system directories + dnl known to the linker and runtime loader. (All the system + dnl directories known to the linker should also be known to the + dnl runtime loader, otherwise the system is severely misconfigured.) + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$hardcode_libdir_separator"; then + dnl Weird platform: only the last -rpath option counts, the user must + dnl pass all path elements in one option. We can arrange that for a + dnl single library, but not when more than one $LIBNAMEs are used. + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" + done + dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + else + dnl The -rpath options are cumulative. + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + dnl When using libtool, the option that works for both libraries and + dnl executables is -R. The -R options are cumulative. + for found_dir in $ltrpathdirs; do + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" + done + fi +]) + +dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, +dnl unless already present in VAR. +dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes +dnl contains two or three consecutive elements that belong together. +AC_DEFUN([AC_LIB_APPENDTOVAR], +[ + for element in [$2]; do + haveit= + for x in $[$1]; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + [$1]="${[$1]}${[$1]:+ }$element" + fi + done +]) diff --git a/m4/lib-prefix.m4 b/m4/lib-prefix.m4 new file mode 100644 index 0000000..c719bc8 --- /dev/null +++ b/m4/lib-prefix.m4 @@ -0,0 +1,155 @@ +# lib-prefix.m4 serial 2 (gettext-0.12) +dnl Copyright (C) 2001-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and +dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't +dnl require excessive bracketing. +ifdef([AC_HELP_STRING], +[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], +[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) + +dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed +dnl to access previously installed libraries. The basic assumption is that +dnl a user will want packages to use other packages he previously installed +dnl with the same --prefix option. +dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate +dnl libraries, but is otherwise very convenient. +AC_DEFUN([AC_LIB_PREFIX], +[ + AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_LIB_ARG_WITH([lib-prefix], +[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib + --without-lib-prefix don't search for libraries in includedir and libdir], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi +]) + if test $use_additional = yes; then + dnl Potentially add $additional_includedir to $CPPFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's already present in $CPPFLAGS, + dnl 3. if it's /usr/local/include and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + for x in $CPPFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $CPPFLAGS. + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" + fi + fi + fi + fi + dnl Potentially add $additional_libdir to $LDFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's already present in $LDFLAGS, + dnl 3. if it's /usr/local/lib and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + for x in $LDFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LDFLAGS. + LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" + fi + fi + fi + fi + fi +]) + +dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, +dnl acl_final_exec_prefix, containing the values to which $prefix and +dnl $exec_prefix will expand at the end of the configure script. +AC_DEFUN([AC_LIB_PREPARE_PREFIX], +[ + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" +]) + +dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the +dnl variables prefix and exec_prefix bound to the values they will have +dnl at the end of the configure script. +AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], +[ + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + $1 + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" +]) diff --git a/m4/lzo.m4 b/m4/lzo.m4 new file mode 100644 index 0000000..8214d4c --- /dev/null +++ b/m4/lzo.m4 @@ -0,0 +1,33 @@ +dnl Check to find the lzo headers/libraries + +AC_DEFUN([tinc_LZO], +[ + AC_ARG_WITH(lzo, + AS_HELP_STRING([--with-lzo=DIR], [lzo base directory, or:]), + [lzo="$withval" + CPPFLAGS="$CPPFLAGS -I$withval/include" + LDFLAGS="$LDFLAGS -L$withval/lib"] + ) + + AC_ARG_WITH(lzo-include, + AS_HELP_STRING([--with-lzo-include=DIR], [lzo headers directory]), + [lzo_include="$withval" + CPPFLAGS="$CPPFLAGS -I$withval"] + ) + + AC_ARG_WITH(lzo-lib, + AS_HELP_STRING([--with-lzo-lib=DIR], [lzo library directory]), + [lzo_lib="$withval" + LDFLAGS="$LDFLAGS -L$withval"] + ) + + AC_CHECK_HEADERS(lzo1x.h, + [], + [AC_MSG_ERROR("lzo header files not found."); break] + ) + + AC_CHECK_LIB(lzo, lzo1x_1_compress, + [LIBS="$LIBS -llzo"], + [AC_MSG_ERROR("lzo libraries not found.")] + ) +]) diff --git a/m4/malloc.m4 b/m4/malloc.m4 index bd3cad4..f8ed112 100644 --- a/m4/malloc.m4 +++ b/m4/malloc.m4 @@ -10,7 +10,7 @@ dnl /* Define to rpl_malloc if the replacement function should be used. */ dnl #undef malloc dnl -AC_DEFUN(jm_FUNC_MALLOC, +AC_DEFUN([jm_FUNC_MALLOC], [ if test x = y; then dnl This code is deliberately never run via ./configure. @@ -20,25 +20,23 @@ AC_DEFUN(jm_FUNC_MALLOC, fi dnl xmalloc.c requires that this symbol be defined so it doesn't dnl mistakenly use a broken malloc -- as it might if this test were omitted. - ac_kludge=HAVE_DONE_WORKING_MALLOC_CHECK - AC_DEFINE_UNQUOTED($ac_kludge) + AC_DEFINE(HAVE_DONE_WORKING_MALLOC_CHECK, 1, [Needed for xmalloc.c]) AC_CACHE_CHECK([for working malloc], jm_cv_func_working_malloc, - [AC_TRY_RUN([ + [AC_RUN_IFELSE([AC_LANG_SOURCE([ char *malloc (); int main () { exit (malloc (0) ? 0 : 1); } - ], - jm_cv_func_working_malloc=yes, - jm_cv_func_working_malloc=no, - dnl When crosscompiling, assume malloc is broken. - jm_cv_func_working_malloc=no) + ])], + [jm_cv_func_working_malloc=yes], + [jm_cv_func_working_malloc=no], + [When crosscompiling]) ]) if test $jm_cv_func_working_malloc = no; then - LIBOBJS="$LIBOBJS malloc.o" - AC_DEFINE_UNQUOTED(malloc, rpl_malloc) + AC_LIBOBJ([malloc]) + AC_DEFINE(malloc, rpl_malloc, [Replacement malloc()]) fi ]) diff --git a/m4/nls.m4 b/m4/nls.m4 new file mode 100644 index 0000000..36bc493 --- /dev/null +++ b/m4/nls.m4 @@ -0,0 +1,49 @@ +# nls.m4 serial 1 (gettext-0.12) +dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2003. + +AC_DEFUN([AM_NLS], +[ + AC_MSG_CHECKING([whether NLS is requested]) + dnl Default is enabled NLS + AC_ARG_ENABLE(nls, + [ --disable-nls do not use Native Language Support], + USE_NLS=$enableval, USE_NLS=yes) + AC_MSG_RESULT($USE_NLS) + AC_SUBST(USE_NLS) +]) + +AC_DEFUN([AM_MKINSTALLDIRS], +[ + dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly + dnl find the mkinstalldirs script in another subdir but $(top_srcdir). + dnl Try to locate it. + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + case "$ac_aux_dir" in + /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;; + *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;; + esac + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + AC_SUBST(MKINSTALLDIRS) +]) diff --git a/m4/openssl.m4 b/m4/openssl.m4 index e5c0939..0bc9976 100644 --- a/m4/openssl.m4 +++ b/m4/openssl.m4 @@ -1,49 +1,60 @@ dnl Check to find the OpenSSL headers/libraries -AC_DEFUN(tinc_OPENSSL, +AC_DEFUN([tinc_OPENSSL], [ - tinc_ac_save_CPPFLAGS="$CPPFLAGS" + AC_ARG_WITH(openssl, + AS_HELP_STRING([--with-openssl=DIR], [OpenSSL base directory, or:]), + [openssl="$withval" + CPPFLAGS="$CPPFLAGS -I$withval/include" + LDFLAGS="$LDFLAGS -L$withval/lib"] + ) AC_ARG_WITH(openssl-include, - [ --with-openssl-include=DIR OpenSSL headers directory (without trailing /openssl)], + AS_HELP_STRING([--with-openssl-include=DIR], [OpenSSL headers directory (without trailing /openssl)]), [openssl_include="$withval" - CFLAGS="$CFLAGS -I$withval" CPPFLAGS="$CPPFLAGS -I$withval"] ) AC_ARG_WITH(openssl-lib, - [ --with-openssl-lib=DIR OpenSSL library directory], + AS_HELP_STRING([--with-openssl-lib=DIR], [OpenSSL library directory]), [openssl_lib="$withval" - LIBS="$LIBS -L$withval"] + LDFLAGS="$LDFLAGS -L$withval"] ) AC_CHECK_HEADERS(openssl/evp.h openssl/rsa.h openssl/rand.h openssl/err.h openssl/sha.h openssl/pem.h, [], - [AC_MSG_ERROR("OpenSSL header files not found."); break] + [AC_MSG_ERROR([OpenSSL header files not found.]); break] ) - CPPFLAGS="$tinc_ac_save_CPPFLAGS" - - AC_CHECK_LIB(crypto, SHA1_version, - [LIBS="$LIBS -lcrypto"], - [AC_MSG_ERROR("OpenSSL libraries not found.")] - ) - - AC_CHECK_FUNCS(RAND_pseudo_bytes) - - AC_CHECK_FUNC(OpenSSL_add_all_algorithms, - [], - AC_CHECK_FUNC(SSLeay_add_all_algorithms, - [AC_DEFINE(HAVE_SSLEAY_ADD_ALL_ALGORITHMS)], - [AC_MSG_ERROR("Missing required OpenSSL functionality!")] +case $host_os in + *mingw*) + AC_CHECK_LIB(crypto, SHA1_version, + [LIBS="$LIBS -lcrypto -lgdi32"], + [AC_MSG_ERROR([OpenSSL libraries not found.])] ) + ;; + *) + AC_CHECK_LIB(crypto, SHA1_version, + [LIBS="$LIBS -lcrypto"], + [AC_MSG_ERROR([OpenSSL libraries not found.])] + ) + + AC_CHECK_FUNC(dlopen, + [], + [AC_CHECK_LIB(dl, dlopen, + [LIBS="$LIBS -ldl"], + [AC_MSG_ERROR([OpenSSL depends on libdl.]); break] + )] + ) + ;; +esac + + AC_CHECK_FUNCS([RAND_pseudo_bytes EVP_EncryptInit_ex], , + [AC_MSG_ERROR([Missing OpenSSL functionality, make sure you have installed the latest version.]); break], ) - AC_CHECK_FUNC(dlopen, - [], - AC_CHECK_LIB(dl, dlopen, - [LIBS="$LIBS -ldl"], - [AC_MSG_ERROR("OpenSSL depends on libdl.")] - ) + AC_CHECK_DECL([OpenSSL_add_all_algorithms], , + [AC_MSG_ERROR([Missing OpenSSL functionality, make sure you have installed the latest version.]); break], + [#include ] ) ]) diff --git a/m4/perl.m4 b/m4/perl.m4 deleted file mode 100644 index 0cc681c..0000000 --- a/m4/perl.m4 +++ /dev/null @@ -1,39 +0,0 @@ -#serial 1 - -dnl From Jim Meyering. -dnl Find a new-enough version of Perl. -dnl - -AC_DEFUN(jm_PERL, -[ - dnl FIXME: don't hard-code 5.003 - dnl FIXME: should we cache the result? - AC_MSG_CHECKING([for perl5.003 or newer]) - if test "${PERL+set}" = set; then - # `PERL' is set in the user's environment. - candidate_perl_names="$PERL" - perl_specified=yes - else - candidate_perl_names='perl perl5' - perl_specified=no - fi - - found=no - AC_SUBST(PERL) - PERL="$missing_dir/missing perl" - for perl in $candidate_perl_names; do - # Run test in a subshell; some versions of sh will print an error if - # an executable is not found, even if stderr is redirected. - if ( $perl -e 'require 5.003' ) > /dev/null 2>&1; then - PERL=$perl - found=yes - break - fi - done - - AC_MSG_RESULT($found) - test $found = no && AC_MSG_WARN([ -*** You don't seem to have perl5.003 or newer installed. -*** Because of that, you may be unable to regenerate certain files -*** if you modify the sources from which they are derived.] ) -]) diff --git a/m4/po.m4 b/m4/po.m4 new file mode 100644 index 0000000..861e3de --- /dev/null +++ b/m4/po.m4 @@ -0,0 +1,197 @@ +# po.m4 serial 1 (gettext-0.12) +dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2003. + +dnl Checks for all prerequisites of the po subdirectory. +AC_DEFUN([AM_PO_SUBDIRS], +[ + AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_INSTALL])dnl + AC_REQUIRE([AM_MKINSTALLDIRS])dnl + AC_REQUIRE([AM_NLS])dnl + + dnl Perform the following tests also if --disable-nls has been given, + dnl because they are needed for "make dist" to work. + + dnl Search for GNU msgfmt in the PATH. + dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. + dnl The second test excludes FreeBSD msgfmt. + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + + dnl Search for GNU xgettext 0.12 or newer in the PATH. + dnl The first test excludes Solaris xgettext and early GNU xgettext versions. + dnl The second test excludes FreeBSD xgettext. + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + dnl Remove leftover from FreeBSD xgettext call. + rm -f messages.po + + dnl Search for GNU msgmerge 0.11 or newer in the PATH. + AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, + [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :) + + dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. + dnl Test whether we really found GNU msgfmt. + if test "$GMSGFMT" != ":"; then + dnl If it is no GNU msgfmt we define it as : so that the + dnl Makefiles still can work. + if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && + (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` + AC_MSG_RESULT( + [found $GMSGFMT program is not GNU msgfmt; ignore it]) + GMSGFMT=":" + fi + fi + + dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. + 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 --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && + (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + AC_MSG_RESULT( + [found xgettext program is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + dnl Remove leftover from FreeBSD xgettext call. + rm -f messages.po + fi + + AC_OUTPUT_COMMANDS([ + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + POMAKEFILEDEPS="POTFILES.in" + # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend + # on $ac_dir but don't depend on user-specified configuration + # parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$OBSOLETE_ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assigment from automake. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" + else + # The set of available languages was given in configure.in. + eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' + fi + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + POFILES= + GMOFILES= + UPDATEPOFILES= + DUMMYPOFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do + if test -f "$f"; then + case "$f" in + *.orig | *.bak | *~) ;; + *) cat "$f" >> "$ac_dir/Makefile" ;; + esac + fi + done + fi + ;; + esac + done], + [# Capture the value of obsolete ALL_LINGUAS because we need it to compute + # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it + # from automake. + eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" + ]) +]) diff --git a/m4/progtest.m4 b/m4/progtest.m4 new file mode 100644 index 0000000..8fe527c --- /dev/null +++ b/m4/progtest.m4 @@ -0,0 +1,91 @@ +# progtest.m4 serial 3 (gettext-0.12) +dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1996. + +# Search path for a program which passes the given test. + +dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN([AM_PATH_PROG_WITH_TEST], +[ +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# 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. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in ifelse([$5], , $PATH, [$5]); do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + 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 ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) diff --git a/m4/realloc.m4 b/m4/realloc.m4 index aba1984..4ff1d26 100644 --- a/m4/realloc.m4 +++ b/m4/realloc.m4 @@ -10,7 +10,7 @@ dnl /* Define to rpl_realloc if the replacement function should be used. */ dnl #undef realloc dnl -AC_DEFUN(jm_FUNC_REALLOC, +AC_DEFUN([jm_FUNC_REALLOC], [ if test x = y; then dnl This code is deliberately never run via ./configure. @@ -20,25 +20,23 @@ AC_DEFUN(jm_FUNC_REALLOC, fi dnl xmalloc.c requires that this symbol be defined so it doesn't dnl mistakenly use a broken realloc -- as it might if this test were omitted. - ac_kludge=HAVE_DONE_WORKING_REALLOC_CHECK - AC_DEFINE_UNQUOTED($ac_kludge) + AC_DEFINE(HAVE_DONE_WORKING_REALLOC_CHECK, 1, [Needed for xmalloc.c]) AC_CACHE_CHECK([for working realloc], jm_cv_func_working_realloc, - [AC_TRY_RUN([ + [AC_RUN_IFELSE([AC_LANG_SOURCE([ char *realloc (); int main () { exit (realloc (0, 0) ? 0 : 1); } - ], - jm_cv_func_working_realloc=yes, - jm_cv_func_working_realloc=no, - dnl When crosscompiling, assume realloc is broken. - jm_cv_func_working_realloc=no) + ])], + [jm_cv_func_working_realloc=yes], + [jm_cv_func_working_realloc=no], + [When crosscompiling]) ]) if test $jm_cv_func_working_realloc = no; then - LIBOBJS="$LIBOBJS realloc.o" - AC_DEFINE_UNQUOTED(realloc, rpl_realloc) + AC_LIBOBJ([realloc]) + AC_DEFINE(realloc, rpl_realloc, [Replacement realloc()]) fi ]) diff --git a/m4/stdint_h.m4 b/m4/stdint_h.m4 new file mode 100644 index 0000000..32ba7ae --- /dev/null +++ b/m4/stdint_h.m4 @@ -0,0 +1,28 @@ +# stdint_h.m4 serial 3 (gettext-0.12) +dnl Copyright (C) 1997-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +# Define HAVE_STDINT_H_WITH_UINTMAX if exists, +# doesn't clash with , and declares uintmax_t. + +AC_DEFUN([jm_AC_HEADER_STDINT_H], +[ + AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h, + [AC_TRY_COMPILE( + [#include +#include ], + [uintmax_t i = (uintmax_t) -1;], + jm_ac_cv_header_stdint_h=yes, + jm_ac_cv_header_stdint_h=no)]) + if test $jm_ac_cv_header_stdint_h = yes; then + AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1, + [Define if exists, doesn't clash with , + and declares uintmax_t. ]) + fi +]) diff --git a/m4/tuntap.m4 b/m4/tuntap.m4 index 0bee1ce..8c14a9b 100644 --- a/m4/tuntap.m4 +++ b/m4/tuntap.m4 @@ -1,39 +1,44 @@ dnl Check to find out whether the running kernel has support for TUN/TAP -AC_DEFUN(tinc_TUNTAP, +AC_DEFUN([tinc_TUNTAP], [ -AC_ARG_WITH(kernel, - [ --with-kernel=dir give the directory with kernel sources] - [ (default: /usr/src/linux)], - kerneldir="$withval", - kerneldir="/usr/src/linux" -) - -AC_CACHE_CHECK([for linux/if_tun.h], tinc_cv_linux_if_tun_h, -[ - AC_TRY_COMPILE([#include "$kerneldir/include/linux/if_tun.h"], - [int a = IFF_TAP;], - if_tun_h="\"$kerneldir/include/linux/if_tun.h\"", - [AC_TRY_COMPILE([#include ], - [int a = IFF_TAP;], - if_tun_h="default", - if_tun_h="no" - )] + AC_ARG_WITH(kernel, + AS_HELP_STRING([--with-kernel=DIR], [give the directory with kernel sources (default: /usr/src/linux)]), + kerneldir="$withval", + kerneldir="/usr/src/linux" ) - - if test $if_tun_h = no; then - tinc_cv_linux_if_tun_h=none - else - tinc_cv_linux_if_tun_h="$if_tun_h" + + AC_CACHE_CHECK([for linux/if_tun.h], tinc_cv_linux_if_tun_h, + [ + AC_COMPILE_IFELSE( + AC_LANG_PROGRAM([ + #include "$kerneldir/include/linux/if_tun.h" + int a = IFF_TAP; + ]), + [if_tun_h="\"$kerneldir/include/linux/if_tun.h\""], + [AC_COMPILE_IFELSE( + AC_LANG_PROGRAM([ + #include + int a = IFF_TAP; + ]), + [if_tun_h="default"], + [if_tun_h="no"] + )] + ) + + if test $if_tun_h = no; then + tinc_cv_linux_if_tun_h=none + else + tinc_cv_linux_if_tun_h="$if_tun_h" + fi + ]) + + if test $tinc_cv_linux_if_tun_h != none; then + AC_DEFINE(HAVE_TUNTAP, 1, [Universal tun/tap driver present]) + if test $tinc_cv_linux_if_tun_h != default; then + AC_DEFINE_UNQUOTED(LINUX_IF_TUN_H, $tinc_cv_linux_if_tun_h, [Location of if_tun.h]) + fi fi -]) - -if test $tinc_cv_linux_if_tun_h != none; then - AC_DEFINE(HAVE_TUNTAP) - if test $tinc_cv_linux_if_tun_h != default; then - AC_DEFINE_UNQUOTED(LINUX_IF_TUN_H, $tinc_cv_linux_if_tun_h) - fi -fi -AC_SUBST(LINUX_IF_TUN_H) -AC_SUBST(HAVE_TUNTAP) + AC_SUBST(LINUX_IF_TUN_H) + AC_SUBST(HAVE_TUNTAP) ]) diff --git a/m4/uintmax_t.m4 b/m4/uintmax_t.m4 new file mode 100644 index 0000000..b5f28d4 --- /dev/null +++ b/m4/uintmax_t.m4 @@ -0,0 +1,32 @@ +# uintmax_t.m4 serial 7 (gettext-0.12) +dnl Copyright (C) 1997-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +AC_PREREQ(2.13) + +# Define uintmax_t to 'unsigned long' or 'unsigned long long' +# if it is not already defined in or . + +AC_DEFUN([jm_AC_TYPE_UINTMAX_T], +[ + AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) + AC_REQUIRE([jm_AC_HEADER_STDINT_H]) + if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then + AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG]) + test $ac_cv_type_unsigned_long_long = yes \ + && ac_type='unsigned long long' \ + || ac_type='unsigned long' + AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, + [Define to unsigned long or unsigned long long + if and don't define.]) + else + AC_DEFINE(HAVE_UINTMAX_T, 1, + [Define if you have the 'uintmax_t' type in or .]) + fi +]) diff --git a/m4/ulonglong.m4 b/m4/ulonglong.m4 new file mode 100644 index 0000000..c375e47 --- /dev/null +++ b/m4/ulonglong.m4 @@ -0,0 +1,23 @@ +# ulonglong.m4 serial 2 (fileutils-4.0.32, gettext-0.10.40) +dnl Copyright (C) 1999-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG], +[ + AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long, + [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;], + [unsigned long long ullmax = (unsigned long long) -1; + return ull << i | ull >> i | ullmax / ull | ullmax % ull;], + ac_cv_type_unsigned_long_long=yes, + ac_cv_type_unsigned_long_long=no)]) + if test $ac_cv_type_unsigned_long_long = yes; then + AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1, + [Define if you have the unsigned long long type.]) + fi +]) diff --git a/m4/zlib.m4 b/m4/zlib.m4 index d5fbc67..71f39f7 100644 --- a/m4/zlib.m4 +++ b/m4/zlib.m4 @@ -1,20 +1,24 @@ dnl Check to find the zlib headers/libraries -AC_DEFUN(tinc_ZLIB, +AC_DEFUN([tinc_ZLIB], [ - tinc_ac_save_CPPFLAGS="$CPPFLAGS" + AC_ARG_WITH(zlib, + AS_HELP_STRING([--with-zlib=DIR], [zlib base directory, or:]), + [zlib="$withval" + CPPFLAGS="$CPPFLAGS -I$withval/include" + LDFLAGS="$LDFLAGS -L$withval/lib"] + ) AC_ARG_WITH(zlib-include, - [ --with-zlib-include=DIR zlib headers directory], + AS_HELP_STRING([--with-zlib-include=DIR], [zlib headers directory]), [zlib_include="$withval" - CFLAGS="$CFLAGS -I$withval" CPPFLAGS="$CPPFLAGS -I$withval"] ) AC_ARG_WITH(zlib-lib, - [ --with-zlib-lib=DIR zlib library directory], + AS_HELP_STRING([--with-zlib-lib=DIR], [zlib library directory]), [zlib_lib="$withval" - LIBS="$LIBS -L$withval"] + LDFLAGS="$LDFLAGS -L$withval"] ) AC_CHECK_HEADERS(zlib.h, @@ -22,8 +26,6 @@ AC_DEFUN(tinc_ZLIB, [AC_MSG_ERROR("zlib header files not found."); break] ) - CPPFLAGS="$tinc_ac_save_CPPFLAGS" - AC_CHECK_LIB(z, compress2, [LIBS="$LIBS -lz"], [AC_MSG_ERROR("zlib libraries not found.")] diff --git a/missing b/missing index 0a7fb5a..e7ef83a 100755 --- a/missing +++ b/missing @@ -1,6 +1,10 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc. + +scriptversion=2003-09-02.23 + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 +# Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify @@ -38,12 +42,23 @@ else configure_ac=configure.in fi +msg="missing on your system" + case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi ;; esac @@ -74,11 +89,13 @@ Supported PROGRAM values: lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Send bug reports to ." ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing 0.3 - GNU automake" + echo "missing $scriptversion (GNU Automake)" ;; -*) @@ -87,9 +104,14 @@ Supported PROGRAM values: exit 1 ;; - aclocal) + aclocal*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." @@ -97,8 +119,13 @@ WARNING: \`$1' is missing on your system. You should only need it if ;; autoconf) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." @@ -106,8 +133,13 @@ WARNING: \`$1' is missing on your system. You should only need it if ;; autoheader) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." @@ -124,9 +156,14 @@ WARNING: \`$1' is missing on your system. You should only need it if touch $touch_files ;; - automake) + automake*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." @@ -135,9 +172,37 @@ WARNING: \`$1' is missing on your system. You should only need it if while read f; do touch "$f"; done ;; + autom4te) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + bison|yacc) echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." @@ -167,7 +232,7 @@ WARNING: \`$1' is missing on your system. You should only need it if lex|flex) echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." @@ -189,8 +254,13 @@ WARNING: \`$1' is missing on your system. You should only need it if ;; help2man) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." @@ -215,7 +285,7 @@ WARNING: \`$1' is missing on your system. You should only need it if fi echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, @@ -240,23 +310,23 @@ WARNING: \`$1' is missing on your system. You should only need it if # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then - gnutar ${1+"$@"} && exit 0 + gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then - gtar ${1+"$@"} && exit 0 + gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" ${1+"$@"} && exit 0 + tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" ${1+"$@"} && exit 0 + tar "$firstarg" "$@" && exit 0 ;; esac fi @@ -270,10 +340,10 @@ WARNING: I can't seem to be able to run \`tar' with the given arguments. *) echo 1>&2 "\ -WARNING: \`$1' is needed, and you do not seem to have it handy on your - system. You might have modified some files without having the +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequirements for installing + it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 @@ -281,3 +351,10 @@ WARNING: \`$1' is needed, and you do not seem to have it handy on your esac exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/mkinstalldirs b/mkinstalldirs index 4f58503..6fbe5e1 100755 --- a/mkinstalldirs +++ b/mkinstalldirs @@ -1,40 +1,150 @@ #! /bin/sh # mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman -# Created: 1993-05-16 -# Public domain -# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $ +scriptversion=2004-02-15.20 + +# Original author: Noah Friedman +# Created: 1993-05-16 +# Public domain. +# +# This file is maintained in Automake, please report +# bugs to or send patches to +# . errstatus=0 +dirmode="" + +usage="\ +Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... + +Create each directory DIR (with mode MODE, if specified), including all +leading file name components. + +Report bugs to ." + +# process command line arguments +while test $# -gt 0 ; do + case $1 in + -h | --help | --h*) # -h for help + echo "$usage" + exit 0 + ;; + -m) # -m PERM arg + shift + test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } + dirmode=$1 + shift + ;; + --version) + echo "$0 $scriptversion" + exit 0 + ;; + --) # stop option processing + shift + break + ;; + -*) # unknown option + echo "$usage" 1>&2 + exit 1 + ;; + *) # first non-opt arg + break + ;; + esac +done for file do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift + if test -d "$file"; then + shift + else + break + fi +done - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac +case $# in + 0) exit 0 ;; +esac - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" +# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and +# mkdir -p a/c at the same time, both will detect that a is missing, +# one will create a, then the other will try to create a and die with +# a "File exists" error. This is a problem when calling mkinstalldirs +# from a parallel make. We use --version in the probe to restrict +# ourselves to GNU mkdir, which is thread-safe. +case $dirmode in + '') + if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + test -d ./-p && rmdir ./-p + test -d ./--version && rmdir ./--version + fi + ;; + *) + if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && + test ! -d ./--version; then + echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + else + # Clean up after NextStep and OpenStep mkdir. + for d in ./-m ./-p ./--version "./$dirmode"; + do + test -d $d && rmdir $d + done + fi + ;; +esac - mkdir "$pathcomp" || lasterr=$? +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift - if test ! -d "$pathcomp"; then - errstatus=$lasterr - fi - fi + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case $pathcomp in + -*) pathcomp=./$pathcomp ;; + esac - pathcomp="$pathcomp/" - done + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + lasterr="" + chmod "$dirmode" "$pathcomp" || lasterr=$? + + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi + fi + + pathcomp="$pathcomp/" + done done exit $errstatus -# mkinstalldirs ends here +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/po/ChangeLog b/po/ChangeLog deleted file mode 100644 index c31f13f..0000000 --- a/po/ChangeLog +++ /dev/null @@ -1,28 +0,0 @@ -2002-04-09 gettextize - - * Makefile.in.in: Upgrade to gettext-0.10.40. - -2002-04-09 gettextize - - * Makefile.in.in: Upgrade to gettext-0.10.40. - -2002-04-08 gettextize - - * Makefile.in.in: Upgrade to gettext-0.10.40. - -2002-04-08 gettextize - - * Makefile.in.in: Upgrade to gettext-0.10.40. - -2002-04-08 gettextize - - * Makefile.in.in: Upgrade to gettext-0.10.40. - -2002-04-08 gettextize - - * Makefile.in.in: Upgrade to gettext-0.10.40. - -2002-04-08 gettextize - - * Makefile.in.in: Upgrade to gettext-0.10.40. - diff --git a/po/Makefile.in.in b/po/Makefile.in.in index 28726a2..27b721a 100644 --- a/po/Makefile.in.in +++ b/po/Makefile.in.in @@ -1,18 +1,16 @@ -# Makefile for program source directory in GNU NLS utilities package. -# Copyright (C) 1995-1997, 2000, 2001 by Ulrich Drepper +# Makefile for PO directory in any package using GNU gettext. +# Copyright (C) 1995-1997, 2000-2003 by Ulrich Drepper # -# This file file be copied and used freely without restrictions. It can -# be used in projects which are not available under the GNU General Public License -# but which still want to provide support for the GNU gettext functionality. -# Please note that the actual code is *not* freely available. +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU General Public +# License but which still want to provide support for the GNU gettext +# functionality. +# Please note that the actual code of GNU gettext is covered by the GNU +# General Public License and is *not* in the public domain. PACKAGE = @PACKAGE@ VERSION = @VERSION@ -# These two variables depend on the location of this directory. -subdir = po -top_builddir = .. - SHELL = /bin/sh @SET_MAKE@ @@ -29,74 +27,124 @@ gettextsrcdir = $(datadir)/gettext/po INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ MKINSTALLDIRS = @MKINSTALLDIRS@ -mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac` +mkinstalldirs = $(SHELL) $(MKINSTALLDIRS) -CC = @CC@ GMSGFMT = @GMSGFMT@ MSGFMT = @MSGFMT@ XGETTEXT = @XGETTEXT@ MSGMERGE = msgmerge - -DEFS = @DEFS@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ - -INCLUDES = -I.. -I$(top_srcdir)/intl - -COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) +MSGMERGE_UPDATE = @MSGMERGE@ --update +MSGINIT = msginit +MSGCONV = msgconv +MSGFILTER = msgfilter POFILES = @POFILES@ GMOFILES = @GMOFILES@ -DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \ -$(POFILES) $(GMOFILES) +UPDATEPOFILES = @UPDATEPOFILES@ +DUMMYPOFILES = @DUMMYPOFILES@ +DISTFILES.common = Makefile.in.in remove-potcdate.sin \ +$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3) +DISTFILES = $(DISTFILES.common) Makevars POTFILES.in $(DOMAIN).pot stamp-po \ +$(POFILES) $(GMOFILES) \ +$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3) POTFILES = \ CATALOGS = @CATALOGS@ +# Makevars gets inserted here. (Don't remove this line!) + .SUFFIXES: -.SUFFIXES: .c .o .po .pox .gmo .mo - -.c.o: - $(COMPILE) $< - -.po.pox: - $(MAKE) $(PACKAGE).pot - $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox +.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-update .po.mo: - $(MSGFMT) -o $@ $< + @echo "$(MSGFMT) -c -o $@ $<"; \ + $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@ .po.gmo: - file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \ - && rm -f $$file && $(GMSGFMT) --statistics -o $$file $< + @lang=`echo $* | sed -e 's,.*/,,'`; \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \ + cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo + +.sin.sed: + sed -e '/^#/d' $< > t-$@ + mv t-$@ $@ all: all-@USE_NLS@ -all-yes: $(CATALOGS) +all-yes: stamp-po all-no: -# Note: Target 'all' must not depend on target '$(srcdir)/$(PACKAGE).pot', +# stamp-po is a timestamp denoting the last time at which the CATALOGS have +# been loosely updated. Its purpose is that when a developer or translator +# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS, +# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent +# invocations of "make" will do nothing. This timestamp would not be necessary +# if updating the $(CATALOGS) would always touch them; however, the rule for +# $(POFILES) has been designed to not touch files that don't need to be +# changed. +stamp-po: $(srcdir)/$(DOMAIN).pot + test -z "$(CATALOGS)" || $(MAKE) $(CATALOGS) + @echo "touch stamp-po" + @echo timestamp > stamp-poT + @mv stamp-poT stamp-po + +# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update', # otherwise packages like GCC can not be built if only parts of the source # have been downloaded. -$(srcdir)/$(PACKAGE).pot: $(POTFILES) $(srcdir)/POTFILES.in - $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \ - --add-comments --keyword=_ --keyword=N_ \ +# This target rebuilds $(DOMAIN).pot; it is an expensive operation. +# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed. +$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed + $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ + --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \ --files-from=$(srcdir)/POTFILES.in \ - && test ! -f $(PACKAGE).po \ - || ( rm -f $(srcdir)/$(PACKAGE).pot \ - && mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot ) + --copyright-holder='$(COPYRIGHT_HOLDER)' \ + --msgid-bugs-address='$(MSGID_BUGS_ADDRESS)' + test ! -f $(DOMAIN).po || { \ + if test -f $(srcdir)/$(DOMAIN).pot; then \ + sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \ + sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \ + if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \ + rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \ + else \ + rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \ + mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ + fi; \ + else \ + mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ + fi; \ + } + +# This rule has no dependencies: we don't need to update $(DOMAIN).pot at +# every "make" invocation, only create it when it is missing. +# Only "make $(DOMAIN).pot-update" or "make dist" will force an update. +$(srcdir)/$(DOMAIN).pot: + $(MAKE) $(DOMAIN).pot-update + +# This target rebuilds a PO file if $(DOMAIN).pot has changed. +# Note that a PO file is not touched if it doesn't need to be changed. +$(POFILES): $(srcdir)/$(DOMAIN).pot + @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \ + cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot install: install-exec install-data install-exec: install-data: install-data-@USE_NLS@ - if test "$(PACKAGE)" = "gettext"; then \ + if test "$(PACKAGE)" = "gettext-tools"; then \ $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ - $(INSTALL_DATA) $(srcdir)/Makefile.in.in \ - $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \ + for file in $(DISTFILES.common) Makevars.template; do \ + $(INSTALL_DATA) $(srcdir)/$$file \ + $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + for file in Makevars; do \ + rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ else \ : ; \ fi @@ -106,41 +154,118 @@ install-data-yes: all @catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ - lang=`echo $$cat | sed 's/\.gmo$$//'`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ dir=$(localedir)/$$lang/LC_MESSAGES; \ $(mkinstalldirs) $(DESTDIR)$$dir; \ - if test -r $$cat; then \ - $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \ - echo "installing $$cat as $(DESTDIR)$$dir/$(PACKAGE).mo"; \ - else \ - $(INSTALL_DATA) $(srcdir)/$$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \ - echo "installing $(srcdir)/$$cat as" \ - "$(DESTDIR)$$dir/$(PACKAGE).mo"; \ - fi; \ + if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \ + $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \ + echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \ + for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ + if test -n "$$lc"; then \ + if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ + link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ + mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ + for file in *; do \ + if test -f $$file; then \ + ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ + fi; \ + done); \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + else \ + if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ + :; \ + else \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + fi; \ + fi; \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ + ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ + cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \ + fi; \ + done; \ + done + +install-strip: install + +installdirs: installdirs-exec installdirs-data +installdirs-exec: +installdirs-data: installdirs-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ + else \ + : ; \ + fi +installdirs-data-no: +installdirs-data-yes: + $(mkinstalldirs) $(DESTDIR)$(datadir) + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + dir=$(localedir)/$$lang/LC_MESSAGES; \ + $(mkinstalldirs) $(DESTDIR)$$dir; \ + for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ + if test -n "$$lc"; then \ + if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ + link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ + mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ + for file in *; do \ + if test -f $$file; then \ + ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ + fi; \ + done); \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + else \ + if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ + :; \ + else \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + fi; \ + fi; \ + fi; \ + done; \ done # Define this as empty until I found a useful application. installcheck: -uninstall: - catalogs='$(CATALOGS)'; \ - for cat in $$catalogs; do \ - cat=`basename $$cat`; \ - lang=`echo $$cat | sed 's/\.gmo$$//'`; \ - rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \ - done - if test "$(PACKAGE)" = "gettext"; then \ - rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \ +uninstall: uninstall-exec uninstall-data +uninstall-exec: +uninstall-data: uninstall-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + for file in $(DISTFILES.common) Makevars.template; do \ + rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ else \ : ; \ fi +uninstall-data-no: +uninstall-data-yes: + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + done; \ + done check: all -dvi info tags TAGS ID: +info dvi ps pdf html tags TAGS ctags CTAGS ID: mostlyclean: - rm -f core core.* *.pox $(PACKAGE).po *.new.po + rm -f remove-potcdate.sed + rm -f stamp-poT + rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po rm -fr *.o clean: mostlyclean @@ -151,7 +276,7 @@ distclean: clean maintainer-clean: distclean @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." - rm -f $(GMOFILES) + rm -f stamp-po $(GMOFILES) distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) dist distdir: @@ -160,37 +285,69 @@ dist distdir: # This is a separate target because 'update-po' must be executed before. dist2: $(DISTFILES) dists="$(DISTFILES)"; \ + if test "$(PACKAGE)" = "gettext-tools"; then \ + dists="$$dists Makevars.template"; \ + fi; \ + if test -f $(srcdir)/ChangeLog; then \ + dists="$$dists ChangeLog"; \ + fi; \ + for i in 0 1 2 3 4 5 6 7 8 9; do \ + if test -f $(srcdir)/ChangeLog.$$i; then \ + dists="$$dists ChangeLog.$$i"; \ + fi; \ + done; \ + if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \ for file in $$dists; do \ - if test -f $$file; then dir=.; else dir=$(srcdir); fi; \ - cp -p $$dir/$$file $(distdir); \ + if test -f $$file; then \ + cp -p $$file $(distdir); \ + else \ + cp -p $(srcdir)/$$file $(distdir); \ + fi; \ done update-po: Makefile - $(MAKE) $(PACKAGE).pot - if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; fi; \ - cd $(srcdir); \ - catalogs='$(GMOFILES)'; \ - for cat in $$catalogs; do \ - cat=`basename $$cat`; \ - lang=`echo $$cat | sed 's/\.gmo$$//'`; \ - echo "$$lang:"; \ - if $(MSGMERGE) $$lang.po $(PACKAGE).pot -o $$lang.new.po; then \ - mv -f $$lang.new.po $$lang.po; \ - else \ - echo "msgmerge for $$cat failed!"; \ - rm -f $$lang.new.po; \ - fi; \ - done + $(MAKE) $(DOMAIN).pot-update + test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES) $(MAKE) update-gmo +# General rule for updating PO files. + +.nop.po-update: + @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \ + if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \ + tmpdir=`pwd`; \ + echo "$$lang:"; \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \ + cd $(srcdir); \ + if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \ + if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ + rm -f $$tmpdir/$$lang.new.po; \ + else \ + if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ + :; \ + else \ + echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ + exit 1; \ + fi; \ + fi; \ + else \ + echo "msgmerge for $$lang.po failed!" 1>&2; \ + rm -f $$tmpdir/$$lang.new.po; \ + fi + +$(DUMMYPOFILES): + update-gmo: Makefile $(GMOFILES) @: -Makefile: Makefile.in.in $(top_builddir)/config.status POTFILES.in +Makefile: Makefile.in.in $(top_builddir)/config.status @POMAKEFILEDEPS@ cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \ $(SHELL) ./config.status +force: + # Tell versions [3.59,3.63) of GNU make not to export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/po/Makevars b/po/Makevars new file mode 100644 index 0000000..485b60e --- /dev/null +++ b/po/Makevars @@ -0,0 +1,41 @@ +# Makefile variables for PO directory in any package using GNU gettext. + +# Usually the message domain is the same as the package name. +DOMAIN = $(PACKAGE) + +# These two variables depend on the location of this directory. +subdir = po +top_builddir = .. + +# These options get passed to xgettext. +XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ + +# This is the copyright holder that gets inserted into the header of the +# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding +# package. (Note that the msgstr strings, extracted from the package's +# sources, belong to the copyright holder of the package.) Translators are +# expected to transfer the copyright for their translations to this person +# or entity, or to disclaim their copyright. The empty string stands for +# the public domain; in this case the translators are expected to disclaim +# their copyright. +COPYRIGHT_HOLDER = Ivo Timmermans and Guus Sliepen + +# This is the email address or URL to which the translators shall report +# bugs in the untranslated strings: +# - Strings which are not entire sentences, see the maintainer guidelines +# in the GNU gettext documentation, section 'Preparing Strings'. +# - Strings which use unclear terms or require additional context to be +# understood. +# - Strings which make invalid assumptions about notation of date, time or +# money. +# - Pluralisation problems. +# - Incorrect English spelling. +# - Incorrect formatting. +# It can be your email address, or a mailing list address where translators +# can write to without being subscribed, or the URL of a web page through +# which the translators can contact you. +MSGID_BUGS_ADDRESS = tinc-devel@tinc-vpn.org + +# This is the list of locale categories, beyond LC_MESSAGES, for which the +# message catalogs shall be used. It is usually empty. +EXTRA_LOCALE_CATEGORIES = diff --git a/po/POTFILES.in b/po/POTFILES.in index 4e52a3a..e1df6e7 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -27,7 +27,9 @@ src/node.c src/edge.c src/graph.c src/linux/device.c -src/freebsd/device.c src/solaris/device.c -src/netbsd/device.c -src/openbsd/device.c +src/bsd/device.c +src/cygwin/device.c +src/mingw/device.c +src/raw_socket/device.c +src/uml_socket/device.c diff --git a/po/Rules-quot b/po/Rules-quot new file mode 100644 index 0000000..5f46d23 --- /dev/null +++ b/po/Rules-quot @@ -0,0 +1,42 @@ +# Special Makefile rules for English message catalogs with quotation marks. + +DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot + +.SUFFIXES: .insert-header .po-update-en + +en@quot.po-update: en@quot.po-update-en +en@boldquot.po-update: en@boldquot.po-update-en + +.insert-header.po-update-en: + @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \ + if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \ + tmpdir=`pwd`; \ + echo "$$lang:"; \ + ll=`echo $$lang | sed -e 's/@.*//'`; \ + LC_ALL=C; export LC_ALL; \ + cd $(srcdir); \ + if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$ll -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \ + if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ + rm -f $$tmpdir/$$lang.new.po; \ + else \ + if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ + :; \ + else \ + echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ + exit 1; \ + fi; \ + fi; \ + else \ + echo "creation of $$lang.po failed!" 1>&2; \ + rm -f $$tmpdir/$$lang.new.po; \ + fi + +en@quot.insert-header: insert-header.sin + sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header + +en@boldquot.insert-header: insert-header.sin + sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header + +mostlyclean: mostlyclean-quot +mostlyclean-quot: + rm -f *.insert-header diff --git a/po/boldquot.sed b/po/boldquot.sed new file mode 100644 index 0000000..4b937aa --- /dev/null +++ b/po/boldquot.sed @@ -0,0 +1,10 @@ +s/"\([^"]*\)"/“\1â€/g +s/`\([^`']*\)'/‘\1’/g +s/ '\([^`']*\)' / ‘\1’ /g +s/ '\([^`']*\)'$/ ‘\1’/g +s/^'\([^`']*\)' /‘\1’ /g +s/“â€/""/g +s/“/“/g +s/â€/â€/g +s/‘/‘/g +s/’/’/g diff --git a/po/en@boldquot.header b/po/en@boldquot.header new file mode 100644 index 0000000..fedb6a0 --- /dev/null +++ b/po/en@boldquot.header @@ -0,0 +1,25 @@ +# All this catalog "translates" are quotation characters. +# The msgids must be ASCII and therefore cannot contain real quotation +# characters, only substitutes like grave accent (0x60), apostrophe (0x27) +# and double quote (0x22). These substitutes look strange; see +# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html +# +# This catalog translates grave accent (0x60) and apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019). +# It also translates pairs of apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019) +# and pairs of quotation mark (0x22) to +# left double quotation mark (U+201C) and right double quotation mark (U+201D). +# +# When output to an UTF-8 terminal, the quotation characters appear perfectly. +# When output to an ISO-8859-1 terminal, the single quotation marks are +# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to +# grave/acute accent (by libiconv), and the double quotation marks are +# transliterated to 0x22. +# When output to an ASCII terminal, the single quotation marks are +# transliterated to apostrophes, and the double quotation marks are +# transliterated to 0x22. +# +# This catalog furthermore displays the text between the quotation marks in +# bold face, assuming the VT100/XTerm escape sequences. +# diff --git a/po/en@quot.header b/po/en@quot.header new file mode 100644 index 0000000..a9647fc --- /dev/null +++ b/po/en@quot.header @@ -0,0 +1,22 @@ +# All this catalog "translates" are quotation characters. +# The msgids must be ASCII and therefore cannot contain real quotation +# characters, only substitutes like grave accent (0x60), apostrophe (0x27) +# and double quote (0x22). These substitutes look strange; see +# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html +# +# This catalog translates grave accent (0x60) and apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019). +# It also translates pairs of apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019) +# and pairs of quotation mark (0x22) to +# left double quotation mark (U+201C) and right double quotation mark (U+201D). +# +# When output to an UTF-8 terminal, the quotation characters appear perfectly. +# When output to an ISO-8859-1 terminal, the single quotation marks are +# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to +# grave/acute accent (by libiconv), and the double quotation marks are +# transliterated to 0x22. +# When output to an ASCII terminal, the single quotation marks are +# transliterated to apostrophes, and the double quotation marks are +# transliterated to 0x22. +# diff --git a/po/insert-header.sin b/po/insert-header.sin new file mode 100644 index 0000000..b26de01 --- /dev/null +++ b/po/insert-header.sin @@ -0,0 +1,23 @@ +# Sed script that inserts the file called HEADER before the header entry. +# +# At each occurrence of a line starting with "msgid ", we execute the following +# commands. At the first occurrence, insert the file. At the following +# occurrences, do nothing. The distinction between the first and the following +# occurrences is achieved by looking at the hold space. +/^msgid /{ +x +# Test if the hold space is empty. +s/m/m/ +ta +# Yes it was empty. First occurrence. Read the file. +r HEADER +# Output the file's contents by reading the next line. But don't lose the +# current line while doing this. +g +N +bb +:a +# The hold space was nonempty. Following occurrences. Do nothing. +x +:b +} diff --git a/po/nl.gmo b/po/nl.gmo index cf84ba6..7070921 100644 Binary files a/po/nl.gmo and b/po/nl.gmo differ diff --git a/po/nl.po b/po/nl.po index 4288fee..d6e0fd8 100644 --- a/po/nl.po +++ b/po/nl.po @@ -1,47 +1,47 @@ # Dutch messages for tinc -# Copyright (C) 1999-2001 Ivo Timmermans, Guus Sliepen. -# Ivo Timmermans , 1999-2002. -# Guus Sliepen , 2000-2002. +# Copyright (C) 1999-2004 Ivo Timmermans, Guus Sliepen. +# Ivo Timmermans , 1999-2004. +# Guus Sliepen , 2000-2004. msgid "" msgstr "" -"Project-Id-Version: tinc 1.0-cvs\n" -"POT-Creation-Date: 2002-04-09 13:59+0200\n" -"PO-Revision-Date: 2002-03-27 16:59+0100\n" -"Last-Translator: Guus Sliepen \n" -"Language-Team: Dutch \n" +"Project-Id-Version: tinc 1.0-svn\n" +"Report-Msgid-Bugs-To: tinc-devel@tinc-vpn.org\n" +"POT-Creation-Date: 2004-11-11 13:40+0100\n" +"PO-Revision-Date: 2004-03-15 19:28+0100\n" +"Last-Translator: Guus Sliepen \n" +"Language-Team: Dutch \n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -#: src/conf.c:173 +#: lib/utils.c:93 +msgid "(unable to format errormessage)" +msgstr "(kon foutmelding niet samenstellen)" + +#: src/conf.c:159 #, c-format msgid "\"yes\" or \"no\" expected for configuration variable %s in %s line %d" msgstr "" "\"ja\" of \"nee\" verwacht voor configuratievariabele %s in %s regel %d" -#: src/conf.c:188 +#: src/conf.c:175 #, c-format msgid "Integer expected for configuration variable %s in %s line %d" msgstr "Geheel getal verwacht voor configuratievariabele %s in %s regel %d" -#: src/conf.c:218 +#: src/conf.c:209 #, c-format msgid "" "Hostname or IP address expected for configuration variable %s in %s line %d" msgstr "" "Hostnaam of IP adres verwacht voor configuratievariabele %s in %s regel %d" -#: src/conf.c:235 -#, c-format -msgid "Port number expected for configuration variable %s in %s line %d" -msgstr "Poortnummer verwacht voor configuratievariabele %s in %s regel %d" - -#: src/conf.c:251 +#: src/conf.c:225 #, c-format msgid "Subnet expected for configuration variable %s in %s line %d" msgstr "Subnet verwacht voor configuratievariabele %s in %s regel %d" -#: src/conf.c:261 +#: src/conf.c:236 #, c-format msgid "" "Network address and prefix length do not match for configuration variable %s " @@ -50,675 +50,721 @@ msgstr "" "Netwerk adres en prefix lengte komen niet overeen bij configuratievariabele %" "s in %s regel %d" -#: src/conf.c:369 +#: src/conf.c:336 #, c-format msgid "Cannot open config file %s: %s" msgstr "Kan configuratie bestand %s niet openen: %s" -#: src/conf.c:405 +#: src/conf.c:390 #, c-format msgid "No value for variable `%s' on line %d while reading config file %s" msgstr "" "Geen waarde voor variabele `%s' op regel %d tijdens het lezen van " "configuratie bestand %s" -#: src/conf.c:438 +#: src/conf.c:421 #, c-format msgid "Failed to read `%s': %s" msgstr "Lezen van `%s' mislukte: %s" -#: src/conf.c:465 -#, c-format -msgid "`%s' is not an absolute path" -msgstr "`%s' is geen absoluut pad" - -#: src/conf.c:481 src/conf.c:513 -#, c-format -msgid "Couldn't stat `%s': %s" -msgstr "Kon `%s' niet statten: %s" - -#: src/conf.c:487 src/conf.c:522 -#, c-format -msgid "`%s' is owned by UID %d instead of %d" -msgstr "`%s' is eigendom van UID %d in plaats van %d" - -#: src/conf.c:494 src/conf.c:529 -#, c-format -msgid "Warning: `%s' is a symlink" -msgstr "Waarschuwing: `%s' is een symbolische link" - -#: src/conf.c:499 src/conf.c:534 -#, c-format -msgid "Unable to read symbolic link `%s': %s" -msgstr "Kan symbolische link `%s' niet lezen: %s" - -#. Accessible by others -#: src/conf.c:545 -#, c-format -msgid "`%s' has unsecure permissions" -msgstr "`%s' heeft onveilige permissies" - -#. Ask for a file and/or directory name. -#: src/conf.c:570 +#: src/conf.c:443 #, c-format msgid "Please enter a file to save %s to [%s]: " msgstr "Geef een bestand om de %s naar de schrijven [%s]: " -#: src/conf.c:576 +#: src/conf.c:450 #, c-format msgid "Error while reading stdin: %s\n" msgstr "Fout tijdens lezen van standaardinvoer: %s\n" -#: src/conf.c:602 +#: src/conf.c:482 #, c-format msgid "Error opening file `%s': %s\n" msgstr "Fout bij het openen van het bestand `%s': %s\n" -#: src/conf.c:612 -#, c-format -msgid "" -"The file `%s' (or any of the leading directories) has unsafe permissions.\n" -"I will not create or overwrite this file.\n" -msgstr "" -"Het bestand `%s' (of een van de voorgaande mappen) heeft onvoldoende " -"bescherming.\n" -"Ik maak of overschrijf dit bestand niet.\n" +#: src/connection.c:49 +msgid "everyone" +msgstr "iedereen" -#: src/connection.c:114 +#: src/connection.c:50 +msgid "BROADCAST" +msgstr "BROADCAST" + +#: src/connection.c:120 msgid "Connections:" msgstr "Verbindingen:" -#: src/connection.c:119 +#: src/connection.c:124 #, c-format msgid " %s at %s options %lx socket %d status %04x" msgstr " %s op %s opties %lx socket %d status %04x" -#: src/connection.c:123 +#: src/connection.c:128 msgid "End of connections." msgstr "Einde van verbindingen." -#: src/meta.c:49 +#: src/meta.c:45 #, c-format msgid "Sending %d bytes of metadata to %s (%s)" msgstr "Verzenden van %d bytes metadata naar %s (%s)" -#: src/meta.c:63 +#: src/meta.c:51 +#, c-format +msgid "Error while encrypting metadata to %s (%s): %s" +msgstr "Fout tijdens versleutelen van metadata naar %s (%s): %s" + +#: src/meta.c:64 src/meta.c:117 +#, c-format +msgid "Connection closed by %s (%s)" +msgstr "Verbinding beëindigd door %s (%s)" + +#: src/meta.c:69 #, c-format msgid "Sending meta data to %s (%s) failed: %s" msgstr "Fout tijdens verzenden metadata naar %s (%s): %s" -#: src/meta.c:94 -#, c-format -msgid "This is a bug: %s:%d: %d:%s %s (%s)" -msgstr "Dit is een programmeerfout: %s:%d: %d:%s %s (%s)" - -#: src/meta.c:100 -#, c-format -msgid "Metadata socket error for %s (%s): %s" -msgstr "Fout op metadata socket voor %s (%s): %s" - -#: src/meta.c:121 -#, c-format -msgid "Connection closed by %s (%s)" -msgstr "Verbinding beëindigd door %s (%s)" - -#: src/meta.c:128 +#: src/meta.c:122 #, c-format msgid "Metadata socket read error for %s (%s): %s" msgstr "Fout op metadata socket voor %s (%s) tijdens lezen: %s" -#: src/meta.c:202 +#: src/meta.c:137 +#, c-format +msgid "Error while decrypting metadata from %s (%s): %s" +msgstr "Fout tijdens ontsleutelen van metadata van %s (%s): %s" + +#: src/meta.c:190 #, c-format msgid "Metadata read buffer overflow for %s (%s)" msgstr "Metadata leesbuffer overloop voor %s (%s)" -#: src/net.c:88 +#: src/net.c:60 msgid "Purging unreachable nodes" msgstr "Verwijderen onbereikbare nodes" -#: src/net.c:98 +#: src/net.c:69 #, c-format msgid "Purging node %s (%s)" msgstr "Verwijdering node %s (%s)" -#: src/net.c:188 +#: src/net.c:170 #, c-format msgid "Closing connection with %s (%s)" -msgstr "Beëindigen verbinding met %s (%s)" +msgstr "Beëindigen verbinding met %s (%s)" -#: src/net.c:253 +#: src/net.c:235 #, c-format msgid "%s (%s) didn't respond to PING" msgstr "%s (%s) antwoordde niet op ping" -#: src/net.c:266 +#: src/net.c:244 +#, c-format +msgid "Old connection_t for %s (%s) status %04x still lingering, deleting..." +msgstr "" +"Oude connection_t voor %s (%s) status %04x nog steeds aanwezig, wordt " +"verwijderd..." + +#: src/net.c:249 #, c-format msgid "Timeout from %s (%s) during authentication" msgstr "Timeout van %s (%s) tijdens authenticatie" -#: src/net.c:311 src/net_socket.c:253 +#: src/net.c:297 #, c-format msgid "Error while connecting to %s (%s): %s" msgstr "Fout tijdens schrijven naar %s (%s): %s" -#: src/net.c:363 +#: src/net.c:353 #, c-format msgid "Error while waiting for input: %s" msgstr "Fout tijdens wachten op invoer: %s" -#: src/net.c:397 +#: src/net.c:384 msgid "Regenerating symmetric key" msgstr "Hergenereren symmetrische sleutel" -#: src/net.c:414 +#: src/net.c:401 msgid "Flushing event queue" msgstr "Legen taakrij" -#: src/net.c:431 -msgid "Rereading configuration file and restarting in 5 seconds..." -msgstr "Herlezen configuratiebestand en herstarten na 5 seconden..." - -#: src/net.c:438 +#: src/net.c:425 msgid "Unable to reread configuration file, exitting." -msgstr "Kan configuratiebestand niet herlezen, beëindigen." +msgstr "Kan configuratiebestand niet herlezen, beëindigen." + +#: src/net_packet.c:75 +#, c-format +msgid "No response to MTU probes from %s (%s)" +msgstr "Geen antwoord van %s (%s) op MTU probes" + +#: src/net_packet.c:82 +#, c-format +msgid "Fixing MTU of %s (%s) to %d after %d probes" +msgstr "MTU van %s (%s) vastgezet op %d na %d probes" + +#: src/net_packet.c:94 +#, c-format +msgid "Sending MTU probe length %d to %s (%s)" +msgstr "Verzending MTU probe lengte %d naar %s (%s)" #: src/net_packet.c:107 #, c-format -msgid "Got unauthenticated packet from %s (%s)" -msgstr "Kreeg niet-geauthenticeerd pakket van %s (%s)" +msgid "Got MTU probe length %d from %s (%s)" +msgstr "Kreeg MTU probe met verkeerde lengte %d van %s (%s)" -#: src/net_packet.c:134 -#, c-format -msgid "Got late or replayed packet from %s (%s), seqno %d" -msgstr "Kreeg laat of gedupliceerd pakket van %s (%s), seqno %d" - -#: src/net_packet.c:151 -#, c-format -msgid "Error while uncompressing packet from %s (%s)" -msgstr "Fout tijdens decomprimeren pakket van %s (%s)" - -#: src/net_packet.c:178 +#: src/net_packet.c:164 #, c-format msgid "Received packet of %d bytes from %s (%s)" msgstr "Ontvangst pakket van %d bytes van %s (%s)" -#: src/net_packet.c:204 +#: src/net_packet.c:185 src/route.c:92 +#, c-format +msgid "Got too short packet from %s (%s)" +msgstr "Kreeg te kort pakket van %s (%s)" + +#: src/net_packet.c:198 +#, c-format +msgid "Got unauthenticated packet from %s (%s)" +msgstr "Kreeg niet-geauthenticeerd pakket van %s (%s)" + +#: src/net_packet.c:213 +#, c-format +msgid "Error decrypting packet from %s (%s): %s" +msgstr "Fout tijdens ontsleutelen pakket van %s (%s): %s" + +#: src/net_packet.c:229 +#, c-format +msgid "Lost %d packets from %s (%s)" +msgstr "%d pakketten van %s (%s) verloren" + +#: src/net_packet.c:235 +#, c-format +msgid "Got late or replayed packet from %s (%s), seqno %d, last received %d" +msgstr "" +"Kreeg laat of gedupliceerd pakket van %s (%s), seqno %d, laatste ontvangen %d" + +#: src/net_packet.c:259 +#, c-format +msgid "Error while uncompressing packet from %s (%s)" +msgstr "Fout tijdens decomprimeren pakket van %s (%s)" + +#: src/net_packet.c:307 #, c-format msgid "No valid key known yet for %s (%s), queueing packet" msgstr "" "Nog geen geldige sleutel bekend voor %s (%s), pakket wordt in wachtrij gezet" -#: src/net_packet.c:237 +#: src/net_packet.c:336 #, c-format msgid "Error while compressing packet to %s (%s)" msgstr "Fout tijdens comprimeren pakket naar %s (%s)" -#: src/net_packet.c:288 +#: src/net_packet.c:358 +#, c-format +msgid "Error while encrypting packet to %s (%s): %s" +msgstr "Fout tijdens versleutelen pakket naar %s (%s): %s" + +#: src/net_packet.c:390 #, c-format msgid "Setting outgoing packet priority to %d" msgstr "Instellen prioriteit uitgaand pakket op %d" -#. SO_PRIORITY doesn't seem to work -#: src/net_packet.c:290 src/net_setup.c:450 src/net_socket.c:98 -#: src/net_socket.c:144 src/net_socket.c:171 src/process.c:273 -#: src/process.c:310 +#: src/net_packet.c:392 src/net_setup.c:477 src/net_socket.c:73 +#: src/net_socket.c:124 src/net_socket.c:153 src/tincd.c:434 src/tincd.c:468 +#: src/process.c:198 src/process.c:231 src/process.c:428 src/bsd/device.c:93 +#: src/bsd/device.c:112 src/cygwin/device.c:140 src/cygwin/device.c:171 +#: src/mingw/device.c:66 src/mingw/device.c:75 src/mingw/device.c:80 +#: src/mingw/device.c:236 src/mingw/device.c:243 src/mingw/device.c:248 +#: src/mingw/device.c:255 src/mingw/device.c:264 src/mingw/device.c:271 +#: src/uml_socket/device.c:89 src/uml_socket/device.c:103 +#: src/uml_socket/device.c:130 src/uml_socket/device.c:194 #, c-format msgid "System call `%s' failed: %s" msgstr "Systeemaanroep `%s' mislukte: %s" -#: src/net_packet.c:296 +#: src/net_packet.c:403 #, c-format msgid "Error sending packet to %s (%s): %s" msgstr "Fout tijdens verzenden pakket naar %s (%s): %s" -#: src/net_packet.c:313 +#: src/net_packet.c:426 #, c-format msgid "Sending packet of %d bytes to %s (%s)" msgstr "Verzending pakket van %d bytes naar %s (%s)" -#: src/net_packet.c:320 -msgid "Packet is looping back to us!" -msgstr "Pakket komt terug naar ons!" - -#: src/net_packet.c:329 +#: src/net_packet.c:430 #, c-format msgid "Node %s (%s) is not reachable" msgstr "Node %s (%s) is niet bereikbaar" -#: src/net_packet.c:337 +#: src/net_packet.c:438 #, c-format msgid "Sending packet to %s via %s (%s)" msgstr "Verzending pakket naar %s via %s (%s)" -#: src/net_packet.c:357 +#: src/net_packet.c:457 #, c-format msgid "Broadcasting packet of %d bytes from %s (%s)" msgstr "Verspreiding pakket van %d bytes van %s (%s)" -#: src/net_packet.c:374 +#: src/net_packet.c:474 #, c-format msgid "Flushing queue for %s (%s)" msgstr "Legen van wachtrij voor %s (%s)" -#: src/net_packet.c:396 -#, c-format -msgid "This is a bug: %s:%d: %d:%s" -msgstr "Dit is een programmeerfout: %s:%d: %d:%s" - -#: src/net_packet.c:403 -#, c-format -msgid "Incoming data socket error: %s" -msgstr "Fout op socket voor inkomend verkeer: %s" - -#: src/net_packet.c:409 +#: src/net_packet.c:496 #, c-format msgid "Receiving packet failed: %s" msgstr "Ontvangst pakket mislukt: %s" -#: src/net_packet.c:420 +#: src/net_packet.c:506 #, c-format msgid "Received UDP packet from unknown source %s" msgstr "Ontvangst UDP pakket van onbekende oorsprong %s" -#: src/net_setup.c:102 +#: src/net_setup.c:77 src/net_setup.c:94 #, c-format msgid "Error reading RSA public key file `%s': %s" msgstr "Fout tijdens lezen RSA publieke sleutel bestand `%s': %s" -#: src/net_setup.c:112 +#: src/net_setup.c:109 #, c-format msgid "Reading RSA public key file `%s' failed: %s" msgstr "Lezen RSA publieke sleutel bestand `%s' mislukt: %s" -#: src/net_setup.c:140 +#: src/net_setup.c:145 #, c-format msgid "No public key for %s specified!" msgstr "Geen publieke sleutel bekend voor %s gespecificeerd!" -#: src/net_setup.c:166 +#: src/net_setup.c:160 +msgid "PrivateKey used but no PublicKey found!" +msgstr "PrivateKey gebruikt maar geen PublicKey gevonden!" + +#: src/net_setup.c:179 #, c-format msgid "Error reading RSA private key file `%s': %s" -msgstr "Fout tijdens lezen RSA privé sleutel bestand `%s': %s" +msgstr "Fout tijdens lezen RSA privé sleutel bestand `%s': %s" -#: src/net_setup.c:176 +#: src/net_setup.c:187 +#, c-format +msgid "Could not stat RSA private key file `%s': %s'" +msgstr "Kon gegevens RSA privé sleutel bestand `%s' niet opvragen: %s" + +#: src/net_setup.c:194 +#, c-format +msgid "Warning: insecure file permissions for RSA private key file `%s'!" +msgstr "" +"Waarschuwing: onveilige permissies voor RSA privé sleutel bestand `%s'!" + +#: src/net_setup.c:201 #, c-format msgid "Reading RSA private key file `%s' failed: %s" -msgstr "Fout tijdens lezen RSA privé sleutel bestand `%s': %s" +msgstr "Fout tijdens lezen RSA privé sleutel bestand `%s': %s" -#: src/net_setup.c:202 src/net_setup.c:203 +#: src/net_setup.c:231 src/net_setup.c:232 msgid "MYSELF" msgstr "MIJZELF" -#: src/net_setup.c:210 +#: src/net_setup.c:238 msgid "Name for tinc daemon required!" msgstr "Naam voor tinc daemon verplicht!" -#: src/net_setup.c:216 +#: src/net_setup.c:243 msgid "Invalid name for myself!" msgstr "Ongeldige naam voor mijzelf!" -#: src/net_setup.c:230 +#: src/net_setup.c:252 msgid "Cannot open host configuration file for myself!" msgstr "Kan host configuratie bestand voor mijzelf niet openen!" -#: src/net_setup.c:287 +#: src/net_setup.c:307 msgid "Invalid routing mode!" msgstr "Ongeldige routing modus!" -#: src/net_setup.c:298 +#: src/net_setup.c:318 msgid "PriorityInheritance not supported on this platform" msgstr "PriorityInheritance wordt niet ondersteund op dit platform" -#: src/net_setup.c:308 +#: src/net_setup.c:326 msgid "Bogus maximum timeout!" msgstr "Onzinnige maximum timeout!" -#: src/net_setup.c:325 +#: src/net_setup.c:340 msgid "Invalid address family!" msgstr "Ongeldige adresfamilie!" -#: src/net_setup.c:347 +#: src/net_setup.c:358 msgid "Unrecognized cipher type!" msgstr "Onbekend cipher type!" -#: src/net_setup.c:382 +#: src/net_setup.c:383 src/protocol_auth.c:189 +#, c-format +msgid "Error during initialisation of cipher for %s (%s): %s" +msgstr "Fout tijdens initialisatie van cipher voor %s (%s): %s" + +#: src/net_setup.c:400 msgid "Unrecognized digest type!" msgstr "Onbekend digest type!" -#: src/net_setup.c:398 +#: src/net_setup.c:413 msgid "MAC length exceeds size of digest!" msgstr "MAC lengte is groter dan dat van digest!" -#: src/net_setup.c:403 +#: src/net_setup.c:416 msgid "Bogus MAC length!" msgstr "Onzinnige MAC lengte!" -#: src/net_setup.c:419 +#: src/net_setup.c:430 msgid "Bogus compression level!" msgstr "Onzinnig compressieniveau!" -#: src/net_setup.c:465 +#: src/net_setup.c:499 #, c-format msgid "Listening on %s" msgstr "Luisterend op %s" -#: src/net_setup.c:476 +#: src/net_setup.c:510 msgid "Ready" msgstr "Gereed" -#: src/net_setup.c:479 +#: src/net_setup.c:512 msgid "Unable to create any listening socket!" msgstr "Kon geen enkele luistersocket aanmaken!" -#: src/net_socket.c:90 +#: src/net_socket.c:63 #, c-format msgid "Creating metasocket failed: %s" msgstr "Aanmaak van metasocket mislukt: %s" -#: src/net_socket.c:124 src/net_socket.c:186 +#: src/net_socket.c:104 src/net_socket.c:196 #, c-format msgid "Can't bind to interface %s: %s" msgstr "Kan niet aan interface %s binden: %s" -#: src/net_socket.c:128 -msgid "BindToDevice not supported on this platform" -msgstr "BindToDevice wordt niet ondersteund op dit platform" +#: src/net_socket.c:109 +msgid "BindToInterface not supported on this platform" +msgstr "BindToInterface wordt niet ondersteund op dit platform" -#: src/net_socket.c:136 +#: src/net_socket.c:116 #, c-format msgid "Can't bind to %s/tcp: %s" msgstr "Kan niet aan %s/tcp binden: %s" -#: src/net_socket.c:163 +#: src/net_socket.c:143 #, c-format msgid "Creating UDP socket failed: %s" msgstr "Aanmaak UDP socket mislukte: %s" -#: src/net_socket.c:196 +#: src/net_socket.c:207 #, c-format msgid "Can't bind to %s/udp: %s" msgstr "Kan niet aan %s/udp binden: %s" -#: src/net_socket.c:219 +#: src/net_socket.c:234 #, c-format msgid "Trying to re-establish outgoing connection in %d seconds" msgstr "Poging tot herstellen van uitgaande verbinding over %d seconden" -#: src/net_socket.c:228 src/net_socket.c:322 -#, c-format -msgid "Trying to connect to %s (%s)" -msgstr "Poging tot verbinden met %s (%s)" - -#: src/net_socket.c:234 src/net_socket.c:329 -#, c-format -msgid "Creating socket for %s failed: %s" -msgstr "Aanmaken socket voor %s mislukt: %s" - -#: src/net_socket.c:258 src/net_socket.c:268 +#: src/net_socket.c:242 #, c-format msgid "Connected to %s (%s)" msgstr "Verbonden met %s (%s)" -#: src/net_socket.c:287 -#, c-format -msgid "Could not set up a meta connection to %s" -msgstr "Kon geen metaverbinding aangaan met %s" - -#: src/net_socket.c:350 +#: src/net_socket.c:249 src/net_socket.c:333 src/net_socket.c:444 #, c-format msgid "fcntl for %s: %s" msgstr "fcntl voor %s: %s" -#: src/net_socket.c:368 +#: src/net_socket.c:269 +#, c-format +msgid "Could not set up a meta connection to %s" +msgstr "Kon geen metaverbinding aangaan met %s" + +#: src/net_socket.c:303 +#, c-format +msgid "Trying to connect to %s (%s)" +msgstr "Poging tot verbinden met %s (%s)" + +#: src/net_socket.c:309 +#, c-format +msgid "Creating socket for %s failed: %s" +msgstr "Aanmaken socket voor %s mislukt: %s" + +#: src/net_socket.c:349 #, c-format msgid "%s: %s" msgstr "%s: %s" -#: src/net_socket.c:389 +#: src/net_socket.c:370 #, c-format msgid "Already connected to %s" msgstr "Reeds verbonden met %s" -#: src/net_socket.c:408 +#: src/net_socket.c:389 #, c-format msgid "No address specified for %s" msgstr "Geen adres gespecificeerd voor %s" -#: src/net_socket.c:435 +#: src/net_socket.c:419 #, c-format msgid "Accepting a new connection failed: %s" msgstr "Aanname van nieuwe verbinding is mislukt: %s" -#: src/net_socket.c:453 +#: src/net_socket.c:437 #, c-format msgid "Connection from %s" msgstr "Verbinding van %s" -#: src/net_socket.c:475 +#: src/net_socket.c:471 #, c-format msgid "Invalid name for outgoing connection in %s line %d" msgstr "Ongeldige naam voor uitgaande verbinding in %s regel %d" -#: src/netutl.c:65 src/netutl.c:88 +#: src/netutl.c:50 #, c-format -msgid "Error looking up %s port %s: %s\n" -msgstr "Fout bij het opzoeken van %s poort %s: %s\n" +msgid "Error looking up %s port %s: %s" +msgstr "Fout bij het opzoeken van %s poort %s: %s" -#: src/netutl.c:109 +#: src/netutl.c:105 #, c-format msgid "Error while translating addresses: %s" msgstr "Fout tijdens vertalen adressen: %s" -#: src/netutl.c:134 -#, c-format -msgid "Error while looking up hostname: %s" -msgstr "Fout bij het opzoeken van hostnaam: %s" - -#: src/netutl.c:137 +#: src/netutl.c:131 src/netutl.c:142 #, c-format msgid "%s port %s" msgstr "%s poort %s" -#: src/netutl.c:166 +#: src/netutl.c:138 +#, c-format +msgid "Error while looking up hostname: %s" +msgstr "Fout bij het opzoeken van hostnaam: %s" + +#: src/netutl.c:187 #, c-format msgid "sockaddrcmp() was called with unknown address family %d, exitting!" msgstr "" -"sockaddrcmp() werd aangeroepen met onbekende adresfamilie %d, beëindigen!" +"sockaddrcmp() werd aangeroepen met onbekende adresfamilie %d, beëindigen!" -#: src/protocol.c:77 +#: src/protocol.c:87 #, c-format msgid "Output buffer overflow while sending request to %s (%s)" msgstr "Uitvoer buffer overvol tijdens zenden verzoek naar %s (%s)" -#: src/protocol.c:85 +#: src/protocol.c:95 #, c-format msgid "Sending %s to %s (%s): %s" msgstr "Verzending %s naar %s (%s): %s" -#: src/protocol.c:87 +#: src/protocol.c:98 #, c-format msgid "Sending %s to %s (%s)" msgstr "Verzending %s naar %s (%s)" -#: src/protocol.c:104 +#: src/protocol.c:120 +#, c-format +msgid "Forwarding %s from %s (%s): %s" +msgstr "Doorsturen %s van %s (%s): %s" + +#: src/protocol.c:124 +#, c-format +msgid "Forwarding %s from %s (%s)" +msgstr "Doorsturen %s van %s (%s)" + +#: src/protocol.c:142 #, c-format msgid "Unknown request from %s (%s): %s" msgstr "Onbekend verzoek van %s (%s): %s" -#: src/protocol.c:107 +#: src/protocol.c:145 #, c-format msgid "Unknown request from %s (%s)" msgstr "Onbekend verzoek van %s (%s)" -#: src/protocol.c:117 +#: src/protocol.c:152 #, c-format msgid "Got %s from %s (%s): %s" msgstr "Kreeg %s van %s (%s): %s" -#: src/protocol.c:120 +#: src/protocol.c:156 #, c-format msgid "Got %s from %s (%s)" msgstr "Kreeg %s van %s (%s)" -#: src/protocol.c:127 +#: src/protocol.c:162 #, c-format msgid "Unauthorized request from %s (%s)" msgstr "Niet toegestaan verzoek van %s (%s)" -#: src/protocol.c:134 +#: src/protocol.c:170 #, c-format msgid "Error while processing %s from %s (%s)" msgstr "Fout tijdens afhandelen %s van %s (%s)" -#: src/protocol.c:141 +#: src/protocol.c:175 #, c-format msgid "Bogus data received from %s (%s)" msgstr "Onzinnige data ontvangen van %s (%s)" -#: src/protocol.c:187 +#: src/protocol.c:221 msgid "Already seen request" msgstr "Verzoek reeds gezien" -#: src/protocol.c:218 +#: src/protocol.c:251 #, c-format -msgid "Aging past requests: deleted %d, left %d\n" -msgstr "Veroudering vorige verzoeken: %d gewist, %d overgebleven\n" +msgid "Aging past requests: deleted %d, left %d" +msgstr "Veroudering vorige verzoeken: %d gewist, %d overgebleven" -#: src/protocol_auth.c:69 src/protocol_auth.c:224 src/protocol_auth.c:357 -#: src/protocol_auth.c:417 src/protocol_auth.c:529 src/protocol_edge.c:90 -#: src/protocol_edge.c:219 src/protocol_key.c:80 src/protocol_key.c:128 -#: src/protocol_key.c:196 src/protocol_misc.c:61 src/protocol_misc.c:91 -#: src/protocol_misc.c:177 src/protocol_subnet.c:71 src/protocol_subnet.c:163 +#: src/protocol_auth.c:58 src/protocol_auth.c:209 src/protocol_auth.c:338 +#: src/protocol_auth.c:405 src/protocol_auth.c:531 src/protocol_edge.c:73 +#: src/protocol_edge.c:188 src/protocol_key.c:62 src/protocol_key.c:105 +#: src/protocol_key.c:172 src/protocol_misc.c:54 src/protocol_misc.c:83 +#: src/protocol_misc.c:171 src/protocol_subnet.c:58 src/protocol_subnet.c:167 #, c-format msgid "Got bad %s from %s (%s)" msgstr "Kreeg verkeerde %s van %s (%s)" -#: src/protocol_auth.c:77 src/protocol_edge.c:98 src/protocol_edge.c:104 -#: src/protocol_edge.c:228 src/protocol_edge.c:234 src/protocol_subnet.c:79 -#: src/protocol_subnet.c:87 src/protocol_subnet.c:171 -#: src/protocol_subnet.c:189 +#: src/protocol_auth.c:66 src/protocol_edge.c:81 src/protocol_edge.c:87 +#: src/protocol_edge.c:196 src/protocol_edge.c:202 src/protocol_subnet.c:66 +#: src/protocol_subnet.c:74 src/protocol_subnet.c:175 +#: src/protocol_subnet.c:196 #, c-format msgid "Got bad %s from %s (%s): %s" msgstr "Kreeg verkeerde %s van %s (%s): %s" -#: src/protocol_auth.c:87 +#: src/protocol_auth.c:75 #, c-format msgid "Peer %s is %s instead of %s" msgstr "Ander %s is %s in plaats van %s" -#: src/protocol_auth.c:98 +#: src/protocol_auth.c:85 #, c-format msgid "Peer %s (%s) uses incompatible version %d" msgstr "Ander %s (%s) gebruikt incompatibele versie %d" -#: src/protocol_auth.c:117 +#: src/protocol_auth.c:101 #, c-format msgid "Peer %s had unknown identity (%s)" msgstr "Ander %s heeft onbekende identiteit (%s)" -#: src/protocol_auth.c:175 +#: src/protocol_auth.c:153 #, c-format msgid "Generated random meta key (unencrypted): %s" msgstr "Willekeurige meta sleutel aangemaakt (niet versleuteld): %s" -#: src/protocol_auth.c:187 src/protocol_auth.c:254 +#: src/protocol_auth.c:165 src/protocol_auth.c:238 #, c-format msgid "Error during encryption of meta key for %s (%s)" msgstr "Fout tijdens versleutelen van meta key voor %s (%s)" -#: src/protocol_auth.c:234 src/protocol_auth.c:367 src/protocol_auth.c:425 -#: src/protocol_auth.c:443 +#: src/protocol_auth.c:219 src/protocol_auth.c:348 src/protocol_auth.c:413 +#: src/protocol_auth.c:435 #, c-format msgid "Possible intruder %s (%s): %s" msgstr "Mogelijke indringer %s (%s): %s" -#: src/protocol_auth.c:262 +#: src/protocol_auth.c:246 #, c-format msgid "Received random meta key (unencrypted): %s" msgstr "Ontving willekeurige meta key (niet versleuteld): %s" -#: src/protocol_auth.c:274 +#: src/protocol_auth.c:257 #, c-format msgid "%s (%s) uses unknown cipher!" msgstr "%s (%s) gebruikt onbekende cipher!" -#: src/protocol_auth.c:296 src/protocol_key.c:267 +#: src/protocol_auth.c:265 +#, c-format +msgid "Error during initialisation of cipher from %s (%s): %s" +msgstr "Fout tijdens initalisatie van cipher van %s (%s): %s" + +#: src/protocol_auth.c:281 src/protocol_key.c:242 #, c-format msgid "Node %s (%s) uses unknown digest!" msgstr "Node %s (%s) gebruikt onbekende digest!" -#: src/protocol_auth.c:302 +#: src/protocol_auth.c:286 #, c-format msgid "%s (%s) uses bogus MAC length!" msgstr "%s (%s) gebruikt onzinnige MAC lengte!" -#: src/protocol_auth.c:425 +#: src/protocol_auth.c:381 +#, c-format +msgid "Error during calculation of response for %s (%s): %s" +msgstr "Fout tijdens berekenen van antwoord voor %s (%s): %s" + +#: src/protocol_auth.c:414 msgid "wrong challenge reply length" msgstr "verkeerde lengte antwoord op uitdaging" -#: src/protocol_auth.c:443 +#: src/protocol_auth.c:427 +#, c-format +msgid "Error during calculation of response from %s (%s): %s" +msgstr "Fout tijdens narekenen van antwoord van %s (%s): %s" + +#: src/protocol_auth.c:436 msgid "wrong challenge reply" msgstr "verkeerd antwoord op uitdaging" -#: src/protocol_auth.c:448 +#: src/protocol_auth.c:441 #, c-format msgid "Expected challenge reply: %s" msgstr "Verwachtte antwoord op uitdaging: %s" -#: src/protocol_auth.c:549 +#: src/protocol_auth.c:547 #, c-format msgid "Established a second connection with %s (%s), closing old connection" msgstr "Tweede verbinding met %s (%s) gemaakt, oude verbinding wordt gesloten" -#: src/protocol_auth.c:583 +#: src/protocol_auth.c:570 #, c-format msgid "Connection with %s (%s) activated" msgstr "Verbinding met %s (%s) geactiveerd" -#: src/protocol_edge.c:98 src/protocol_edge.c:104 src/protocol_edge.c:228 -#: src/protocol_edge.c:234 src/protocol_subnet.c:79 src/protocol_subnet.c:171 +#: src/protocol_edge.c:82 src/protocol_edge.c:88 src/protocol_edge.c:197 +#: src/protocol_edge.c:203 src/protocol_subnet.c:67 src/protocol_subnet.c:176 msgid "invalid name" msgstr "ongeldige naam" -#: src/protocol_edge.c:150 +#: src/protocol_edge.c:127 #, c-format msgid "Got %s from %s (%s) for ourself which does not match existing entry" msgstr "" "Kreeg %s van %s (%s) voor onszelf welke niet overeenkomt met reeds bekende" -#: src/protocol_edge.c:157 +#: src/protocol_edge.c:132 #, c-format msgid "Got %s from %s (%s) which does not match existing entry" msgstr "Kreeg %s van %s (%s) welke niet overeenkomt met reeds bekende" -#: src/protocol_edge.c:167 +#: src/protocol_edge.c:140 #, c-format msgid "Got %s from %s (%s) for ourself which does not exist" msgstr "Kreeg %s van %s (%s) voor onszelf welke niet bestaat" -#: src/protocol_edge.c:248 src/protocol_edge.c:257 src/protocol_edge.c:268 +#: src/protocol_edge.c:215 src/protocol_edge.c:223 src/protocol_edge.c:236 #, c-format msgid "Got %s from %s (%s) which does not appear in the edge tree" msgstr "Kreeg %s van %s (%s) welke niet voorkomt in de edge tree" -#: src/protocol_edge.c:275 src/protocol_subnet.c:118 src/protocol_subnet.c:217 +#: src/protocol_edge.c:242 src/protocol_subnet.c:103 src/protocol_subnet.c:219 #, c-format msgid "Got %s from %s (%s) for ourself" msgstr "Kreeg %s van %s (%s) voor onszelf" -#: src/protocol_key.c:92 +#: src/protocol_key.c:73 #, c-format msgid "Got %s from %s (%s) origin %s which does not exist" msgstr "Kreeg %s van %s (%s) herkomst %s welke niet bestaat" -#: src/protocol_key.c:137 src/protocol_key.c:205 +#: src/protocol_key.c:113 src/protocol_key.c:180 #, c-format msgid "" "Got %s from %s (%s) origin %s which does not exist in our connection list" msgstr "" "Kreeg %s van %s (%s) herkomst %s welke niet voorkomt in de verbindingslijst" -#: src/protocol_key.c:146 src/protocol_key.c:214 +#: src/protocol_key.c:121 src/protocol_key.c:188 #, c-format msgid "" "Got %s from %s (%s) destination %s which does not exist in our connection " @@ -726,75 +772,85 @@ msgid "" msgstr "" "Kreeg %s van %s (%s) doel %s welke niet voorkomt in de verbindingslijst" -#: src/protocol_key.c:246 +#: src/protocol_key.c:222 #, c-format msgid "Node %s (%s) uses unknown cipher!" msgstr "Node %s (%s) gebruikt onbekende cipher!" -#: src/protocol_key.c:251 +#: src/protocol_key.c:228 #, c-format msgid "Node %s (%s) uses wrong keylength!" msgstr "Node %s (%s) gebruikt verkeerde lengte sleutel!" -#: src/protocol_key.c:272 +#: src/protocol_key.c:248 #, c-format msgid "Node %s (%s) uses bogus MAC length!" msgstr "Node %s (%s) gebruikt onzinnige MAC lengte!" -#: src/protocol_misc.c:68 +#: src/protocol_key.c:257 #, c-format -msgid "Status message from %s (%s): %s: %s" -msgstr "Statusmelding van %s (%s): %s: %s" +msgid "Node %s (%s) uses bogus compression level!" +msgstr "Node %s (%s) gebruikt onzinnig compressieniveau!" -#: src/protocol_misc.c:98 +#: src/protocol_key.c:265 #, c-format -msgid "Error message from %s (%s): %s: %s" -msgstr "Foutmelding van %s (%s): %s: %s" +msgid "Error during initialisation of key from %s (%s): %s" +msgstr "Fout tijdens initialisatie van sleutel van %s (%s): %s" -#: src/protocol_subnet.c:87 src/protocol_subnet.c:189 +#: src/protocol_misc.c:59 +#, c-format +msgid "Status message from %s (%s): %d: %s" +msgstr "Statusmelding van %s (%s): %d: %s" + +#: src/protocol_misc.c:88 +#, c-format +msgid "Error message from %s (%s): %d: %s" +msgstr "Foutmelding van %s (%s): %d: %s" + +#: src/protocol_subnet.c:75 src/protocol_subnet.c:197 msgid "invalid subnet string" msgstr "ongeldige subnet string" -#: src/protocol_subnet.c:180 +#: src/protocol_subnet.c:185 #, c-format msgid "Got %s from %s (%s) for %s which is not in our node tree" msgstr "Kreeg %s van %s (%s) voor %s welke niet voorkomt in de node boom" -#: src/protocol_subnet.c:207 +#: src/protocol_subnet.c:211 #, c-format msgid "Got %s from %s (%s) for %s which does not appear in his subnet tree" msgstr "Kreeg %s van %s (%s) voor %s welke niet voorkomt in zijn subnet boom" -#: src/subnet.c:99 +#: src/subnet.c:103 #, c-format msgid "subnet_compare() was called with unknown subnet type %d, exitting!" msgstr "" -"subnet_compare() werd aangeroepen met onbekend subnet type %d, beëindigen!" +"subnet_compare() werd aangeroepen met onbekend subnet type %d, beëindigen!" -#: src/subnet.c:274 +#: src/subnet.c:281 #, c-format -msgid "net2str() was called with unknown subnet type %d, exitting!" -msgstr "net2str() werd aangeroepen met onbekend subnet type %d, beëindigen!" +msgid "net2str() was called with unknown subnet type %d, exiting!" +msgstr "net2str() werd aangeroepen met onbekend subnet type %d, beëindigen!" -#: src/subnet.c:384 +#: src/subnet.c:396 msgid "Subnet list:" msgstr "Subnet lijst:" -#: src/subnet.c:389 +#: src/subnet.c:402 #, c-format msgid " %s owner %s" msgstr " %s eigenaar %s" -#: src/subnet.c:392 +#: src/subnet.c:405 msgid "End of subnet list." msgstr "Einde van subnet lijst." -#: src/tincd.c:100 +#: src/tincd.c:108 #, c-format msgid "Try `%s --help' for more information.\n" msgstr "Probeer `%s --help' voor meer informatie.\n" -#: src/tincd.c:103 +#: src/tincd.c:111 #, c-format msgid "" "Usage: %s [option]...\n" @@ -803,49 +859,53 @@ msgstr "" "Gebruik: %s [optie]...\n" "\n" -#: src/tincd.c:104 +#: src/tincd.c:112 +#, c-format msgid "" " -c, --config=DIR Read configuration options from DIR.\n" " -D, --no-detach Don't fork and detach.\n" " -d, --debug[=LEVEL] Increase debug level or set it to LEVEL.\n" " -k, --kill[=SIGNAL] Attempt to kill a running tincd and exit.\n" " -n, --net=NETNAME Connect to net NETNAME.\n" +" -K, --generate-keys[=BITS] Generate public/private RSA keypair.\n" +" -L, --mlock Lock tinc into main memory.\n" +" --logfile[=FILENAME] Write log entries to a logfile.\n" +" --pidfile=FILENAME Write PID to FILENAME.\n" +" --help Display this help and exit.\n" +" --version Output version information and exit.\n" +"\n" msgstr "" " -c, --config=MAP Lees configuratie uit MAP.\n" " -D, --no-detach Start geen nieuw proces.\n" " -d, --debug[=NIVEAU] Verhoog debugniveau of stel het in op NIVEAU.\n" " -k, --kill[=SIGNAAL] Poging tot zenden signaal naar lopende tincd en " -"beëindig.\n" +"beëindig.\n" " -n, --net=NETNAAM Verbind met net NETNAAM.\n" - -#: src/tincd.c:109 -msgid "" -" -K, --generate-keys[=BITS] Generate public/private RSA keypair.\n" -" --help Display this help and exit.\n" -" --version Output version information and exit.\n" -"\n" -msgstr "" -" -K, --generate-keys[=BITS] Genereer publiek/privé RSA sleutelpaar.\n" -" --help Geef deze hulp en beëindig.\n" -" --version Geef versie informatie en beëindig.\n" +" -K, --generate-keys[=BITS] Genereer publiek/privé RSA sleutelpaar.\n" +" -L, --mlock Houd tinc vast in het centrale geheugen.\n" +" --logfile[=BESTAND] Schrijf log naar BESTAND.\n" +" --pidfile=BESTAND Schrijf PID naar BESTAND.\n" +" --help Geef deze hulp en beëindig.\n" +" --version Geef versie informatie en beëindig.\n" "\n" -#: src/tincd.c:112 -msgid "Report bugs to tinc@nl.linux.org.\n" +#: src/tincd.c:123 +#, c-format +msgid "Report bugs to tinc@tinc-vpn.org.\n" msgstr "" -"Meld fouten in het programma aan tinc@nl.linux.org;\n" +"Meld fouten in het programma aan tinc@tinc-vpn.org;\n" "Meld fouten in de vertaling aan vertaling@nl.linux.org.\n" -#: src/tincd.c:166 +#: src/tincd.c:179 #, c-format msgid "" "Invalid argument `%s'; SIGNAL must be a number or one of HUP, TERM, KILL, " "USR1, USR2, WINCH, INT or ALRM.\n" msgstr "" -"Ongeldig argument `%s'; SIGNAAL moet een getal zijn of één van HUP, TERM, " +"Ongeldig argument `%s'; SIGNAAL moet een getal zijn of één van HUP, TERM, " "KILL, USR1, USR2, WINCH, INT of ALRM.\n" -#: src/tincd.c:184 +#: src/tincd.c:201 #, c-format msgid "" "Invalid argument `%s'; BITS must be a number equal to or greater than 512.\n" @@ -853,55 +913,59 @@ msgstr "" "Ongeldig argument `%s'; BITS moet een nummer zijn gelijk aan of groter dan " "512.\n" -#: src/tincd.c:245 +#: src/tincd.c:294 #, c-format msgid "Generating %d bits keys:\n" msgstr "Bezig met genereren van een %d bits sleutel:\n" -#: src/tincd.c:250 +#: src/tincd.c:298 +#, c-format msgid "Error during key generation!\n" msgstr "Fout tijdens genereren sleutel!\n" -#: src/tincd.c:254 +#: src/tincd.c:301 +#, c-format msgid "Done.\n" msgstr "Klaar.\n" -#: src/tincd.c:263 -msgid "public RSA key" -msgstr "openbare RSA sleutel" +#: src/tincd.c:304 +msgid "private RSA key" +msgstr "geheime RSA sleutel" -#: src/tincd.c:267 src/tincd.c:278 +#: src/tincd.c:315 src/tincd.c:334 +#, c-format msgid "" "Appending key to existing contents.\n" "Make sure only one key is stored in the file.\n" msgstr "" "Sleutel wordt toegevoegd aan bestaande inhoud.\n" -"Let er op dat er slechts één sleutel in het bestand is.\n" +"Let er op dat er slechts één sleutel in het bestand is.\n" -#: src/tincd.c:274 -msgid "private RSA key" -msgstr "geheime RSA sleutel" +#: src/tincd.c:328 +msgid "public RSA key" +msgstr "openbare RSA sleutel" -#: src/tincd.c:299 +#: src/tincd.c:387 msgid "Both netname and configuration directory given, using the latter..." msgstr "" "Zowel netnaam als configuratiemap zijn gegeven, laatste wordt gebruikt..." -#: src/tincd.c:328 +#: src/tincd.c:408 #, c-format msgid "%s version %s (built %s %s, protocol %d)\n" msgstr "%s versie %s (gemaakt %s %s, protocol %d)\n" -#: src/tincd.c:329 +#: src/tincd.c:410 +#, c-format msgid "" -"Copyright (C) 1998-2002 Ivo Timmermans, Guus Sliepen and others.\n" +"Copyright (C) 1998-2004 Ivo Timmermans, Guus Sliepen and others.\n" "See the AUTHORS file for a complete list.\n" "\n" "tinc comes with ABSOLUTELY NO WARRANTY. This is free software,\n" "and you are welcome to redistribute it under certain conditions;\n" "see the file COPYING for details.\n" msgstr "" -"Copyright (C) 1998-2002 Ivo Timmermans, Guus Sliepen en anderen.\n" +"Copyright (C) 1998-2004 Ivo Timmermans, Guus Sliepen en anderen.\n" "Zie het bestand AUTHORS voor een volledige lijst.\n" "\n" "tinc wordt gedistribueerd ZONDER ENIGE GARANTIE. Dit is vrije " @@ -909,127 +973,188 @@ msgstr "" "en je bent welkom om het te distribueren onder bepaalde voorwaarden;\n" "zie het bestand COPYING voor details.\n" -#: src/tincd.c:386 -msgid "Unrecoverable error" -msgstr "Onherstelbare fout" +#: src/tincd.c:438 +msgid "mlockall() not supported on this platform!" +msgstr "mlockall() wordt niet ondersteund op dit platform!" -#: src/tincd.c:391 -#, c-format -msgid "Restarting in %d seconds!" -msgstr "Herstart in %d seconden!" +#: src/tincd.c:462 +msgid "Error initializing LZO compressor!" +msgstr "Fout tijdens initialiseren LZO compressor!" -#: src/process.c:373 src/tincd.c:396 -msgid "Not restarting." -msgstr "Geen herstart." +#: src/tincd.c:503 +msgid "Terminating" +msgstr "Beëindigen" -#: src/process.c:69 +#: src/process.c:54 #, c-format msgid "Memory exhausted (couldn't allocate %d bytes), exitting." -msgstr "Geheugen uitgeput (kon geen %d bytes reserveren), beëindigen." +msgstr "Geheugen uitgeput (kon geen %d bytes reserveren), beëindigen." -#: src/process.c:100 -msgid "Terminating" -msgstr "Beëindigen" +#: src/process.c:79 src/process.c:129 +#, c-format +msgid "Could not open service manager: %s" +msgstr "Kon service manager niet openen: %s" + +#: src/process.c:110 +#, c-format +msgid "Could not create %s service: %s" +msgstr "Kon %s service niet aanmaken: %s" #: src/process.c:116 #, c-format -msgid "A tincd is already running for net `%s' with pid %d.\n" -msgstr "Een tincd draait al voor net `%s' met pid %d.\n" +msgid "%s service installed" +msgstr "%s service geïnstalleerd" #: src/process.c:119 #, c-format -msgid "A tincd is already running with pid %d.\n" -msgstr "Een tincd draait al met pid %d.\n" +msgid "Could not start %s service: %s" +msgstr "Kon %s service niet starten: %s" -#: src/process.c:140 +#: src/process.c:121 +#, c-format +msgid "%s service started" +msgstr "%s service gestart" + +#: src/process.c:136 +#, c-format +msgid "Could not open %s service: %s" +msgstr "Kon %s service niet openen: %s" + +#: src/process.c:141 +#, c-format +msgid "Could not stop %s service: %s" +msgstr "Kon %s service niet stoppen: %s" + +#: src/process.c:143 +#, c-format +msgid "%s service stopped" +msgstr "%s service gestopt" + +#: src/process.c:146 +#, c-format +msgid "Could not remove %s service: %s" +msgstr "Kon %s service niet verwijderen: %s" + +#: src/process.c:150 +#, c-format +msgid "%s service removed" +msgstr "%s service verwijderd" + +#: src/process.c:158 src/process.c:161 +#, c-format +msgid "Got %s request" +msgstr "Kreeg %s verzoek" + +#: src/process.c:164 +#, c-format +msgid "Got unexpected request %d" +msgstr "Kreeg onverwacht verzoek %d" + +#: src/process.c:252 +#, c-format +msgid "A tincd is already running for net `%s' with pid %ld.\n" +msgstr "Een tincd draait al voor net `%s' met pid %ld.\n" + +#: src/process.c:255 +#, c-format +msgid "A tincd is already running with pid %ld.\n" +msgstr "Een tincd draait al met pid %ld.\n" + +#: src/process.c:261 +#, c-format +msgid "Could write pid file %s: %s\n" +msgstr "Kon pid bestand %s niet openen: %s\n" + +#: src/process.c:283 #, c-format msgid "No other tincd is running for net `%s'.\n" msgstr "Geen andere tincd draait voor net `%s'.\n" -#: src/process.c:142 +#: src/process.c:286 +#, c-format msgid "No other tincd is running.\n" msgstr "Geen andere tincd draait.\n" -#: src/process.c:151 +#: src/process.c:295 #, c-format msgid "The tincd for net `%s' is no longer running. " msgstr "De tincd voor net `%s' draait niet meer. " -#: src/process.c:153 +#: src/process.c:298 +#, c-format msgid "The tincd is no longer running. " msgstr "De tincd draait niet meer. " -#: src/process.c:155 +#: src/process.c:300 +#, c-format msgid "Removing stale lock file.\n" msgstr "Verwijdering oud vergrendelingsbestand.\n" -#: src/process.c:183 +#: src/process.c:333 #, c-format msgid "Couldn't detach from terminal: %s" msgstr "Kon niet ontkoppelen van terminal: %s" -#: src/process.c:196 +#: src/process.c:341 +#, c-format +msgid "Could not write pid file %s: %s\n" +msgstr "Kon pid bestand %s niet schrijven: %s\n" + +#: src/process.c:352 #, c-format msgid "tincd %s (%s %s) starting, debug level %d" msgstr "tincd %s (%s %s) start, debug niveau %d" -#: src/process.c:199 -#, c-format -msgid "tincd %s starting" -msgstr "tincd %s wordt gestart" - -#: src/process.c:280 +#: src/process.c:385 #, c-format msgid "Executing script %s" msgstr "Uitvoeren script %s" -#: src/process.c:290 +#: src/process.c:415 #, c-format -msgid "Process %d (%s) exited with non-zero status %d" -msgstr "Proces %d (%s) beëindigde met status %d" +msgid "Script %s exited with non-zero status %d" +msgstr "Script %s beëindigde met status %d" -#: src/process.c:298 +#: src/process.c:420 #, c-format -msgid "Process %d (%s) was killed by signal %d (%s)" -msgstr "Proces %d (%s) was gestopt door signaal %d (%s)" +msgid "Script %s was killed by signal %d (%s)" +msgstr "Script %s was gestopt door signaal %d (%s)" -#: src/process.c:304 +#: src/process.c:424 #, c-format -msgid "Process %d (%s) terminated abnormally" -msgstr "Proces %d (%s) abnormaal beëindigd" +msgid "Script %s terminated abnormally" +msgstr "Script %s abnormaal beëindigd" -#: src/process.c:329 -msgid "Got TERM signal" -msgstr "Kreeg TERM signaal" +#: src/process.c:444 src/process.c:453 src/process.c:494 src/process.c:500 +#: src/process.c:518 +#, c-format +msgid "Got %s signal" +msgstr "Kreeg %s signaal" -#: src/process.c:338 -msgid "Got QUIT signal" -msgstr "Kreeg QUIT signaal" - -#: src/process.c:345 +#: src/process.c:462 #, c-format msgid "Got another fatal signal %d (%s): not restarting." -msgstr "Kreeg nog een fataal signaal %s (%s): geen herstart." +msgstr "Kreeg nog een fataal signaal %d (%s): geen herstart." -#: src/process.c:354 +#: src/process.c:471 #, c-format msgid "Got fatal signal %d (%s)" msgstr "Kreeg fataal signaal %d (%s)" -#: src/process.c:359 +#: src/process.c:475 msgid "Trying to re-execute in 5 seconds..." msgstr "Poging tot herstarten over 5 seconden..." -#: src/process.c:382 -msgid "Got HUP signal" -msgstr "Kreeg HUP signaal" +#: src/process.c:487 +msgid "Not restarting." +msgstr "Geen herstart." -#: src/process.c:391 +#: src/process.c:503 #, c-format msgid "Reverting to old debug level (%d)" msgstr "Herstellen van oud debug niveau (%d)" -#: src/process.c:398 +#: src/process.c:509 #, c-format msgid "" "Temporarily setting debug level to 5. Kill me with SIGINT again to go back " @@ -1038,62 +1163,89 @@ msgstr "" "Tijdelijk instellen debug niveau op 5. Zend nog een SIGINT signaal om niveau " "%d te herstellen." -#: src/process.c:409 -msgid "Got ALRM signal" -msgstr "Kreeg ALRM signaal" - -#: src/process.c:438 +#: src/process.c:542 #, c-format msgid "Got unexpected signal %d (%s)" msgstr "Kreeg onverwacht signaal %d (%s)" -#: src/process.c:447 +#: src/process.c:548 #, c-format msgid "Ignored signal %d (%s)" msgstr "Signaal %d (%s) genegeerd" -#: src/process.c:504 +#: src/process.c:602 #, c-format msgid "Installing signal handler for signal %d (%s) failed: %s\n" msgstr "Installeren van signaal afhandelaar voor signaal %d (%s) faalde: %s\n" -#: src/route.c:73 +#: src/route.c:111 #, c-format msgid "Learned new MAC address %hx:%hx:%hx:%hx:%hx:%hx" msgstr "Nieuw MAC adres %hx:%hx:%hx:%hx:%hx:%hx geleerd" -#: src/route.c:107 +#: src/route.c:149 #, c-format -msgid "MAC address %hx:%hx:%hx:%hx:%hx:%hx expired" -msgstr "MAC adres %hx:%hx:%hx:%hx:%hx:%hx verlopen" +msgid "Subnet %s expired" +msgstr "Subnet %s is verlopen" -#: src/route.c:152 +#: src/route.c:184 src/route.c:337 src/route.c:479 #, c-format -msgid "Cannot route packet: unknown IPv4 destination address %d.%d.%d.%d" -msgstr "Kan pakket niet routeren: onbekend IPv4 doeladres %d.%d.%d.%d" +msgid "Packet looping back to %s (%s)!" +msgstr "Pakket komt terug naar %s (%s)!" -#: src/route.c:172 +#: src/route.c:283 +#, c-format +msgid "Length of packet (%d) doesn't match length in IPv4 header (%d)" +msgstr "" +"Lengte van pakket (%d) komt niet overeen met lengte in IPv4 header (%d)" + +#: src/route.c:287 +#, c-format +msgid "Fragmenting packet of %d bytes to %s (%s)" +msgstr "Fragmentatie pakket van %d bytes naar %s (%s)" + +#: src/route.c:325 #, c-format msgid "" -"Cannot route packet: unknown IPv6 destination address %hx:%hx:%hx:%hx:%hx:%" -"hx:%hx:%hx" +"Cannot route packet from %s (%s): unknown IPv4 destination address %d.%d.%d.%" +"d" msgstr "" -"Kan pakket niet routeren: onbekend IPv6 doeladres %hx:%hx:%hx:%hx:%hx:%hx:%" -"hx:%hx" +"Kan pakket van %s (%s) niet routeren: onbekend IPv4 doeladres %d.%d.%d.%d" -#: src/route.c:233 +#: src/route.c:350 src/route.c:489 +#, c-format +msgid "Packet for %s (%s) length %d larger than MTU %d" +msgstr "Packet voor %s (%s) lengte %d groter dan MTU %d" + +#: src/route.c:463 +#, c-format +msgid "" +"Cannot route packet from %s (%s): unknown IPv6 destination address %hx:%hx:%" +"hx:%hx:%hx:%hx:%hx:%hx" +msgstr "" +"Kan pakket van %s (%s) niet routeren: onbekend IPv6 doeladres %hx:%hx:%hx:%" +"hx:%hx:%hx:%hx:%hx" + +#: src/route.c:521 +#, c-format +msgid "Got neighbor solicitation request from %s (%s) while in router mode!" +msgstr "" +"Kreeg neighbor solicitation request van %s (%s) terwijl we in router mode " +"werken!" + +#: src/route.c:540 msgid "" "Cannot route packet: received unknown type neighbor solicitation request" msgstr "" "Kan pakket niet routeren: ontvangst van onbekend type neighbor solicitation " "verzoek" -#: src/route.c:254 +#: src/route.c:559 msgid "Cannot route packet: checksum error for neighbor solicitation request" msgstr "" "Kan pakket niet routeren: checksum fout voor neighbor solicitation verzoek" -#: src/route.c:266 +#: src/route.c:568 #, c-format msgid "" "Cannot route packet: neighbor solicitation request for unknown address %hx:%" @@ -1102,187 +1254,326 @@ msgstr "" "Kan pakket niet routeren: neighbor solicitation verzoek voor onbekend adres %" "hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx" -#: src/route.c:341 +#: src/route.c:655 +#, c-format +msgid "Got ARP request from %s (%s) while in router mode!" +msgstr "Kreeg ARP request van %s (%s) terwijl we in router mode werken!" + +#: src/route.c:672 msgid "Cannot route packet: received unknown type ARP request" msgstr "Kan pakket niet routeren: ontvangst van onbekend type ARP verzoek" -#: src/route.c:354 +#: src/route.c:681 #, c-format msgid "Cannot route packet: ARP request for unknown address %d.%d.%d.%d" msgstr "Kan pakket niet routeren: ARP verzoek voor onbekend adres %d.%d.%d.%d" -#: src/route.c:411 +#: src/route.c:737 #, c-format -msgid "Cannot route packet: unknown type %hx" -msgstr "Kan pakket niet routeren: onbekend type %hx" +msgid "Cannot route packet from %s (%s): unknown type %hx" +msgstr "Kan pakket van %s (%s) niet routeren: onbekend type %hx" -#: src/node.c:161 +#: src/node.c:183 msgid "Nodes:" msgstr "Nodes:" -#: src/node.c:166 +#: src/node.c:187 #, c-format msgid "" " %s at %s cipher %d digest %d maclength %d compression %d options %lx status " -"%04x nexthop %s via %s" +"%04x nexthop %s via %s pmtu %d (min %d max %d)" msgstr "" " %s op %s cipher %d digest %d maclengte %d compressie %d opties %lx status %" -"04x nexthop %s via %s" +"04x nexthop %s via %s pmtu %d (min %d max %d)" -#: src/node.c:171 +#: src/node.c:194 msgid "End of nodes." msgstr "Einde van nodes." -#: src/edge.c:194 +#: src/edge.c:148 msgid "Edges:" msgstr "Edges:" -#: src/edge.c:201 +#: src/edge.c:155 #, c-format -msgid " %s at %s - %s at %s options %lx weight %d" -msgstr " %s op %s - %s op %s opties %lx gewicht %d" +msgid " %s to %s at %s options %lx weight %d" +msgstr " %s naar %s op %s opties %lx gewicht %d" -#: src/edge.c:209 +#: src/edge.c:161 msgid "End of edges." msgstr "Einde van edges." -#: src/graph.c:261 +#: src/graph.c:263 #, c-format msgid "Node %s (%s) became reachable" msgstr "Node %s (%s) werd bereikbaar" -#: src/graph.c:273 +#: src/graph.c:266 #, c-format msgid "Node %s (%s) became unreachable" msgstr "Node %s (%s) is niet meer bereikbaar" -#: src/freebsd/device.c:70 src/linux/device.c:89 src/netbsd/device.c:74 -#: src/openbsd/device.c:74 src/solaris/device.c:75 +#: src/linux/device.c:76 src/solaris/device.c:57 src/bsd/device.c:63 +#: src/raw_socket/device.c:59 src/uml_socket/device.c:122 #, c-format msgid "Could not open %s: %s" msgstr "Kon `%s' niet openen: %s" -#: src/linux/device.c:114 src/linux/device.c:124 -msgid "Linux tun/tap device" -msgstr "Linux tun/tap apparaat" +#: src/linux/device.c:87 +msgid "Linux tun/tap device (tun mode)" +msgstr "Linux tun/tap apparaat (tun modus)" -#: src/linux/device.c:122 +#: src/linux/device.c:91 +msgid "Linux tun/tap device (tap mode)" +msgstr "Linux tun/tap apparaat (tap modus)" + +#: src/linux/device.c:101 #, c-format msgid "Old ioctl() request was needed for %s" msgstr "Oud ioctl() verzoek was nodig voor %s" -#: src/linux/device.c:131 +#: src/linux/device.c:109 msgid "Linux ethertap device" msgstr "Linux ethertap apparaat" -#: src/freebsd/device.c:87 src/linux/device.c:136 src/netbsd/device.c:90 -#: src/openbsd/device.c:90 src/solaris/device.c:132 +#: src/linux/device.c:114 src/solaris/device.c:106 src/bsd/device.c:133 +#: src/raw_socket/device.c:83 src/uml_socket/device.c:149 #, c-format msgid "%s is a %s" msgstr "%s is een %s" -#: src/freebsd/device.c:108 src/linux/device.c:159 src/linux/device.c:169 -#: src/netbsd/device.c:111 src/openbsd/device.c:111 src/solaris/device.c:149 +#: src/linux/device.c:137 src/linux/device.c:148 src/linux/device.c:159 +#: src/solaris/device.c:125 src/bsd/device.c:152 src/bsd/device.c:181 +#: src/bsd/device.c:210 src/cygwin/device.c:239 src/mingw/device.c:103 +#: src/mingw/device.c:303 src/raw_socket/device.c:102 +#: src/uml_socket/device.c:239 #, c-format msgid "Error while reading from %s %s: %s" msgstr "Fout tijdens lezen van %s %s: %s" -#: src/freebsd/device.c:117 src/linux/device.c:180 src/netbsd/device.c:126 -#: src/openbsd/device.c:140 src/solaris/device.c:164 +#: src/linux/device.c:170 src/solaris/device.c:150 src/bsd/device.c:224 +#: src/cygwin/device.c:248 src/mingw/device.c:312 src/raw_socket/device.c:111 +#: src/uml_socket/device.c:249 #, c-format msgid "Read packet of %d bytes from %s" msgstr "Pakket van %d bytes gelezen van %s" -#: src/freebsd/device.c:128 src/linux/device.c:191 src/netbsd/device.c:139 -#: src/openbsd/device.c:154 src/solaris/device.c:175 +#: src/linux/device.c:180 src/solaris/device.c:160 src/bsd/device.c:234 +#: src/cygwin/device.c:260 src/mingw/device.c:325 src/raw_socket/device.c:121 +#: src/uml_socket/device.c:267 #, c-format msgid "Writing packet of %d bytes to %s" msgstr "Pakket van %d bytes geschreven naar %s" -#: src/linux/device.c:198 src/linux/device.c:207 src/netbsd/device.c:149 -#: src/openbsd/device.c:180 src/solaris/device.c:180 +#: src/linux/device.c:187 src/linux/device.c:194 src/linux/device.c:203 +#: src/solaris/device.c:164 src/bsd/device.c:268 src/raw_socket/device.c:125 +#: src/uml_socket/device.c:272 #, c-format msgid "Can't write to %s %s: %s" msgstr "Kan niet schrijven naar %s %s: %s" -#: src/freebsd/device.c:144 src/linux/device.c:220 src/netbsd/device.c:160 -#: src/openbsd/device.c:191 src/solaris/device.c:192 +#: src/linux/device.c:219 src/solaris/device.c:178 src/bsd/device.c:296 +#: src/cygwin/device.c:277 src/mingw/device.c:342 src/raw_socket/device.c:139 +#: src/uml_socket/device.c:288 #, c-format msgid "Statistics for %s %s:" msgstr "Statistieken voor %s %s:" -#: src/freebsd/device.c:145 src/linux/device.c:221 src/netbsd/device.c:161 -#: src/openbsd/device.c:192 src/solaris/device.c:193 +#: src/linux/device.c:220 src/solaris/device.c:179 src/bsd/device.c:297 +#: src/cygwin/device.c:278 src/mingw/device.c:343 src/raw_socket/device.c:140 +#: src/uml_socket/device.c:289 #, c-format msgid " total bytes in: %10d" msgstr " totaal aantal bytes in: %10d" -#: src/freebsd/device.c:146 src/linux/device.c:222 src/netbsd/device.c:162 -#: src/openbsd/device.c:193 src/solaris/device.c:194 +#: src/linux/device.c:221 src/solaris/device.c:180 src/bsd/device.c:298 +#: src/cygwin/device.c:279 src/mingw/device.c:344 src/raw_socket/device.c:141 +#: src/uml_socket/device.c:290 #, c-format msgid " total bytes out: %10d" msgstr " totaal aantal bytes uit: %10d" -#: src/freebsd/device.c:85 -msgid "FreeBSD tap device" -msgstr "FreeBSD tap apparaat" - -#: src/freebsd/device.c:133 -#, c-format -msgid "Error while writing to %s %s: %s" -msgstr "Fout tijdens schrijven naar %s %s: %s" - -#: src/solaris/device.c:86 +#: src/solaris/device.c:69 #, c-format msgid "Could not open /dev/ip: %s" msgstr "Kon /dev/ip niet openen: %s" -#: src/solaris/device.c:92 +#: src/solaris/device.c:75 #, c-format msgid "Can't assign new interface: %s" msgstr "Kan geen nieuwe interface toekennen: %s" -#: src/solaris/device.c:97 +#: src/solaris/device.c:80 #, c-format msgid "Could not open %s twice: %s" msgstr "Kon `%s' niet twee keer openen: %s" -#: src/solaris/device.c:102 +#: src/solaris/device.c:86 #, c-format msgid "Can't push IP module: %s" msgstr "Kan IP module niet invoegen: %s" -#: src/solaris/device.c:108 +#: src/solaris/device.c:92 #, c-format msgid "Can't set PPA %d: %s" msgstr "Kon PPA %d niet instellen: %s" -#: src/solaris/device.c:113 +#: src/solaris/device.c:97 #, c-format msgid "Can't link TUN device to IP: %s" msgstr "Kan TUN apparaat niet koppelen aan IP: %s" -#: src/solaris/device.c:120 +#: src/solaris/device.c:104 msgid "Solaris tun device" msgstr "Solaris tun apparaat" -#: src/netbsd/device.c:88 -msgid "NetBSD tun device" -msgstr "NetBSD tun apparaat" - -#: src/openbsd/device.c:88 -msgid "OpenBSD tun device" -msgstr "OpenBSD tun apparaat" - -#: src/openbsd/device.c:130 +#: src/solaris/device.c:141 src/bsd/device.c:168 #, c-format -msgid "Unknown address family %d while reading packet from %s %s" -msgstr "Onbekende adresfamilie tijdens lezen pakket van %s %s" +msgid "Unknown IP version %d while reading packet from %s %s" +msgstr "Onbekende IP versie %d tijdens ontvangst pakket van %s %s" -#: src/openbsd/device.c:169 +#: src/bsd/device.c:77 #, c-format -msgid "Unknown address family %d while writing packet to %s %s" -msgstr "Onbekende adresfamilie tijdens schrijven pakket naar %s %s" +msgid "Unknown device type %s!" +msgstr "Onbekend apparaattype %s!" -#~ msgid "Invalid public/private keypair!" -#~ msgstr "Ongeldig publiek/privé sleutelpaar!" +#: src/bsd/device.c:105 src/bsd/device.c:124 +msgid "Generic BSD tun device" +msgstr "Generiek BSD tun apparaat" + +#: src/bsd/device.c:129 +msgid "Generic BSD tap device" +msgstr "Generiek BSD tap apparaat" + +#: src/bsd/device.c:199 +#, c-format +msgid "Unknown address family %x while reading packet from %s %s" +msgstr "Onbekende adresfamilie %x tijdens ontvangst pakket van %s %s" + +#: src/bsd/device.c:240 src/bsd/device.c:277 src/cygwin/device.c:264 +#: src/mingw/device.c:329 +#, c-format +msgid "Error while writing to %s %s: %s" +msgstr "Fout tijdens schrijven naar %s %s: %s" + +#: src/bsd/device.c:262 +#, c-format +msgid "Unknown address family %x while writing packet to %s %s" +msgstr "Onbekende adresfamiliy %x tijdens versturen pakket naar %s %s" + +#: src/cygwin/device.c:71 src/mingw/device.c:147 +#, c-format +msgid "Unable to read registry: %s" +msgstr "Kon registry niet lezen: %s" + +#: src/cygwin/device.c:123 src/mingw/device.c:198 +msgid "No Windows tap device found!" +msgstr "Geen Windows tap apparaat gevonden!" + +#: src/cygwin/device.c:149 +#, c-format +msgid "Could not open Windows tap device %s (%s) for writing: %s" +msgstr "Kon Windows tap apparaat %s (%s) niet openen om te schrijven: %s" + +#: src/cygwin/device.c:158 src/mingw/device.c:223 +#, c-format +msgid "Could not get MAC address from Windows tap device %s (%s): %s" +msgstr "Kon MAC adres niet achterhalen van Windows tap apparaat %s (%s): %s" + +#: src/cygwin/device.c:187 +#, c-format +msgid "Could not open Windows tap device %s (%s) for reading: %s" +msgstr "Kon Windows tap apparaat %s (%s) niet openen om te lezen: %s" + +#: src/cygwin/device.c:193 +msgid "Tap reader forked and running." +msgstr "Taplezer is geforked en draait." + +#: src/cygwin/device.c:210 +msgid "Tap reader failed!" +msgstr "Taplezer faalde!" + +#: src/cygwin/device.c:214 src/mingw/device.c:282 +msgid "Windows tap device" +msgstr "Windows tap apparaat" + +#: src/cygwin/device.c:216 src/mingw/device.c:284 +#, c-format +msgid "%s (%s) is a %s" +msgstr "%s (%s) is een %s" + +#: src/mingw/device.c:84 +msgid "Tap reader running" +msgstr "Taplezer draait" + +#: src/mingw/device.c:216 +#, c-format +msgid "%s (%s) is not a usable Windows tap device: %s" +msgstr "%s (%s) is geen bruikbaar Windows tap apparaat: %s" + +#: src/raw_socket/device.c:56 +msgid "raw socket" +msgstr "raw socket" + +#: src/raw_socket/device.c:68 +#, c-format +msgid "Can't find interface %s: %s" +msgstr "Kan interface %s niet vinden: %s" + +#: src/raw_socket/device.c:79 src/uml_socket/device.c:137 +#, c-format +msgid "Could not bind %s to %s: %s" +msgstr "Kon %s niet aan %s binden: %s" + +#: src/uml_socket/device.c:78 +msgid "UML network socket" +msgstr "UML network socket" + +#: src/uml_socket/device.c:81 +#, c-format +msgid "Could not open write %s: %s" +msgstr "Kon `%s' niet openen: %s" + +#: src/uml_socket/device.c:95 +#, c-format +msgid "Could not open data %s: %s" +msgstr "Kon data-%s niet openen: %s" + +#: src/uml_socket/device.c:116 +#, c-format +msgid "Could not bind data %s: %s" +msgstr "Kon data-%s niet binden: %s" + +#: src/uml_socket/device.c:142 +#, c-format +msgid "Could not listen on %s %s: %s" +msgstr "Kon niet luisteren op %s %s: %s" + +#: src/uml_socket/device.c:189 +#, c-format +msgid "Could not accept connection to %s %s: %s" +msgstr "Kon verbinding met %s %s niet accepteren: %s" + +#: src/uml_socket/device.c:209 +#, c-format +msgid "Error while reading request from %s %s: %s" +msgstr "Fout tijdens lezen verzoek van %s %s: %s" + +#: src/uml_socket/device.c:216 +#, c-format +msgid "Unknown magic %x, version %d, request type %d from %s %s" +msgstr "Onbekende magische waarde %x, versie %d, verzoektype %d van %s %s" + +#: src/uml_socket/device.c:223 +#, c-format +msgid "Could not bind write %s: %s" +msgstr "Kon niet aan schrijf-%s binden: %s" + +#: src/uml_socket/device.c:231 +msgid "Connection with UML established" +msgstr "Verbinding met UML geactiveerd" + +#: src/uml_socket/device.c:262 +#, c-format +msgid "Dropping packet of %d bytes to %s: not connected to UML yet" +msgstr "Pakket van %d bytes naar %s laten vallen: nog niet verbonden met UML" diff --git a/po/quot.sed b/po/quot.sed new file mode 100644 index 0000000..0122c46 --- /dev/null +++ b/po/quot.sed @@ -0,0 +1,6 @@ +s/"\([^"]*\)"/“\1â€/g +s/`\([^`']*\)'/‘\1’/g +s/ '\([^`']*\)' / ‘\1’ /g +s/ '\([^`']*\)'$/ ‘\1’/g +s/^'\([^`']*\)' /‘\1’ /g +s/“â€/""/g diff --git a/po/remove-potcdate.sin b/po/remove-potcdate.sin new file mode 100644 index 0000000..2436c49 --- /dev/null +++ b/po/remove-potcdate.sin @@ -0,0 +1,19 @@ +# Sed script that remove the POT-Creation-Date line in the header entry +# from a POT file. +# +# The distinction between the first and the following occurrences of the +# pattern is achieved by looking at the hold space. +/^"POT-Creation-Date: .*"$/{ +x +# Test if the hold space is empty. +s/P/P/ +ta +# Yes it was empty. First occurrence. Remove the line. +g +d +bb +:a +# The hold space was nonempty. Following occurrences. Do nothing. +x +:b +} diff --git a/po/stamp-po b/po/stamp-po new file mode 100644 index 0000000..9788f70 --- /dev/null +++ b/po/stamp-po @@ -0,0 +1 @@ +timestamp diff --git a/po/tinc.pot b/po/tinc.pot index 9eb3a62..1aad6a1 100644 --- a/po/tinc.pot +++ b/po/tinc.pot @@ -1,12 +1,14 @@ # SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR Free Software Foundation, Inc. +# Copyright (C) YEAR Ivo Timmermans and Guus Sliepen +# This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2002-04-09 13:59+0200\n" +"Report-Msgid-Bugs-To: tinc-devel@tinc-vpn.org\n" +"POT-Creation-Date: 2004-11-11 13:40+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -14,852 +16,911 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: src/conf.c:173 +#: lib/utils.c:93 +msgid "(unable to format errormessage)" +msgstr "" + +#: src/conf.c:159 #, c-format msgid "\"yes\" or \"no\" expected for configuration variable %s in %s line %d" msgstr "" -#: src/conf.c:188 +#: src/conf.c:175 #, c-format msgid "Integer expected for configuration variable %s in %s line %d" msgstr "" -#: src/conf.c:218 +#: src/conf.c:209 #, c-format msgid "" "Hostname or IP address expected for configuration variable %s in %s line %d" msgstr "" -#: src/conf.c:235 -#, c-format -msgid "Port number expected for configuration variable %s in %s line %d" -msgstr "" - -#: src/conf.c:251 +#: src/conf.c:225 #, c-format msgid "Subnet expected for configuration variable %s in %s line %d" msgstr "" -#: src/conf.c:261 +#: src/conf.c:236 #, c-format msgid "" "Network address and prefix length do not match for configuration variable %s " "in %s line %d" msgstr "" -#: src/conf.c:369 +#: src/conf.c:336 #, c-format msgid "Cannot open config file %s: %s" msgstr "" -#: src/conf.c:405 +#: src/conf.c:390 #, c-format msgid "No value for variable `%s' on line %d while reading config file %s" msgstr "" -#: src/conf.c:438 +#: src/conf.c:421 #, c-format msgid "Failed to read `%s': %s" msgstr "" -#: src/conf.c:465 -#, c-format -msgid "`%s' is not an absolute path" -msgstr "" - -#: src/conf.c:481 src/conf.c:513 -#, c-format -msgid "Couldn't stat `%s': %s" -msgstr "" - -#: src/conf.c:487 src/conf.c:522 -#, c-format -msgid "`%s' is owned by UID %d instead of %d" -msgstr "" - -#: src/conf.c:494 src/conf.c:529 -#, c-format -msgid "Warning: `%s' is a symlink" -msgstr "" - -#: src/conf.c:499 src/conf.c:534 -#, c-format -msgid "Unable to read symbolic link `%s': %s" -msgstr "" - -#. Accessible by others -#: src/conf.c:545 -#, c-format -msgid "`%s' has unsecure permissions" -msgstr "" - -#. Ask for a file and/or directory name. -#: src/conf.c:570 +#: src/conf.c:443 #, c-format msgid "Please enter a file to save %s to [%s]: " msgstr "" -#: src/conf.c:576 +#: src/conf.c:450 #, c-format msgid "Error while reading stdin: %s\n" msgstr "" -#: src/conf.c:602 +#: src/conf.c:482 #, c-format msgid "Error opening file `%s': %s\n" msgstr "" -#: src/conf.c:612 -#, c-format -msgid "" -"The file `%s' (or any of the leading directories) has unsafe permissions.\n" -"I will not create or overwrite this file.\n" +#: src/connection.c:49 +msgid "everyone" msgstr "" -#: src/connection.c:114 +#: src/connection.c:50 +msgid "BROADCAST" +msgstr "" + +#: src/connection.c:120 msgid "Connections:" msgstr "" -#: src/connection.c:119 +#: src/connection.c:124 #, c-format msgid " %s at %s options %lx socket %d status %04x" msgstr "" -#: src/connection.c:123 +#: src/connection.c:128 msgid "End of connections." msgstr "" -#: src/meta.c:49 +#: src/meta.c:45 #, c-format msgid "Sending %d bytes of metadata to %s (%s)" msgstr "" -#: src/meta.c:63 +#: src/meta.c:51 #, c-format -msgid "Sending meta data to %s (%s) failed: %s" +msgid "Error while encrypting metadata to %s (%s): %s" msgstr "" -#: src/meta.c:94 -#, c-format -msgid "This is a bug: %s:%d: %d:%s %s (%s)" -msgstr "" - -#: src/meta.c:100 -#, c-format -msgid "Metadata socket error for %s (%s): %s" -msgstr "" - -#: src/meta.c:121 +#: src/meta.c:64 src/meta.c:117 #, c-format msgid "Connection closed by %s (%s)" msgstr "" -#: src/meta.c:128 +#: src/meta.c:69 +#, c-format +msgid "Sending meta data to %s (%s) failed: %s" +msgstr "" + +#: src/meta.c:122 #, c-format msgid "Metadata socket read error for %s (%s): %s" msgstr "" -#: src/meta.c:202 +#: src/meta.c:137 +#, c-format +msgid "Error while decrypting metadata from %s (%s): %s" +msgstr "" + +#: src/meta.c:190 #, c-format msgid "Metadata read buffer overflow for %s (%s)" msgstr "" -#: src/net.c:88 +#: src/net.c:60 msgid "Purging unreachable nodes" msgstr "" -#: src/net.c:98 +#: src/net.c:69 #, c-format msgid "Purging node %s (%s)" msgstr "" -#: src/net.c:188 +#: src/net.c:170 #, c-format msgid "Closing connection with %s (%s)" msgstr "" -#: src/net.c:253 +#: src/net.c:235 #, c-format msgid "%s (%s) didn't respond to PING" msgstr "" -#: src/net.c:266 +#: src/net.c:244 +#, c-format +msgid "Old connection_t for %s (%s) status %04x still lingering, deleting..." +msgstr "" + +#: src/net.c:249 #, c-format msgid "Timeout from %s (%s) during authentication" msgstr "" -#: src/net.c:311 src/net_socket.c:253 +#: src/net.c:297 #, c-format msgid "Error while connecting to %s (%s): %s" msgstr "" -#: src/net.c:363 +#: src/net.c:353 #, c-format msgid "Error while waiting for input: %s" msgstr "" -#: src/net.c:397 +#: src/net.c:384 msgid "Regenerating symmetric key" msgstr "" -#: src/net.c:414 +#: src/net.c:401 msgid "Flushing event queue" msgstr "" -#: src/net.c:431 -msgid "Rereading configuration file and restarting in 5 seconds..." +#: src/net.c:425 +msgid "Unable to reread configuration file, exitting." msgstr "" -#: src/net.c:438 -msgid "Unable to reread configuration file, exitting." +#: src/net_packet.c:75 +#, c-format +msgid "No response to MTU probes from %s (%s)" +msgstr "" + +#: src/net_packet.c:82 +#, c-format +msgid "Fixing MTU of %s (%s) to %d after %d probes" +msgstr "" + +#: src/net_packet.c:94 +#, c-format +msgid "Sending MTU probe length %d to %s (%s)" msgstr "" #: src/net_packet.c:107 #, c-format -msgid "Got unauthenticated packet from %s (%s)" +msgid "Got MTU probe length %d from %s (%s)" msgstr "" -#: src/net_packet.c:134 -#, c-format -msgid "Got late or replayed packet from %s (%s), seqno %d" -msgstr "" - -#: src/net_packet.c:151 -#, c-format -msgid "Error while uncompressing packet from %s (%s)" -msgstr "" - -#: src/net_packet.c:178 +#: src/net_packet.c:164 #, c-format msgid "Received packet of %d bytes from %s (%s)" msgstr "" -#: src/net_packet.c:204 +#: src/net_packet.c:185 src/route.c:92 +#, c-format +msgid "Got too short packet from %s (%s)" +msgstr "" + +#: src/net_packet.c:198 +#, c-format +msgid "Got unauthenticated packet from %s (%s)" +msgstr "" + +#: src/net_packet.c:213 +#, c-format +msgid "Error decrypting packet from %s (%s): %s" +msgstr "" + +#: src/net_packet.c:229 +#, c-format +msgid "Lost %d packets from %s (%s)" +msgstr "" + +#: src/net_packet.c:235 +#, c-format +msgid "Got late or replayed packet from %s (%s), seqno %d, last received %d" +msgstr "" + +#: src/net_packet.c:259 +#, c-format +msgid "Error while uncompressing packet from %s (%s)" +msgstr "" + +#: src/net_packet.c:307 #, c-format msgid "No valid key known yet for %s (%s), queueing packet" msgstr "" -#: src/net_packet.c:237 +#: src/net_packet.c:336 #, c-format msgid "Error while compressing packet to %s (%s)" msgstr "" -#: src/net_packet.c:288 +#: src/net_packet.c:358 +#, c-format +msgid "Error while encrypting packet to %s (%s): %s" +msgstr "" + +#: src/net_packet.c:390 #, c-format msgid "Setting outgoing packet priority to %d" msgstr "" -#. SO_PRIORITY doesn't seem to work -#: src/net_packet.c:290 src/net_setup.c:450 src/net_socket.c:98 -#: src/net_socket.c:144 src/net_socket.c:171 src/process.c:273 -#: src/process.c:310 +#: src/net_packet.c:392 src/net_setup.c:477 src/net_socket.c:73 +#: src/net_socket.c:124 src/net_socket.c:153 src/tincd.c:434 src/tincd.c:468 +#: src/process.c:198 src/process.c:231 src/process.c:428 src/bsd/device.c:93 +#: src/bsd/device.c:112 src/cygwin/device.c:140 src/cygwin/device.c:171 +#: src/mingw/device.c:66 src/mingw/device.c:75 src/mingw/device.c:80 +#: src/mingw/device.c:236 src/mingw/device.c:243 src/mingw/device.c:248 +#: src/mingw/device.c:255 src/mingw/device.c:264 src/mingw/device.c:271 +#: src/uml_socket/device.c:89 src/uml_socket/device.c:103 +#: src/uml_socket/device.c:130 src/uml_socket/device.c:194 #, c-format msgid "System call `%s' failed: %s" msgstr "" -#: src/net_packet.c:296 +#: src/net_packet.c:403 #, c-format msgid "Error sending packet to %s (%s): %s" msgstr "" -#: src/net_packet.c:313 +#: src/net_packet.c:426 #, c-format msgid "Sending packet of %d bytes to %s (%s)" msgstr "" -#: src/net_packet.c:320 -msgid "Packet is looping back to us!" -msgstr "" - -#: src/net_packet.c:329 +#: src/net_packet.c:430 #, c-format msgid "Node %s (%s) is not reachable" msgstr "" -#: src/net_packet.c:337 +#: src/net_packet.c:438 #, c-format msgid "Sending packet to %s via %s (%s)" msgstr "" -#: src/net_packet.c:357 +#: src/net_packet.c:457 #, c-format msgid "Broadcasting packet of %d bytes from %s (%s)" msgstr "" -#: src/net_packet.c:374 +#: src/net_packet.c:474 #, c-format msgid "Flushing queue for %s (%s)" msgstr "" -#: src/net_packet.c:396 -#, c-format -msgid "This is a bug: %s:%d: %d:%s" -msgstr "" - -#: src/net_packet.c:403 -#, c-format -msgid "Incoming data socket error: %s" -msgstr "" - -#: src/net_packet.c:409 +#: src/net_packet.c:496 #, c-format msgid "Receiving packet failed: %s" msgstr "" -#: src/net_packet.c:420 +#: src/net_packet.c:506 #, c-format msgid "Received UDP packet from unknown source %s" msgstr "" -#: src/net_setup.c:102 +#: src/net_setup.c:77 src/net_setup.c:94 #, c-format msgid "Error reading RSA public key file `%s': %s" msgstr "" -#: src/net_setup.c:112 +#: src/net_setup.c:109 #, c-format msgid "Reading RSA public key file `%s' failed: %s" msgstr "" -#: src/net_setup.c:140 +#: src/net_setup.c:145 #, c-format msgid "No public key for %s specified!" msgstr "" -#: src/net_setup.c:166 +#: src/net_setup.c:160 +msgid "PrivateKey used but no PublicKey found!" +msgstr "" + +#: src/net_setup.c:179 #, c-format msgid "Error reading RSA private key file `%s': %s" msgstr "" -#: src/net_setup.c:176 +#: src/net_setup.c:187 +#, c-format +msgid "Could not stat RSA private key file `%s': %s'" +msgstr "" + +#: src/net_setup.c:194 +#, c-format +msgid "Warning: insecure file permissions for RSA private key file `%s'!" +msgstr "" + +#: src/net_setup.c:201 #, c-format msgid "Reading RSA private key file `%s' failed: %s" msgstr "" -#: src/net_setup.c:202 src/net_setup.c:203 +#: src/net_setup.c:231 src/net_setup.c:232 msgid "MYSELF" msgstr "" -#: src/net_setup.c:210 +#: src/net_setup.c:238 msgid "Name for tinc daemon required!" msgstr "" -#: src/net_setup.c:216 +#: src/net_setup.c:243 msgid "Invalid name for myself!" msgstr "" -#: src/net_setup.c:230 +#: src/net_setup.c:252 msgid "Cannot open host configuration file for myself!" msgstr "" -#: src/net_setup.c:287 +#: src/net_setup.c:307 msgid "Invalid routing mode!" msgstr "" -#: src/net_setup.c:298 +#: src/net_setup.c:318 msgid "PriorityInheritance not supported on this platform" msgstr "" -#: src/net_setup.c:308 +#: src/net_setup.c:326 msgid "Bogus maximum timeout!" msgstr "" -#: src/net_setup.c:325 +#: src/net_setup.c:340 msgid "Invalid address family!" msgstr "" -#: src/net_setup.c:347 +#: src/net_setup.c:358 msgid "Unrecognized cipher type!" msgstr "" -#: src/net_setup.c:382 +#: src/net_setup.c:383 src/protocol_auth.c:189 +#, c-format +msgid "Error during initialisation of cipher for %s (%s): %s" +msgstr "" + +#: src/net_setup.c:400 msgid "Unrecognized digest type!" msgstr "" -#: src/net_setup.c:398 +#: src/net_setup.c:413 msgid "MAC length exceeds size of digest!" msgstr "" -#: src/net_setup.c:403 +#: src/net_setup.c:416 msgid "Bogus MAC length!" msgstr "" -#: src/net_setup.c:419 +#: src/net_setup.c:430 msgid "Bogus compression level!" msgstr "" -#: src/net_setup.c:465 +#: src/net_setup.c:499 #, c-format msgid "Listening on %s" msgstr "" -#: src/net_setup.c:476 +#: src/net_setup.c:510 msgid "Ready" msgstr "" -#: src/net_setup.c:479 +#: src/net_setup.c:512 msgid "Unable to create any listening socket!" msgstr "" -#: src/net_socket.c:90 +#: src/net_socket.c:63 #, c-format msgid "Creating metasocket failed: %s" msgstr "" -#: src/net_socket.c:124 src/net_socket.c:186 +#: src/net_socket.c:104 src/net_socket.c:196 #, c-format msgid "Can't bind to interface %s: %s" msgstr "" -#: src/net_socket.c:128 -msgid "BindToDevice not supported on this platform" +#: src/net_socket.c:109 +msgid "BindToInterface not supported on this platform" msgstr "" -#: src/net_socket.c:136 +#: src/net_socket.c:116 #, c-format msgid "Can't bind to %s/tcp: %s" msgstr "" -#: src/net_socket.c:163 +#: src/net_socket.c:143 #, c-format msgid "Creating UDP socket failed: %s" msgstr "" -#: src/net_socket.c:196 +#: src/net_socket.c:207 #, c-format msgid "Can't bind to %s/udp: %s" msgstr "" -#: src/net_socket.c:219 +#: src/net_socket.c:234 #, c-format msgid "Trying to re-establish outgoing connection in %d seconds" msgstr "" -#: src/net_socket.c:228 src/net_socket.c:322 -#, c-format -msgid "Trying to connect to %s (%s)" -msgstr "" - -#: src/net_socket.c:234 src/net_socket.c:329 -#, c-format -msgid "Creating socket for %s failed: %s" -msgstr "" - -#: src/net_socket.c:258 src/net_socket.c:268 +#: src/net_socket.c:242 #, c-format msgid "Connected to %s (%s)" msgstr "" -#: src/net_socket.c:287 -#, c-format -msgid "Could not set up a meta connection to %s" -msgstr "" - -#: src/net_socket.c:350 +#: src/net_socket.c:249 src/net_socket.c:333 src/net_socket.c:444 #, c-format msgid "fcntl for %s: %s" msgstr "" -#: src/net_socket.c:368 +#: src/net_socket.c:269 +#, c-format +msgid "Could not set up a meta connection to %s" +msgstr "" + +#: src/net_socket.c:303 +#, c-format +msgid "Trying to connect to %s (%s)" +msgstr "" + +#: src/net_socket.c:309 +#, c-format +msgid "Creating socket for %s failed: %s" +msgstr "" + +#: src/net_socket.c:349 #, c-format msgid "%s: %s" msgstr "" -#: src/net_socket.c:389 +#: src/net_socket.c:370 #, c-format msgid "Already connected to %s" msgstr "" -#: src/net_socket.c:408 +#: src/net_socket.c:389 #, c-format msgid "No address specified for %s" msgstr "" -#: src/net_socket.c:435 +#: src/net_socket.c:419 #, c-format msgid "Accepting a new connection failed: %s" msgstr "" -#: src/net_socket.c:453 +#: src/net_socket.c:437 #, c-format msgid "Connection from %s" msgstr "" -#: src/net_socket.c:475 +#: src/net_socket.c:471 #, c-format msgid "Invalid name for outgoing connection in %s line %d" msgstr "" -#: src/netutl.c:65 src/netutl.c:88 +#: src/netutl.c:50 #, c-format -msgid "Error looking up %s port %s: %s\n" +msgid "Error looking up %s port %s: %s" msgstr "" -#: src/netutl.c:109 +#: src/netutl.c:105 #, c-format msgid "Error while translating addresses: %s" msgstr "" -#: src/netutl.c:134 -#, c-format -msgid "Error while looking up hostname: %s" -msgstr "" - -#: src/netutl.c:137 +#: src/netutl.c:131 src/netutl.c:142 #, c-format msgid "%s port %s" msgstr "" -#: src/netutl.c:166 +#: src/netutl.c:138 +#, c-format +msgid "Error while looking up hostname: %s" +msgstr "" + +#: src/netutl.c:187 #, c-format msgid "sockaddrcmp() was called with unknown address family %d, exitting!" msgstr "" -#: src/protocol.c:77 +#: src/protocol.c:87 #, c-format msgid "Output buffer overflow while sending request to %s (%s)" msgstr "" -#: src/protocol.c:85 +#: src/protocol.c:95 #, c-format msgid "Sending %s to %s (%s): %s" msgstr "" -#: src/protocol.c:87 +#: src/protocol.c:98 #, c-format msgid "Sending %s to %s (%s)" msgstr "" -#: src/protocol.c:104 +#: src/protocol.c:120 +#, c-format +msgid "Forwarding %s from %s (%s): %s" +msgstr "" + +#: src/protocol.c:124 +#, c-format +msgid "Forwarding %s from %s (%s)" +msgstr "" + +#: src/protocol.c:142 #, c-format msgid "Unknown request from %s (%s): %s" msgstr "" -#: src/protocol.c:107 +#: src/protocol.c:145 #, c-format msgid "Unknown request from %s (%s)" msgstr "" -#: src/protocol.c:117 +#: src/protocol.c:152 #, c-format msgid "Got %s from %s (%s): %s" msgstr "" -#: src/protocol.c:120 +#: src/protocol.c:156 #, c-format msgid "Got %s from %s (%s)" msgstr "" -#: src/protocol.c:127 +#: src/protocol.c:162 #, c-format msgid "Unauthorized request from %s (%s)" msgstr "" -#: src/protocol.c:134 +#: src/protocol.c:170 #, c-format msgid "Error while processing %s from %s (%s)" msgstr "" -#: src/protocol.c:141 +#: src/protocol.c:175 #, c-format msgid "Bogus data received from %s (%s)" msgstr "" -#: src/protocol.c:187 +#: src/protocol.c:221 msgid "Already seen request" msgstr "" -#: src/protocol.c:218 +#: src/protocol.c:251 #, c-format -msgid "Aging past requests: deleted %d, left %d\n" +msgid "Aging past requests: deleted %d, left %d" msgstr "" -#: src/protocol_auth.c:69 src/protocol_auth.c:224 src/protocol_auth.c:357 -#: src/protocol_auth.c:417 src/protocol_auth.c:529 src/protocol_edge.c:90 -#: src/protocol_edge.c:219 src/protocol_key.c:80 src/protocol_key.c:128 -#: src/protocol_key.c:196 src/protocol_misc.c:61 src/protocol_misc.c:91 -#: src/protocol_misc.c:177 src/protocol_subnet.c:71 src/protocol_subnet.c:163 +#: src/protocol_auth.c:58 src/protocol_auth.c:209 src/protocol_auth.c:338 +#: src/protocol_auth.c:405 src/protocol_auth.c:531 src/protocol_edge.c:73 +#: src/protocol_edge.c:188 src/protocol_key.c:62 src/protocol_key.c:105 +#: src/protocol_key.c:172 src/protocol_misc.c:54 src/protocol_misc.c:83 +#: src/protocol_misc.c:171 src/protocol_subnet.c:58 src/protocol_subnet.c:167 #, c-format msgid "Got bad %s from %s (%s)" msgstr "" -#: src/protocol_auth.c:77 src/protocol_edge.c:98 src/protocol_edge.c:104 -#: src/protocol_edge.c:228 src/protocol_edge.c:234 src/protocol_subnet.c:79 -#: src/protocol_subnet.c:87 src/protocol_subnet.c:171 -#: src/protocol_subnet.c:189 +#: src/protocol_auth.c:66 src/protocol_edge.c:81 src/protocol_edge.c:87 +#: src/protocol_edge.c:196 src/protocol_edge.c:202 src/protocol_subnet.c:66 +#: src/protocol_subnet.c:74 src/protocol_subnet.c:175 +#: src/protocol_subnet.c:196 #, c-format msgid "Got bad %s from %s (%s): %s" msgstr "" -#: src/protocol_auth.c:87 +#: src/protocol_auth.c:75 #, c-format msgid "Peer %s is %s instead of %s" msgstr "" -#: src/protocol_auth.c:98 +#: src/protocol_auth.c:85 #, c-format msgid "Peer %s (%s) uses incompatible version %d" msgstr "" -#: src/protocol_auth.c:117 +#: src/protocol_auth.c:101 #, c-format msgid "Peer %s had unknown identity (%s)" msgstr "" -#: src/protocol_auth.c:175 +#: src/protocol_auth.c:153 #, c-format msgid "Generated random meta key (unencrypted): %s" msgstr "" -#: src/protocol_auth.c:187 src/protocol_auth.c:254 +#: src/protocol_auth.c:165 src/protocol_auth.c:238 #, c-format msgid "Error during encryption of meta key for %s (%s)" msgstr "" -#: src/protocol_auth.c:234 src/protocol_auth.c:367 src/protocol_auth.c:425 -#: src/protocol_auth.c:443 +#: src/protocol_auth.c:219 src/protocol_auth.c:348 src/protocol_auth.c:413 +#: src/protocol_auth.c:435 #, c-format msgid "Possible intruder %s (%s): %s" msgstr "" -#: src/protocol_auth.c:262 +#: src/protocol_auth.c:246 #, c-format msgid "Received random meta key (unencrypted): %s" msgstr "" -#: src/protocol_auth.c:274 +#: src/protocol_auth.c:257 #, c-format msgid "%s (%s) uses unknown cipher!" msgstr "" -#: src/protocol_auth.c:296 src/protocol_key.c:267 +#: src/protocol_auth.c:265 +#, c-format +msgid "Error during initialisation of cipher from %s (%s): %s" +msgstr "" + +#: src/protocol_auth.c:281 src/protocol_key.c:242 #, c-format msgid "Node %s (%s) uses unknown digest!" msgstr "" -#: src/protocol_auth.c:302 +#: src/protocol_auth.c:286 #, c-format msgid "%s (%s) uses bogus MAC length!" msgstr "" -#: src/protocol_auth.c:425 +#: src/protocol_auth.c:381 +#, c-format +msgid "Error during calculation of response for %s (%s): %s" +msgstr "" + +#: src/protocol_auth.c:414 msgid "wrong challenge reply length" msgstr "" -#: src/protocol_auth.c:443 +#: src/protocol_auth.c:427 +#, c-format +msgid "Error during calculation of response from %s (%s): %s" +msgstr "" + +#: src/protocol_auth.c:436 msgid "wrong challenge reply" msgstr "" -#: src/protocol_auth.c:448 +#: src/protocol_auth.c:441 #, c-format msgid "Expected challenge reply: %s" msgstr "" -#: src/protocol_auth.c:549 +#: src/protocol_auth.c:547 #, c-format msgid "Established a second connection with %s (%s), closing old connection" msgstr "" -#: src/protocol_auth.c:583 +#: src/protocol_auth.c:570 #, c-format msgid "Connection with %s (%s) activated" msgstr "" -#: src/protocol_edge.c:98 src/protocol_edge.c:104 src/protocol_edge.c:228 -#: src/protocol_edge.c:234 src/protocol_subnet.c:79 src/protocol_subnet.c:171 +#: src/protocol_edge.c:82 src/protocol_edge.c:88 src/protocol_edge.c:197 +#: src/protocol_edge.c:203 src/protocol_subnet.c:67 src/protocol_subnet.c:176 msgid "invalid name" msgstr "" -#: src/protocol_edge.c:150 +#: src/protocol_edge.c:127 #, c-format msgid "Got %s from %s (%s) for ourself which does not match existing entry" msgstr "" -#: src/protocol_edge.c:157 +#: src/protocol_edge.c:132 #, c-format msgid "Got %s from %s (%s) which does not match existing entry" msgstr "" -#: src/protocol_edge.c:167 +#: src/protocol_edge.c:140 #, c-format msgid "Got %s from %s (%s) for ourself which does not exist" msgstr "" -#: src/protocol_edge.c:248 src/protocol_edge.c:257 src/protocol_edge.c:268 +#: src/protocol_edge.c:215 src/protocol_edge.c:223 src/protocol_edge.c:236 #, c-format msgid "Got %s from %s (%s) which does not appear in the edge tree" msgstr "" -#: src/protocol_edge.c:275 src/protocol_subnet.c:118 src/protocol_subnet.c:217 +#: src/protocol_edge.c:242 src/protocol_subnet.c:103 src/protocol_subnet.c:219 #, c-format msgid "Got %s from %s (%s) for ourself" msgstr "" -#: src/protocol_key.c:92 +#: src/protocol_key.c:73 #, c-format msgid "Got %s from %s (%s) origin %s which does not exist" msgstr "" -#: src/protocol_key.c:137 src/protocol_key.c:205 +#: src/protocol_key.c:113 src/protocol_key.c:180 #, c-format msgid "" "Got %s from %s (%s) origin %s which does not exist in our connection list" msgstr "" -#: src/protocol_key.c:146 src/protocol_key.c:214 +#: src/protocol_key.c:121 src/protocol_key.c:188 #, c-format msgid "" "Got %s from %s (%s) destination %s which does not exist in our connection " "list" msgstr "" -#: src/protocol_key.c:246 +#: src/protocol_key.c:222 #, c-format msgid "Node %s (%s) uses unknown cipher!" msgstr "" -#: src/protocol_key.c:251 +#: src/protocol_key.c:228 #, c-format msgid "Node %s (%s) uses wrong keylength!" msgstr "" -#: src/protocol_key.c:272 +#: src/protocol_key.c:248 #, c-format msgid "Node %s (%s) uses bogus MAC length!" msgstr "" -#: src/protocol_misc.c:68 +#: src/protocol_key.c:257 #, c-format -msgid "Status message from %s (%s): %s: %s" +msgid "Node %s (%s) uses bogus compression level!" msgstr "" -#: src/protocol_misc.c:98 +#: src/protocol_key.c:265 #, c-format -msgid "Error message from %s (%s): %s: %s" +msgid "Error during initialisation of key from %s (%s): %s" msgstr "" -#: src/protocol_subnet.c:87 src/protocol_subnet.c:189 +#: src/protocol_misc.c:59 +#, c-format +msgid "Status message from %s (%s): %d: %s" +msgstr "" + +#: src/protocol_misc.c:88 +#, c-format +msgid "Error message from %s (%s): %d: %s" +msgstr "" + +#: src/protocol_subnet.c:75 src/protocol_subnet.c:197 msgid "invalid subnet string" msgstr "" -#: src/protocol_subnet.c:180 +#: src/protocol_subnet.c:185 #, c-format msgid "Got %s from %s (%s) for %s which is not in our node tree" msgstr "" -#: src/protocol_subnet.c:207 +#: src/protocol_subnet.c:211 #, c-format msgid "Got %s from %s (%s) for %s which does not appear in his subnet tree" msgstr "" -#: src/subnet.c:99 +#: src/subnet.c:103 #, c-format msgid "subnet_compare() was called with unknown subnet type %d, exitting!" msgstr "" -#: src/subnet.c:274 +#: src/subnet.c:281 #, c-format -msgid "net2str() was called with unknown subnet type %d, exitting!" +msgid "net2str() was called with unknown subnet type %d, exiting!" msgstr "" -#: src/subnet.c:384 +#: src/subnet.c:396 msgid "Subnet list:" msgstr "" -#: src/subnet.c:389 +#: src/subnet.c:402 #, c-format msgid " %s owner %s" msgstr "" -#: src/subnet.c:392 +#: src/subnet.c:405 msgid "End of subnet list." msgstr "" -#: src/tincd.c:100 +#: src/tincd.c:108 #, c-format msgid "Try `%s --help' for more information.\n" msgstr "" -#: src/tincd.c:103 +#: src/tincd.c:111 #, c-format msgid "" "Usage: %s [option]...\n" "\n" msgstr "" -#: src/tincd.c:104 +#: src/tincd.c:112 +#, c-format msgid "" " -c, --config=DIR Read configuration options from DIR.\n" " -D, --no-detach Don't fork and detach.\n" " -d, --debug[=LEVEL] Increase debug level or set it to LEVEL.\n" " -k, --kill[=SIGNAL] Attempt to kill a running tincd and exit.\n" " -n, --net=NETNAME Connect to net NETNAME.\n" -msgstr "" - -#: src/tincd.c:109 -msgid "" " -K, --generate-keys[=BITS] Generate public/private RSA keypair.\n" +" -L, --mlock Lock tinc into main memory.\n" +" --logfile[=FILENAME] Write log entries to a logfile.\n" +" --pidfile=FILENAME Write PID to FILENAME.\n" " --help Display this help and exit.\n" " --version Output version information and exit.\n" "\n" msgstr "" -#: src/tincd.c:112 -msgid "Report bugs to tinc@nl.linux.org.\n" +#: src/tincd.c:123 +#, c-format +msgid "Report bugs to tinc@tinc-vpn.org.\n" msgstr "" -#: src/tincd.c:166 +#: src/tincd.c:179 #, c-format msgid "" "Invalid argument `%s'; SIGNAL must be a number or one of HUP, TERM, KILL, " "USR1, USR2, WINCH, INT or ALRM.\n" msgstr "" -#: src/tincd.c:184 +#: src/tincd.c:201 #, c-format msgid "" "Invalid argument `%s'; BITS must be a number equal to or greater than 512.\n" msgstr "" -#: src/tincd.c:245 +#: src/tincd.c:294 #, c-format msgid "Generating %d bits keys:\n" msgstr "" -#: src/tincd.c:250 +#: src/tincd.c:298 +#, c-format msgid "Error during key generation!\n" msgstr "" -#: src/tincd.c:254 +#: src/tincd.c:301 +#, c-format msgid "Done.\n" msgstr "" -#: src/tincd.c:263 -msgid "public RSA key" +#: src/tincd.c:304 +msgid "private RSA key" msgstr "" -#: src/tincd.c:267 src/tincd.c:278 +#: src/tincd.c:315 src/tincd.c:334 +#, c-format msgid "" "Appending key to existing contents.\n" "Make sure only one key is stored in the file.\n" msgstr "" -#: src/tincd.c:274 -msgid "private RSA key" +#: src/tincd.c:328 +msgid "public RSA key" msgstr "" -#: src/tincd.c:299 +#: src/tincd.c:387 msgid "Both netname and configuration directory given, using the latter..." msgstr "" -#: src/tincd.c:328 +#: src/tincd.c:408 #, c-format msgid "%s version %s (built %s %s, protocol %d)\n" msgstr "" -#: src/tincd.c:329 +#: src/tincd.c:410 +#, c-format msgid "" -"Copyright (C) 1998-2002 Ivo Timmermans, Guus Sliepen and others.\n" +"Copyright (C) 1998-2004 Ivo Timmermans, Guus Sliepen and others.\n" "See the AUTHORS file for a complete list.\n" "\n" "tinc comes with ABSOLUTELY NO WARRANTY. This is free software,\n" @@ -867,366 +928,592 @@ msgid "" "see the file COPYING for details.\n" msgstr "" -#: src/tincd.c:386 -msgid "Unrecoverable error" +#: src/tincd.c:438 +msgid "mlockall() not supported on this platform!" msgstr "" -#: src/tincd.c:391 -#, c-format -msgid "Restarting in %d seconds!" +#: src/tincd.c:462 +msgid "Error initializing LZO compressor!" msgstr "" -#: src/process.c:373 src/tincd.c:396 -msgid "Not restarting." +#: src/tincd.c:503 +msgid "Terminating" msgstr "" -#: src/process.c:69 +#: src/process.c:54 #, c-format msgid "Memory exhausted (couldn't allocate %d bytes), exitting." msgstr "" -#: src/process.c:100 -msgid "Terminating" +#: src/process.c:79 src/process.c:129 +#, c-format +msgid "Could not open service manager: %s" +msgstr "" + +#: src/process.c:110 +#, c-format +msgid "Could not create %s service: %s" msgstr "" #: src/process.c:116 #, c-format -msgid "A tincd is already running for net `%s' with pid %d.\n" +msgid "%s service installed" msgstr "" #: src/process.c:119 #, c-format -msgid "A tincd is already running with pid %d.\n" +msgid "Could not start %s service: %s" msgstr "" -#: src/process.c:140 +#: src/process.c:121 +#, c-format +msgid "%s service started" +msgstr "" + +#: src/process.c:136 +#, c-format +msgid "Could not open %s service: %s" +msgstr "" + +#: src/process.c:141 +#, c-format +msgid "Could not stop %s service: %s" +msgstr "" + +#: src/process.c:143 +#, c-format +msgid "%s service stopped" +msgstr "" + +#: src/process.c:146 +#, c-format +msgid "Could not remove %s service: %s" +msgstr "" + +#: src/process.c:150 +#, c-format +msgid "%s service removed" +msgstr "" + +#: src/process.c:158 src/process.c:161 +#, c-format +msgid "Got %s request" +msgstr "" + +#: src/process.c:164 +#, c-format +msgid "Got unexpected request %d" +msgstr "" + +#: src/process.c:252 +#, c-format +msgid "A tincd is already running for net `%s' with pid %ld.\n" +msgstr "" + +#: src/process.c:255 +#, c-format +msgid "A tincd is already running with pid %ld.\n" +msgstr "" + +#: src/process.c:261 +#, c-format +msgid "Could write pid file %s: %s\n" +msgstr "" + +#: src/process.c:283 #, c-format msgid "No other tincd is running for net `%s'.\n" msgstr "" -#: src/process.c:142 +#: src/process.c:286 +#, c-format msgid "No other tincd is running.\n" msgstr "" -#: src/process.c:151 +#: src/process.c:295 #, c-format msgid "The tincd for net `%s' is no longer running. " msgstr "" -#: src/process.c:153 +#: src/process.c:298 +#, c-format msgid "The tincd is no longer running. " msgstr "" -#: src/process.c:155 +#: src/process.c:300 +#, c-format msgid "Removing stale lock file.\n" msgstr "" -#: src/process.c:183 +#: src/process.c:333 #, c-format msgid "Couldn't detach from terminal: %s" msgstr "" -#: src/process.c:196 +#: src/process.c:341 +#, c-format +msgid "Could not write pid file %s: %s\n" +msgstr "" + +#: src/process.c:352 #, c-format msgid "tincd %s (%s %s) starting, debug level %d" msgstr "" -#: src/process.c:199 -#, c-format -msgid "tincd %s starting" -msgstr "" - -#: src/process.c:280 +#: src/process.c:385 #, c-format msgid "Executing script %s" msgstr "" -#: src/process.c:290 +#: src/process.c:415 #, c-format -msgid "Process %d (%s) exited with non-zero status %d" +msgid "Script %s exited with non-zero status %d" msgstr "" -#: src/process.c:298 +#: src/process.c:420 #, c-format -msgid "Process %d (%s) was killed by signal %d (%s)" +msgid "Script %s was killed by signal %d (%s)" msgstr "" -#: src/process.c:304 +#: src/process.c:424 #, c-format -msgid "Process %d (%s) terminated abnormally" +msgid "Script %s terminated abnormally" msgstr "" -#: src/process.c:329 -msgid "Got TERM signal" +#: src/process.c:444 src/process.c:453 src/process.c:494 src/process.c:500 +#: src/process.c:518 +#, c-format +msgid "Got %s signal" msgstr "" -#: src/process.c:338 -msgid "Got QUIT signal" -msgstr "" - -#: src/process.c:345 +#: src/process.c:462 #, c-format msgid "Got another fatal signal %d (%s): not restarting." msgstr "" -#: src/process.c:354 +#: src/process.c:471 #, c-format msgid "Got fatal signal %d (%s)" msgstr "" -#: src/process.c:359 +#: src/process.c:475 msgid "Trying to re-execute in 5 seconds..." msgstr "" -#: src/process.c:382 -msgid "Got HUP signal" +#: src/process.c:487 +msgid "Not restarting." msgstr "" -#: src/process.c:391 +#: src/process.c:503 #, c-format msgid "Reverting to old debug level (%d)" msgstr "" -#: src/process.c:398 +#: src/process.c:509 #, c-format msgid "" "Temporarily setting debug level to 5. Kill me with SIGINT again to go back " "to level %d." msgstr "" -#: src/process.c:409 -msgid "Got ALRM signal" -msgstr "" - -#: src/process.c:438 +#: src/process.c:542 #, c-format msgid "Got unexpected signal %d (%s)" msgstr "" -#: src/process.c:447 +#: src/process.c:548 #, c-format msgid "Ignored signal %d (%s)" msgstr "" -#: src/process.c:504 +#: src/process.c:602 #, c-format msgid "Installing signal handler for signal %d (%s) failed: %s\n" msgstr "" -#: src/route.c:73 +#: src/route.c:111 #, c-format msgid "Learned new MAC address %hx:%hx:%hx:%hx:%hx:%hx" msgstr "" -#: src/route.c:107 +#: src/route.c:149 #, c-format -msgid "MAC address %hx:%hx:%hx:%hx:%hx:%hx expired" +msgid "Subnet %s expired" msgstr "" -#: src/route.c:152 +#: src/route.c:184 src/route.c:337 src/route.c:479 #, c-format -msgid "Cannot route packet: unknown IPv4 destination address %d.%d.%d.%d" +msgid "Packet looping back to %s (%s)!" msgstr "" -#: src/route.c:172 +#: src/route.c:283 +#, c-format +msgid "Length of packet (%d) doesn't match length in IPv4 header (%d)" +msgstr "" + +#: src/route.c:287 +#, c-format +msgid "Fragmenting packet of %d bytes to %s (%s)" +msgstr "" + +#: src/route.c:325 #, c-format msgid "" -"Cannot route packet: unknown IPv6 destination address %hx:%hx:%hx:%hx:%hx:%" -"hx:%hx:%hx" +"Cannot route packet from %s (%s): unknown IPv4 destination address %d.%d.%d.%" +"d" msgstr "" -#: src/route.c:233 +#: src/route.c:350 src/route.c:489 +#, c-format +msgid "Packet for %s (%s) length %d larger than MTU %d" +msgstr "" + +#: src/route.c:463 +#, c-format +msgid "" +"Cannot route packet from %s (%s): unknown IPv6 destination address %hx:%hx:%" +"hx:%hx:%hx:%hx:%hx:%hx" +msgstr "" + +#: src/route.c:521 +#, c-format +msgid "Got neighbor solicitation request from %s (%s) while in router mode!" +msgstr "" + +#: src/route.c:540 msgid "" "Cannot route packet: received unknown type neighbor solicitation request" msgstr "" -#: src/route.c:254 +#: src/route.c:559 msgid "Cannot route packet: checksum error for neighbor solicitation request" msgstr "" -#: src/route.c:266 +#: src/route.c:568 #, c-format msgid "" "Cannot route packet: neighbor solicitation request for unknown address %hx:%" "hx:%hx:%hx:%hx:%hx:%hx:%hx" msgstr "" -#: src/route.c:341 +#: src/route.c:655 +#, c-format +msgid "Got ARP request from %s (%s) while in router mode!" +msgstr "" + +#: src/route.c:672 msgid "Cannot route packet: received unknown type ARP request" msgstr "" -#: src/route.c:354 +#: src/route.c:681 #, c-format msgid "Cannot route packet: ARP request for unknown address %d.%d.%d.%d" msgstr "" -#: src/route.c:411 +#: src/route.c:737 #, c-format -msgid "Cannot route packet: unknown type %hx" +msgid "Cannot route packet from %s (%s): unknown type %hx" msgstr "" -#: src/node.c:161 +#: src/node.c:183 msgid "Nodes:" msgstr "" -#: src/node.c:166 +#: src/node.c:187 #, c-format msgid "" " %s at %s cipher %d digest %d maclength %d compression %d options %lx status " -"%04x nexthop %s via %s" +"%04x nexthop %s via %s pmtu %d (min %d max %d)" msgstr "" -#: src/node.c:171 +#: src/node.c:194 msgid "End of nodes." msgstr "" -#: src/edge.c:194 +#: src/edge.c:148 msgid "Edges:" msgstr "" -#: src/edge.c:201 +#: src/edge.c:155 #, c-format -msgid " %s at %s - %s at %s options %lx weight %d" +msgid " %s to %s at %s options %lx weight %d" msgstr "" -#: src/edge.c:209 +#: src/edge.c:161 msgid "End of edges." msgstr "" -#: src/graph.c:261 +#: src/graph.c:263 #, c-format msgid "Node %s (%s) became reachable" msgstr "" -#: src/graph.c:273 +#: src/graph.c:266 #, c-format msgid "Node %s (%s) became unreachable" msgstr "" -#: src/freebsd/device.c:70 src/linux/device.c:89 src/netbsd/device.c:74 -#: src/openbsd/device.c:74 src/solaris/device.c:75 +#: src/linux/device.c:76 src/solaris/device.c:57 src/bsd/device.c:63 +#: src/raw_socket/device.c:59 src/uml_socket/device.c:122 #, c-format msgid "Could not open %s: %s" msgstr "" -#: src/linux/device.c:114 src/linux/device.c:124 -msgid "Linux tun/tap device" +#: src/linux/device.c:87 +msgid "Linux tun/tap device (tun mode)" msgstr "" -#: src/linux/device.c:122 +#: src/linux/device.c:91 +msgid "Linux tun/tap device (tap mode)" +msgstr "" + +#: src/linux/device.c:101 #, c-format msgid "Old ioctl() request was needed for %s" msgstr "" -#: src/linux/device.c:131 +#: src/linux/device.c:109 msgid "Linux ethertap device" msgstr "" -#: src/freebsd/device.c:87 src/linux/device.c:136 src/netbsd/device.c:90 -#: src/openbsd/device.c:90 src/solaris/device.c:132 +#: src/linux/device.c:114 src/solaris/device.c:106 src/bsd/device.c:133 +#: src/raw_socket/device.c:83 src/uml_socket/device.c:149 #, c-format msgid "%s is a %s" msgstr "" -#: src/freebsd/device.c:108 src/linux/device.c:159 src/linux/device.c:169 -#: src/netbsd/device.c:111 src/openbsd/device.c:111 src/solaris/device.c:149 +#: src/linux/device.c:137 src/linux/device.c:148 src/linux/device.c:159 +#: src/solaris/device.c:125 src/bsd/device.c:152 src/bsd/device.c:181 +#: src/bsd/device.c:210 src/cygwin/device.c:239 src/mingw/device.c:103 +#: src/mingw/device.c:303 src/raw_socket/device.c:102 +#: src/uml_socket/device.c:239 #, c-format msgid "Error while reading from %s %s: %s" msgstr "" -#: src/freebsd/device.c:117 src/linux/device.c:180 src/netbsd/device.c:126 -#: src/openbsd/device.c:140 src/solaris/device.c:164 +#: src/linux/device.c:170 src/solaris/device.c:150 src/bsd/device.c:224 +#: src/cygwin/device.c:248 src/mingw/device.c:312 src/raw_socket/device.c:111 +#: src/uml_socket/device.c:249 #, c-format msgid "Read packet of %d bytes from %s" msgstr "" -#: src/freebsd/device.c:128 src/linux/device.c:191 src/netbsd/device.c:139 -#: src/openbsd/device.c:154 src/solaris/device.c:175 +#: src/linux/device.c:180 src/solaris/device.c:160 src/bsd/device.c:234 +#: src/cygwin/device.c:260 src/mingw/device.c:325 src/raw_socket/device.c:121 +#: src/uml_socket/device.c:267 #, c-format msgid "Writing packet of %d bytes to %s" msgstr "" -#: src/linux/device.c:198 src/linux/device.c:207 src/netbsd/device.c:149 -#: src/openbsd/device.c:180 src/solaris/device.c:180 +#: src/linux/device.c:187 src/linux/device.c:194 src/linux/device.c:203 +#: src/solaris/device.c:164 src/bsd/device.c:268 src/raw_socket/device.c:125 +#: src/uml_socket/device.c:272 #, c-format msgid "Can't write to %s %s: %s" msgstr "" -#: src/freebsd/device.c:144 src/linux/device.c:220 src/netbsd/device.c:160 -#: src/openbsd/device.c:191 src/solaris/device.c:192 +#: src/linux/device.c:219 src/solaris/device.c:178 src/bsd/device.c:296 +#: src/cygwin/device.c:277 src/mingw/device.c:342 src/raw_socket/device.c:139 +#: src/uml_socket/device.c:288 #, c-format msgid "Statistics for %s %s:" msgstr "" -#: src/freebsd/device.c:145 src/linux/device.c:221 src/netbsd/device.c:161 -#: src/openbsd/device.c:192 src/solaris/device.c:193 +#: src/linux/device.c:220 src/solaris/device.c:179 src/bsd/device.c:297 +#: src/cygwin/device.c:278 src/mingw/device.c:343 src/raw_socket/device.c:140 +#: src/uml_socket/device.c:289 #, c-format msgid " total bytes in: %10d" msgstr "" -#: src/freebsd/device.c:146 src/linux/device.c:222 src/netbsd/device.c:162 -#: src/openbsd/device.c:193 src/solaris/device.c:194 +#: src/linux/device.c:221 src/solaris/device.c:180 src/bsd/device.c:298 +#: src/cygwin/device.c:279 src/mingw/device.c:344 src/raw_socket/device.c:141 +#: src/uml_socket/device.c:290 #, c-format msgid " total bytes out: %10d" msgstr "" -#: src/freebsd/device.c:85 -msgid "FreeBSD tap device" -msgstr "" - -#: src/freebsd/device.c:133 -#, c-format -msgid "Error while writing to %s %s: %s" -msgstr "" - -#: src/solaris/device.c:86 +#: src/solaris/device.c:69 #, c-format msgid "Could not open /dev/ip: %s" msgstr "" -#: src/solaris/device.c:92 +#: src/solaris/device.c:75 #, c-format msgid "Can't assign new interface: %s" msgstr "" -#: src/solaris/device.c:97 +#: src/solaris/device.c:80 #, c-format msgid "Could not open %s twice: %s" msgstr "" -#: src/solaris/device.c:102 +#: src/solaris/device.c:86 #, c-format msgid "Can't push IP module: %s" msgstr "" -#: src/solaris/device.c:108 +#: src/solaris/device.c:92 #, c-format msgid "Can't set PPA %d: %s" msgstr "" -#: src/solaris/device.c:113 +#: src/solaris/device.c:97 #, c-format msgid "Can't link TUN device to IP: %s" msgstr "" -#: src/solaris/device.c:120 +#: src/solaris/device.c:104 msgid "Solaris tun device" msgstr "" -#: src/netbsd/device.c:88 -msgid "NetBSD tun device" -msgstr "" - -#: src/openbsd/device.c:88 -msgid "OpenBSD tun device" -msgstr "" - -#: src/openbsd/device.c:130 +#: src/solaris/device.c:141 src/bsd/device.c:168 #, c-format -msgid "Unknown address family %d while reading packet from %s %s" +msgid "Unknown IP version %d while reading packet from %s %s" msgstr "" -#: src/openbsd/device.c:169 +#: src/bsd/device.c:77 #, c-format -msgid "Unknown address family %d while writing packet to %s %s" +msgid "Unknown device type %s!" +msgstr "" + +#: src/bsd/device.c:105 src/bsd/device.c:124 +msgid "Generic BSD tun device" +msgstr "" + +#: src/bsd/device.c:129 +msgid "Generic BSD tap device" +msgstr "" + +#: src/bsd/device.c:199 +#, c-format +msgid "Unknown address family %x while reading packet from %s %s" +msgstr "" + +#: src/bsd/device.c:240 src/bsd/device.c:277 src/cygwin/device.c:264 +#: src/mingw/device.c:329 +#, c-format +msgid "Error while writing to %s %s: %s" +msgstr "" + +#: src/bsd/device.c:262 +#, c-format +msgid "Unknown address family %x while writing packet to %s %s" +msgstr "" + +#: src/cygwin/device.c:71 src/mingw/device.c:147 +#, c-format +msgid "Unable to read registry: %s" +msgstr "" + +#: src/cygwin/device.c:123 src/mingw/device.c:198 +msgid "No Windows tap device found!" +msgstr "" + +#: src/cygwin/device.c:149 +#, c-format +msgid "Could not open Windows tap device %s (%s) for writing: %s" +msgstr "" + +#: src/cygwin/device.c:158 src/mingw/device.c:223 +#, c-format +msgid "Could not get MAC address from Windows tap device %s (%s): %s" +msgstr "" + +#: src/cygwin/device.c:187 +#, c-format +msgid "Could not open Windows tap device %s (%s) for reading: %s" +msgstr "" + +#: src/cygwin/device.c:193 +msgid "Tap reader forked and running." +msgstr "" + +#: src/cygwin/device.c:210 +msgid "Tap reader failed!" +msgstr "" + +#: src/cygwin/device.c:214 src/mingw/device.c:282 +msgid "Windows tap device" +msgstr "" + +#: src/cygwin/device.c:216 src/mingw/device.c:284 +#, c-format +msgid "%s (%s) is a %s" +msgstr "" + +#: src/mingw/device.c:84 +msgid "Tap reader running" +msgstr "" + +#: src/mingw/device.c:216 +#, c-format +msgid "%s (%s) is not a usable Windows tap device: %s" +msgstr "" + +#: src/raw_socket/device.c:56 +msgid "raw socket" +msgstr "" + +#: src/raw_socket/device.c:68 +#, c-format +msgid "Can't find interface %s: %s" +msgstr "" + +#: src/raw_socket/device.c:79 src/uml_socket/device.c:137 +#, c-format +msgid "Could not bind %s to %s: %s" +msgstr "" + +#: src/uml_socket/device.c:78 +msgid "UML network socket" +msgstr "" + +#: src/uml_socket/device.c:81 +#, c-format +msgid "Could not open write %s: %s" +msgstr "" + +#: src/uml_socket/device.c:95 +#, c-format +msgid "Could not open data %s: %s" +msgstr "" + +#: src/uml_socket/device.c:116 +#, c-format +msgid "Could not bind data %s: %s" +msgstr "" + +#: src/uml_socket/device.c:142 +#, c-format +msgid "Could not listen on %s %s: %s" +msgstr "" + +#: src/uml_socket/device.c:189 +#, c-format +msgid "Could not accept connection to %s %s: %s" +msgstr "" + +#: src/uml_socket/device.c:209 +#, c-format +msgid "Error while reading request from %s %s: %s" +msgstr "" + +#: src/uml_socket/device.c:216 +#, c-format +msgid "Unknown magic %x, version %d, request type %d from %s %s" +msgstr "" + +#: src/uml_socket/device.c:223 +#, c-format +msgid "Could not bind write %s: %s" +msgstr "" + +#: src/uml_socket/device.c:231 +msgid "Connection with UML established" +msgstr "" + +#: src/uml_socket/device.c:262 +#, c-format +msgid "Dropping packet of %d bytes to %s: not connected to UML yet" msgstr "" diff --git a/src/Makefile.am b/src/Makefile.am index 32aee66..10f07af 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,31 +1,31 @@ ## Produce this file with automake to get Makefile.in -# $Id: Makefile.am,v 1.4.4.21 2002/03/27 15:47:06 guus Exp $ +# $Id: Makefile.am,v 1.4.4.33 2003/08/02 15:13:08 guus Exp $ sbin_PROGRAMS = tincd -EXTRA_DIST = linux/device.c freebsd/device.c openbsd/device.c solaris/device.c +EXTRA_DIST = linux/device.c bsd/device.c solaris/device.c cygwin/device.c mingw/device.c mingw/common.h raw_socket/device.c uml_socket/device.c -tincd_SOURCES = conf.c connection.c device.c edge.c event.c graph.c meta.c net.c net_packet.c net_setup.c \ +tincd_SOURCES = conf.c connection.c edge.c event.c graph.c logger.c meta.c net.c net_packet.c net_setup.c \ net_socket.c netutl.c node.c process.c protocol.c protocol_auth.c protocol_edge.c protocol_misc.c \ protocol_key.c protocol_subnet.c route.c subnet.c tincd.c -INCLUDES = @INCLUDES@ -I$(top_builddir) -I$(top_srcdir)/lib -I$(top_srcdir)/intl +nodist_tincd_SOURCES = device.c -noinst_HEADERS = conf.h connection.h device.h edge.h event.h graph.h meta.h net.h netutl.h node.h process.h \ +DEFAULT_INCLUDES = + +INCLUDES = @INCLUDES@ -I$(top_builddir) -I$(top_srcdir)/lib + +noinst_HEADERS = conf.h connection.h device.h edge.h event.h graph.h logger.h meta.h net.h netutl.h node.h process.h \ protocol.h route.h subnet.h -LIBS = @LIBS@ @INTLLIBS@ +LIBS = @LIBS@ @LIBINTL@ tincd_LDADD = \ $(top_builddir)/lib/libvpn.a localedir = $(datadir)/locale -CFLAGS = @CFLAGS@ -DPKGLIBDIR=$(pkglibdir) -DCONFDIR=\"$(sysconfdir)\" \ - -DLOCALEDIR=\"$(localedir)\" -DLOCALSTATEDIR=\"$(localstatedir)\" +AM_CFLAGS = @CFLAGS@ -DCONFDIR=\"$(sysconfdir)\" -DLOCALEDIR=\"$(localedir)\" -DLOCALSTATEDIR=\"$(localstatedir)\" dist-hook: rm -f `find . -type l` - -lint: $(tincd_SOURCES) - lclint -nullassign -nullret +trytorecover +posixlib -skipansiheaders -skipposixheaders +gnuextensions -I/usr/include -I/usr/lib/gcc-lib/i386-linux/2.95.2/include -I. -I/home/zarq/p/tinc/cvs/cabal/src -I.. -I.. -I/home/zarq/p/tinc/cvs/cabal/lib -I/home/zarq/p/tinc/cvs/cabal/intl -D_POSIX_SOURCE -D__ELF__ -Dunix -D__i386__ -Dlinux -DHAVE_CONFIG_H -DPKGLIBDIR=/usr/local/lib/tinc -DCONFDIR=\"/usr/local/etc\" -DLOCALEDIR=\"/usr/local/share/locale\" $^ diff --git a/src/Makefile.in b/src/Makefile.in index 8e07167..4725086 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,7 +1,8 @@ -# Makefile.in generated automatically by automake 1.5 from Makefile.am. +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -13,194 +14,259 @@ @SET_MAKE@ -# $Id: Makefile.am,v 1.4.4.21 2002/03/27 15:47:06 guus Exp $ +# $Id: Makefile.am,v 1.4.4.33 2003/08/02 15:13:08 guus Exp $ -SHELL = @SHELL@ + +SOURCES = $(tincd_SOURCES) $(nodist_tincd_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) -transform = @program_transform_name@ +transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -host_alias = @host_alias@ host_triplet = @host@ -AMTAR = @AMTAR@ -AWK = @AWK@ -BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CPP = @CPP@ -DATADIRNAME = @DATADIRNAME@ -DEPDIR = @DEPDIR@ -EXEEXT = @EXEEXT@ -GENCAT = @GENCAT@ -GLIBC21 = @GLIBC21@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -HAVE_TUNTAP = @HAVE_TUNTAP@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLBISON = @INTLBISON@ -INTLLIBS = @INTLLIBS@ -INTLOBJS = @INTLOBJS@ -INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ -LIBICONV = @LIBICONV@ -LINUX_IF_TUN_H = @LINUX_IF_TUN_H@ -LN_S = @LN_S@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PERL = @PERL@ -POFILES = @POFILES@ -POSUB = @POSUB@ -RANLIB = @RANLIB@ -USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ -USE_NLS = @USE_NLS@ -VERSION = @VERSION@ -am__include = @am__include@ -am__quote = @am__quote@ -install_sh = @install_sh@ - -INCLUDES = @INCLUDES@ -I$(top_builddir) -I$(top_srcdir)/lib -I$(top_srcdir)/intl - -sbin_PROGRAMS = tincd - -EXTRA_DIST = linux/device.c freebsd/device.c openbsd/device.c solaris/device.c - -tincd_SOURCES = conf.c connection.c device.c edge.c event.c graph.c meta.c net.c net_packet.c net_setup.c \ - net_socket.c netutl.c node.c process.c protocol.c protocol_auth.c protocol_edge.c protocol_misc.c \ - protocol_key.c protocol_subnet.c route.c subnet.c tincd.c - - -noinst_HEADERS = conf.h connection.h device.h edge.h event.h graph.h meta.h net.h netutl.h node.h process.h \ - protocol.h route.h subnet.h - - -LIBS = @LIBS@ @INTLLIBS@ - -tincd_LDADD = \ - $(top_builddir)/lib/libvpn.a - - -localedir = $(datadir)/locale - -CFLAGS = @CFLAGS@ -DPKGLIBDIR=$(pkglibdir) -DCONFDIR=\"$(sysconfdir)\" \ - -DLOCALEDIR=\"$(localedir)\" -DLOCALSTATEDIR=\"$(localstatedir)\" - +sbin_PROGRAMS = tincd$(EXEEXT) subdir = src +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \ + $(top_srcdir)/m4/attribute.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/lzo.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/openssl.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/tuntap.m4 \ + $(top_srcdir)/m4/zlib.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = -sbin_PROGRAMS = tincd$(EXEEXT) +am__installdirs = "$(DESTDIR)$(sbindir)" +sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(sbin_PROGRAMS) - -am_tincd_OBJECTS = conf.$(OBJEXT) connection.$(OBJEXT) device.$(OBJEXT) \ - edge.$(OBJEXT) event.$(OBJEXT) graph.$(OBJEXT) meta.$(OBJEXT) \ - net.$(OBJEXT) net_packet.$(OBJEXT) net_setup.$(OBJEXT) \ - net_socket.$(OBJEXT) netutl.$(OBJEXT) node.$(OBJEXT) \ - process.$(OBJEXT) protocol.$(OBJEXT) protocol_auth.$(OBJEXT) \ - protocol_edge.$(OBJEXT) protocol_misc.$(OBJEXT) \ - protocol_key.$(OBJEXT) protocol_subnet.$(OBJEXT) \ - route.$(OBJEXT) subnet.$(OBJEXT) tincd.$(OBJEXT) -tincd_OBJECTS = $(am_tincd_OBJECTS) +am_tincd_OBJECTS = conf.$(OBJEXT) connection.$(OBJEXT) edge.$(OBJEXT) \ + event.$(OBJEXT) graph.$(OBJEXT) logger.$(OBJEXT) \ + meta.$(OBJEXT) net.$(OBJEXT) net_packet.$(OBJEXT) \ + net_setup.$(OBJEXT) net_socket.$(OBJEXT) netutl.$(OBJEXT) \ + node.$(OBJEXT) process.$(OBJEXT) protocol.$(OBJEXT) \ + protocol_auth.$(OBJEXT) protocol_edge.$(OBJEXT) \ + protocol_misc.$(OBJEXT) protocol_key.$(OBJEXT) \ + protocol_subnet.$(OBJEXT) route.$(OBJEXT) subnet.$(OBJEXT) \ + tincd.$(OBJEXT) +nodist_tincd_OBJECTS = device.$(OBJEXT) +tincd_OBJECTS = $(am_tincd_OBJECTS) $(nodist_tincd_OBJECTS) tincd_DEPENDENCIES = $(top_builddir)/lib/libvpn.a -tincd_LDFLAGS = - -DEFS = @DEFS@ -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ depcomp = $(SHELL) $(top_srcdir)/depcomp -@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/conf.Po $(DEPDIR)/connection.Po \ -@AMDEP_TRUE@ $(DEPDIR)/device.Po $(DEPDIR)/edge.Po \ -@AMDEP_TRUE@ $(DEPDIR)/event.Po $(DEPDIR)/graph.Po \ -@AMDEP_TRUE@ $(DEPDIR)/meta.Po $(DEPDIR)/net.Po \ -@AMDEP_TRUE@ $(DEPDIR)/net_packet.Po $(DEPDIR)/net_setup.Po \ -@AMDEP_TRUE@ $(DEPDIR)/net_socket.Po $(DEPDIR)/netutl.Po \ -@AMDEP_TRUE@ $(DEPDIR)/node.Po $(DEPDIR)/process.Po \ -@AMDEP_TRUE@ $(DEPDIR)/protocol.Po $(DEPDIR)/protocol_auth.Po \ -@AMDEP_TRUE@ $(DEPDIR)/protocol_edge.Po \ -@AMDEP_TRUE@ $(DEPDIR)/protocol_key.Po \ -@AMDEP_TRUE@ $(DEPDIR)/protocol_misc.Po \ -@AMDEP_TRUE@ $(DEPDIR)/protocol_subnet.Po $(DEPDIR)/route.Po \ -@AMDEP_TRUE@ $(DEPDIR)/subnet.Po $(DEPDIR)/tincd.Po +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/conf.Po ./$(DEPDIR)/connection.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/device.Po ./$(DEPDIR)/edge.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/event.Po ./$(DEPDIR)/graph.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/logger.Po ./$(DEPDIR)/meta.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/net.Po ./$(DEPDIR)/net_packet.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/net_setup.Po ./$(DEPDIR)/net_socket.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/netutl.Po ./$(DEPDIR)/node.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/process.Po ./$(DEPDIR)/protocol.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/protocol_auth.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/protocol_edge.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/protocol_key.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/protocol_misc.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/protocol_subnet.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/route.Po ./$(DEPDIR)/subnet.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/tincd.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(tincd_SOURCES) $(nodist_tincd_SOURCES) DIST_SOURCES = $(tincd_SOURCES) HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GMSGFMT = @GMSGFMT@ +HAVE_TUNTAP = @HAVE_TUNTAP@ +INCLUDES = @INCLUDES@ -I$(top_builddir) -I$(top_srcdir)/lib +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ @LIBINTL@ +LINUX_IF_TUN_H = @LINUX_IF_TUN_H@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +EXTRA_DIST = linux/device.c bsd/device.c solaris/device.c cygwin/device.c mingw/device.c mingw/common.h raw_socket/device.c uml_socket/device.c +tincd_SOURCES = conf.c connection.c edge.c event.c graph.c logger.c meta.c net.c net_packet.c net_setup.c \ + net_socket.c netutl.c node.c process.c protocol.c protocol_auth.c protocol_edge.c protocol_misc.c \ + protocol_key.c protocol_subnet.c route.c subnet.c tincd.c -DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in -SOURCES = $(tincd_SOURCES) +nodist_tincd_SOURCES = device.c +DEFAULT_INCLUDES = +noinst_HEADERS = conf.h connection.h device.h edge.h event.h graph.h logger.h meta.h net.h netutl.h node.h process.h \ + protocol.h route.h subnet.h +tincd_LDADD = \ + $(top_builddir)/lib/libvpn.a + +localedir = $(datadir)/locale +AM_CFLAGS = @CFLAGS@ -DCONFDIR=\"$(sysconfdir)\" -DLOCALEDIR=\"$(localedir)\" -DLOCALSTATEDIR=\"$(localstatedir)\" all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && \ - CONFIG_HEADERS= CONFIG_LINKS= \ - CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-sbinPROGRAMS: $(sbin_PROGRAMS) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(sbindir) + test -z "$(sbindir)" || $(mkdir_p) "$(DESTDIR)$(sbindir)" @list='$(sbin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ ; then \ - f=`echo $$p1|sed '$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/$$f"; \ - $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/$$f; \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \ else :; fi; \ done uninstall-sbinPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(sbin_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f $(DESTDIR)$(sbindir)/$$f"; \ - rm -f $(DESTDIR)$(sbindir)/$$f; \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \ + rm -f "$(DESTDIR)$(sbindir)/$$f"; \ done clean-sbinPROGRAMS: @@ -210,100 +276,123 @@ tincd$(EXEEXT): $(tincd_OBJECTS) $(tincd_DEPENDENCIES) $(LINK) $(tincd_LDFLAGS) $(tincd_OBJECTS) $(tincd_LDADD) $(LIBS) mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core + -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/conf.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/connection.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/device.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/edge.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/event.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/graph.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/meta.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/net.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/net_packet.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/net_setup.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/net_socket.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/netutl.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/node.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/process.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/protocol.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/protocol_auth.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/protocol_edge.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/protocol_key.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/protocol_misc.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/protocol_subnet.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/route.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/subnet.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/tincd.Po@am__quote@ - -distclean-depend: - -rm -rf $(DEPDIR) +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/connection.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edge.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/event.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/graph.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logger.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/meta.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/net.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/net_packet.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/net_setup.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/net_socket.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netutl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/node.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/process.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protocol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protocol_auth.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protocol_edge.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protocol_key.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protocol_misc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protocol_subnet.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/route.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/subnet.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tincd.Po@am__quote@ .c.o: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c `cygpath -w $<` -CCDEPMODE = @CCDEPMODE@ +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` uninstall-info-am: -tags: TAGS - ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - mkid -fID $$unique $(LISP) + mkid -fID $$unique +tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique GTAGS: - here=`CDPATH=: && cd $(top_builddir) && pwd` \ + here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = .. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - $(mkinstalldirs) $(distdir)/freebsd $(distdir)/linux $(distdir)/openbsd $(distdir)/solaris - @for file in $(DISTFILES); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ + $(mkdir_p) $(distdir)/bsd $(distdir)/cygwin $(distdir)/linux $(distdir)/mingw $(distdir)/raw_socket $(distdir)/solaris $(distdir)/uml_socket + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - $(mkinstalldirs) "$(distdir)/$$dir"; \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ fi; \ if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir) \ - || exit 1; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ @@ -311,15 +400,15 @@ distdir: $(DISTFILES) fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="${top_distdir}" distdir="$(distdir)" \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(HEADERS) - installdirs: - $(mkinstalldirs) $(DESTDIR)$(sbindir) - + for dir in "$(DESTDIR)$(sbindir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done install: install-am install-exec: install-exec-am install-data: install-data-am @@ -331,6 +420,7 @@ install-am: all-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: @@ -338,7 +428,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* + -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -348,14 +438,17 @@ clean: clean-am clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am distclean: distclean-am - -distclean-am: clean-am distclean-compile distclean-depend \ - distclean-generic distclean-tags + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags dvi: dvi-am dvi-am: +html: html-am + info: info-am info-am: @@ -371,32 +464,38 @@ install-man: installcheck-am: maintainer-clean: maintainer-clean-am - + -rm -rf ./$(DEPDIR) + -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + uninstall-am: uninstall-info-am uninstall-sbinPROGRAMS -.PHONY: GTAGS all all-am check check-am clean clean-generic \ - clean-sbinPROGRAMS distclean distclean-compile distclean-depend \ - distclean-generic distclean-tags distdir dvi dvi-am info \ - info-am install install-am install-data install-data-am \ - install-exec install-exec-am install-info install-info-am \ - install-man install-sbinPROGRAMS install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-sbinPROGRAMS ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-sbinPROGRAMS install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic tags uninstall uninstall-am \ - uninstall-info-am uninstall-sbinPROGRAMS + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-info-am uninstall-sbinPROGRAMS dist-hook: rm -f `find . -type l` - -lint: $(tincd_SOURCES) - lclint -nullassign -nullret +trytorecover +posixlib -skipansiheaders -skipposixheaders +gnuextensions -I/usr/include -I/usr/lib/gcc-lib/i386-linux/2.95.2/include -I. -I/home/zarq/p/tinc/cvs/cabal/src -I.. -I.. -I/home/zarq/p/tinc/cvs/cabal/lib -I/home/zarq/p/tinc/cvs/cabal/intl -D_POSIX_SOURCE -D__ELF__ -Dunix -D__i386__ -Dlinux -DHAVE_CONFIG_H -DPKGLIBDIR=/usr/local/lib/tinc -DCONFDIR=\"/usr/local/etc\" -DLOCALEDIR=\"/usr/local/share/locale\" $^ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/src/bsd/device.c b/src/bsd/device.c new file mode 100644 index 0000000..5e7a198 --- /dev/null +++ b/src/bsd/device.c @@ -0,0 +1,299 @@ +/* + device.c -- Interaction BSD tun/tap device + Copyright (C) 2001-2004 Ivo Timmermans , + 2001-2004 Guus Sliepen + + 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., 675 Mass Ave, Cambridge, MA 02139, USA. + + $Id: device.c 1398 2004-11-01 15:18:53Z guus $ +*/ + +#include "system.h" + +#include "conf.h" +#include "logger.h" +#include "net.h" +#include "route.h" +#include "utils.h" + +#define DEFAULT_DEVICE "/dev/tun0" + +typedef enum device_type { + DEVICE_TYPE_TUN, + DEVICE_TYPE_TUNIFHEAD, + DEVICE_TYPE_TAP, +} device_type_t; + +int device_fd = -1; +char *device; +char *iface; +char *device_info; +static int device_total_in = 0; +static int device_total_out = 0; +#ifdef HAVE_OPENBSD +static device_type_t device_type = DEVICE_TYPE_TUNIFHEAD; +#else +static device_type_t device_type = DEVICE_TYPE_TUN; +#endif + +bool setup_device(void) { + char *type; + + cp(); + + if(!get_config_string(lookup_config(config_tree, "Device"), &device)) + device = DEFAULT_DEVICE; + + if(!get_config_string(lookup_config(config_tree, "Interface"), &iface)) + iface = rindex(device, '/') ? rindex(device, '/') + 1 : device; + + if((device_fd = open(device, O_RDWR | O_NONBLOCK)) < 0) { + logger(LOG_ERR, _("Could not open %s: %s"), device, strerror(errno)); + return false; + } + + if(get_config_string(lookup_config(config_tree, "DeviceType"), &type)) { + if(!strcasecmp(type, "tun")) + /* use default */; + else if(!strcasecmp(type, "tunnohead")) + device_type = DEVICE_TYPE_TUN; + else if(!strcasecmp(type, "tunifhead")) + device_type = DEVICE_TYPE_TUNIFHEAD; + else if(!strcasecmp(type, "tap")) + device_type = DEVICE_TYPE_TAP; + else { + logger(LOG_ERR, _("Unknown device type %s!"), type); + return false; + } + } else { + if(strstr(device, "tap")) + device_type = DEVICE_TYPE_TAP; + } + + switch(device_type) { + default: + device_type = DEVICE_TYPE_TUN; + case DEVICE_TYPE_TUN: +#ifdef TUNSIFHEAD + { + const int zero = 0; + if(ioctl(device_fd, TUNSIFHEAD, &zero, sizeof zero) == -1) { + logger(LOG_ERR, _("System call `%s' failed: %s"), "ioctl", strerror(errno)); + return false; + } + } +#endif +#if defined(TUNSIFMODE) && defined(IFF_BROADCAST) && defined(IFF_MULTICAST) + { + const int mode = IFF_BROADCAST | IFF_MULTICAST; + ioctl(device_fd, TUNSIFMODE, &mode, sizeof mode); + } +#endif + + device_info = _("Generic BSD tun device"); + break; + case DEVICE_TYPE_TUNIFHEAD: +#ifdef TUNSIFHEAD + { + const int one = 1; + if(ioctl(device_fd, TUNSIFHEAD, &one, sizeof one) == -1) { + logger(LOG_ERR, _("System call `%s' failed: %s"), "ioctl", strerror(errno)); + return false; + } + } +#endif +#if defined(TUNSIFMODE) && defined(IFF_BROADCAST) && defined(IFF_MULTICAST) + { + const int mode = IFF_BROADCAST | IFF_MULTICAST; + ioctl(device_fd, TUNSIFMODE, &mode, sizeof mode); + } +#endif + + device_info = _("Generic BSD tun device"); + break; + case DEVICE_TYPE_TAP: + if(routing_mode == RMODE_ROUTER) + overwrite_mac = true; + device_info = _("Generic BSD tap device"); + break; + } + + logger(LOG_INFO, _("%s is a %s"), device, device_info); + + return true; +} + +void close_device(void) { + cp(); + + close(device_fd); +} + +bool read_packet(vpn_packet_t *packet) { + int lenin; + + cp(); + + switch(device_type) { + case DEVICE_TYPE_TUN: + if((lenin = read(device_fd, packet->data + 14, MTU - 14)) <= 0) { + logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, + device, strerror(errno)); + return false; + } + + switch(packet->data[14] >> 4) { + case 4: + packet->data[12] = 0x08; + packet->data[13] = 0x00; + break; + case 6: + packet->data[12] = 0x86; + packet->data[13] = 0xDD; + break; + default: + ifdebug(TRAFFIC) logger(LOG_ERR, + _ ("Unknown IP version %d while reading packet from %s %s"), + packet->data[14] >> 4, device_info, device); + return false; + } + + packet->len = lenin + 14; + break; + + case DEVICE_TYPE_TUNIFHEAD: { + u_int32_t type; + struct iovec vector[2] = {{&type, sizeof(type)}, {packet->data + 14, MTU - 14}}; + + if((lenin = readv(device_fd, vector, 2)) <= 0) { + logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, + device, strerror(errno)); + return false; + } + + switch (ntohl(type)) { + case AF_INET: + packet->data[12] = 0x08; + packet->data[13] = 0x00; + break; + + case AF_INET6: + packet->data[12] = 0x86; + packet->data[13] = 0xDD; + break; + + default: + ifdebug(TRAFFIC) logger(LOG_ERR, + _ ("Unknown address family %x while reading packet from %s %s"), + ntohl(type), device_info, device); + return false; + } + + packet->len = lenin + 10; + break; + } + + case DEVICE_TYPE_TAP: + if((lenin = read(device_fd, packet->data, MTU)) <= 0) { + logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, + device, strerror(errno)); + return false; + } + + packet->len = lenin; + break; + + default: + return false; + } + + device_total_in += packet->len; + + ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Read packet of %d bytes from %s"), + packet->len, device_info); + + return true; +} + +bool write_packet(vpn_packet_t *packet) +{ + cp(); + + ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Writing packet of %d bytes to %s"), + packet->len, device_info); + + switch(device_type) { + case DEVICE_TYPE_TUN: + if(write(device_fd, packet->data + 14, packet->len - 14) < 0) { + logger(LOG_ERR, _("Error while writing to %s %s: %s"), device_info, + device, strerror(errno)); + return false; + } + break; + + case DEVICE_TYPE_TUNIFHEAD: { + u_int32_t type; + struct iovec vector[2] = {{&type, sizeof(type)}, {packet->data + 14, MTU - 14}}; + int af; + + af = (packet->data[12] << 8) + packet->data[13]; + + switch (af) { + case 0x0800: + type = htonl(AF_INET); + break; + case 0x86DD: + type = htonl(AF_INET6); + break; + default: + ifdebug(TRAFFIC) logger(LOG_ERR, + _("Unknown address family %x while writing packet to %s %s"), + af, device_info, device); + return false; + } + + if(writev(device_fd, vector, 2) < 0) { + logger(LOG_ERR, _("Can't write to %s %s: %s"), device_info, device, + strerror(errno)); + return false; + } + break; + } + + case DEVICE_TYPE_TAP: + if(write(device_fd, packet->data, packet->len) < 0) { + logger(LOG_ERR, _("Error while writing to %s %s: %s"), device_info, + device, strerror(errno)); + return false; + } + break; + + default: + return false; + } + + device_total_out += packet->len; + + return true; +} + +void dump_device_stats(void) +{ + cp(); + + logger(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device); + logger(LOG_DEBUG, _(" total bytes in: %10d"), device_total_in); + logger(LOG_DEBUG, _(" total bytes out: %10d"), device_total_out); +} diff --git a/src/conf.c b/src/conf.c index bc29e07..de005d3 100644 --- a/src/conf.c +++ b/src/conf.c @@ -1,8 +1,8 @@ /* conf.c -- configuration code Copyright (C) 1998 Robert van der Meulen - 1998-2002 Ivo Timmermans - 2000-2002 Guus Sliepen + 1998-2004 Ivo Timmermans + 2000-2004 Guus Sliepen 2000 Cris van Pelt This program is free software; you can redistribute it and/or modify @@ -19,254 +19,228 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: conf.c,v 1.9.4.55 2002/04/09 11:42:48 guus Exp $ + $Id: conf.c 1374 2004-03-21 14:21:22Z guus $ */ -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include /* for cp */ -#include - -#include "conf.h" -#include "netutl.h" /* for str2address */ - #include "system.h" +#include "avl_tree.h" +#include "conf.h" +#include "logger.h" +#include "netutl.h" /* for str2address */ +#include "utils.h" /* for cp */ +#include "xalloc.h" + avl_tree_t *config_tree; -int debug_lvl = 0; -int pingtimeout = 0; /* seconds before timeout */ -char *confbase = NULL; /* directory in which all config files are */ -char *netname = NULL; /* name of the vpn network */ +int pingtimeout = 0; /* seconds before timeout */ +char *confbase = NULL; /* directory in which all config files are */ +char *netname = NULL; /* name of the vpn network */ -int config_compare(config_t *a, config_t *b) +static int config_compare(const config_t *a, const config_t *b) { - int result; + int result; - result = strcasecmp(a->variable, b->variable); + result = strcasecmp(a->variable, b->variable); - if(result) - return result; + if(result) + return result; - result = a->line - b->line; + result = a->line - b->line; - if(result) - return result; - else - return strcmp(a->file, b->file); + if(result) + return result; + else + return strcmp(a->file, b->file); } -void init_configuration(avl_tree_t **config_tree) +void init_configuration(avl_tree_t ** config_tree) { -cp - *config_tree = avl_alloc_tree((avl_compare_t)config_compare, (avl_action_t)free_config); -cp + cp(); + + *config_tree = avl_alloc_tree((avl_compare_t) config_compare, (avl_action_t) free_config); } -void exit_configuration(avl_tree_t **config_tree) +void exit_configuration(avl_tree_t ** config_tree) { -cp - avl_delete_tree(*config_tree); - *config_tree = NULL; -cp + cp(); + + avl_delete_tree(*config_tree); + *config_tree = NULL; } config_t *new_config(void) { - config_t *cfg; -cp - cfg = (config_t *)xmalloc_and_zero(sizeof(*cfg)); + cp(); - return cfg; + return xmalloc_and_zero(sizeof(config_t)); } void free_config(config_t *cfg) { -cp - if(cfg->variable) - free(cfg->variable); - if(cfg->value) - free(cfg->value); - if(cfg->file) - free(cfg->file); - free(cfg); -cp + cp(); + + if(cfg->variable) + free(cfg->variable); + + if(cfg->value) + free(cfg->value); + + if(cfg->file) + free(cfg->file); + + free(cfg); } void config_add(avl_tree_t *config_tree, config_t *cfg) { -cp - avl_insert(config_tree, cfg); -cp + cp(); + + avl_insert(config_tree, cfg); } -config_t *lookup_config(avl_tree_t *config_tree, char *variable) +config_t *lookup_config(const avl_tree_t *config_tree, char *variable) { - config_t cfg, *found; -cp - cfg.variable = variable; - cfg.file = ""; - cfg.line = 0; + config_t cfg, *found; - found = avl_search_closest_greater(config_tree, &cfg); + cp(); - if(!found) - return NULL; + cfg.variable = variable; + cfg.file = ""; + cfg.line = 0; - if(strcasecmp(found->variable, variable)) - return NULL; + found = avl_search_closest_greater(config_tree, &cfg); - return found; + if(!found) + return NULL; + + if(strcasecmp(found->variable, variable)) + return NULL; + + return found; } -config_t *lookup_config_next(avl_tree_t *config_tree, config_t *cfg) +config_t *lookup_config_next(const avl_tree_t *config_tree, const config_t *cfg) { - avl_node_t *node; - config_t *found; -cp - node = avl_search_node(config_tree, cfg); + avl_node_t *node; + config_t *found; - if(node) - { - if(node->next) - { - found = (config_t *)node->next->data; - if(!strcasecmp(found->variable, cfg->variable)) - return found; - } - } + cp(); - return NULL; + node = avl_search_node(config_tree, cfg); + + if(node) { + if(node->next) { + found = node->next->data; + + if(!strcasecmp(found->variable, cfg->variable)) + return found; + } + } + + return NULL; } -int get_config_bool(config_t *cfg, int *result) +bool get_config_bool(const config_t *cfg, bool *result) { -cp - if(!cfg) - return 0; + cp(); - if(!strcasecmp(cfg->value, "yes")) - { - *result = 1; - return 1; - } - else if(!strcasecmp(cfg->value, "no")) - { - *result = 0; - return 1; - } + if(!cfg) + return false; - syslog(LOG_ERR, _("\"yes\" or \"no\" expected for configuration variable %s in %s line %d"), - cfg->variable, cfg->file, cfg->line); + if(!strcasecmp(cfg->value, "yes")) { + *result = true; + return true; + } else if(!strcasecmp(cfg->value, "no")) { + *result = false; + return true; + } - return 0; + logger(LOG_ERR, _("\"yes\" or \"no\" expected for configuration variable %s in %s line %d"), + cfg->variable, cfg->file, cfg->line); + + return false; } -int get_config_int(config_t *cfg, int *result) +bool get_config_int(const config_t *cfg, int *result) { -cp - if(!cfg) - return 0; + cp(); - if(sscanf(cfg->value, "%d", result) == 1) - return 1; + if(!cfg) + return false; - syslog(LOG_ERR, _("Integer expected for configuration variable %s in %s line %d"), - cfg->variable, cfg->file, cfg->line); - return 0; + if(sscanf(cfg->value, "%d", result) == 1) + return true; + + logger(LOG_ERR, _("Integer expected for configuration variable %s in %s line %d"), + cfg->variable, cfg->file, cfg->line); + + return false; } -int get_config_string(config_t *cfg, char **result) +bool get_config_string(const config_t *cfg, char **result) { -cp - if(!cfg) - return 0; + cp(); - *result = xstrdup(cfg->value); - return 1; + if(!cfg) + return false; + + *result = xstrdup(cfg->value); + + return true; } -int get_config_address(config_t *cfg, struct addrinfo **result) +bool get_config_address(const config_t *cfg, struct addrinfo **result) { - struct addrinfo *ai; -cp - if(!cfg) - return 0; + struct addrinfo *ai; - ai = str2addrinfo(cfg->value, NULL, 0); + cp(); - if(ai) - { - *result = ai; - return 1; - } + if(!cfg) + return false; - syslog(LOG_ERR, _("Hostname or IP address expected for configuration variable %s in %s line %d"), - cfg->variable, cfg->file, cfg->line); - return 0; + ai = str2addrinfo(cfg->value, NULL, 0); + + if(ai) { + *result = ai; + return true; + } + + logger(LOG_ERR, _("Hostname or IP address expected for configuration variable %s in %s line %d"), + cfg->variable, cfg->file, cfg->line); + + return false; } -int get_config_port(config_t *cfg, port_t *result) +bool get_config_subnet(const config_t *cfg, subnet_t ** result) { -cp - if(!cfg) - return 0; + subnet_t subnet = {0}; - if(sscanf(cfg->value, "%hu", result) == 1) - { - *result = htons(*result); - return 1; - } + cp(); - syslog(LOG_ERR, _("Port number expected for configuration variable %s in %s line %d"), - cfg->variable, cfg->file, cfg->line); - return 0; -} + if(!cfg) + return false; -int get_config_subnet(config_t *cfg, subnet_t **result) -{ - subnet_t *subnet; -cp - if(!cfg) - return 0; + if(!str2net(&subnet, cfg->value)) { + logger(LOG_ERR, _("Subnet expected for configuration variable %s in %s line %d"), + cfg->variable, cfg->file, cfg->line); + return false; + } - subnet = str2net(cfg->value); + /* Teach newbies what subnets are... */ - if(!subnet) - { - syslog(LOG_ERR, _("Subnet expected for configuration variable %s in %s line %d"), - cfg->variable, cfg->file, cfg->line); - return 0; - } + if(((subnet.type == SUBNET_IPV4) + && !maskcheck(&subnet.net.ipv4.address, subnet.net.ipv4.prefixlength, sizeof(ipv4_t))) + || ((subnet.type == SUBNET_IPV6) + && !maskcheck(&subnet.net.ipv6.address, subnet.net.ipv6.prefixlength, sizeof(ipv6_t)))) { + logger(LOG_ERR, _ ("Network address and prefix length do not match for configuration variable %s in %s line %d"), + cfg->variable, cfg->file, cfg->line); + return false; + } - /* Teach newbies what subnets are... */ + *(*result = new_subnet()) = subnet; - if(((subnet->type == SUBNET_IPV4) && maskcheck((char *)&subnet->net.ipv4.address, subnet->net.ipv4.prefixlength, sizeof(ipv4_t))) - || ((subnet->type == SUBNET_IPV6) && maskcheck((char *)&subnet->net.ipv6.address, subnet->net.ipv6.prefixlength, sizeof(ipv6_t)))) - { - syslog(LOG_ERR, _("Network address and prefix length do not match for configuration variable %s in %s line %d"), - cfg->variable, cfg->file, cfg->line); - free(subnet); - return 0; - } - - *result = subnet; - - return 1; + return true; } /* @@ -279,74 +253,63 @@ cp given, and buf needs to be expanded, the var pointed to by buflen will be increased. */ -char *readline(FILE *fp, char **buf, size_t *buflen) +static char *readline(FILE * fp, char **buf, size_t *buflen) { - char *newline = NULL; - char *p; - char *line; /* The array that contains everything that has been read - so far */ - char *idx; /* Read into this pointer, which points to an offset - within line */ - size_t size, newsize; /* The size of the current array pointed to by - line */ - size_t maxlen; /* Maximum number of characters that may be read with - fgets. This is newsize - oldsize. */ + char *newline = NULL; + char *p; + char *line; /* The array that contains everything that has been read so far */ + char *idx; /* Read into this pointer, which points to an offset within line */ + size_t size, newsize; /* The size of the current array pointed to by line */ + size_t maxlen; /* Maximum number of characters that may be read with fgets. This is newsize - oldsize. */ - if(feof(fp)) - return NULL; + if(feof(fp)) + return NULL; - if((buf != NULL) && (buflen != NULL)) - { - size = *buflen; - line = *buf; - } - else - { - size = 100; - line = xmalloc(size); - } - - maxlen = size; - idx = line; - *idx = 0; - for(;;) - { - errno = 0; - p = fgets(idx, maxlen, fp); - if(p == NULL) /* EOF or error */ - { - if(feof(fp)) - break; - - /* otherwise: error; let the calling function print an error - message if applicable */ - free(line); - return NULL; + if(buf && buflen) { + size = *buflen; + line = *buf; + } else { + size = 100; + line = xmalloc(size); } - newline = strchr(p, '\n'); - if(newline == NULL) - /* We haven't yet read everything to the end of the line */ - { - newsize = size << 1; - line = xrealloc(line, newsize); - idx = &line[size - 1]; - maxlen = newsize - size + 1; - size = newsize; - } - else - { - *newline = '\0'; /* kill newline */ - break; /* yay */ - } - } + maxlen = size; + idx = line; + *idx = 0; - if((buf != NULL) && (buflen != NULL)) - { - *buflen = size; - *buf = line; - } - return line; + for(;;) { + errno = 0; + p = fgets(idx, maxlen, fp); + + if(!p) { /* EOF or error */ + if(feof(fp)) + break; + + /* otherwise: error; let the calling function print an error message if applicable */ + free(line); + return NULL; + } + + newline = strchr(p, '\n'); + + if(!newline) { /* We haven't yet read everything to the end of the line */ + newsize = size << 1; + line = xrealloc(line, newsize); + idx = &line[size - 1]; + maxlen = newsize - size + 1; + size = newsize; + } else { + *newline = '\0'; /* kill newline */ + break; /* yay */ + } + } + + if(buf && buflen) { + *buflen = size; + *buf = line; + } + + return line; } /* @@ -355,269 +318,174 @@ char *readline(FILE *fp, char **buf, size_t *buflen) */ int read_config_file(avl_tree_t *config_tree, const char *fname) { - int err = -2; /* Parse error */ - FILE *fp; - char *buffer, *line; - char *variable, *value; - int lineno = 0, ignore = 0; - config_t *cfg; - size_t bufsize; + int err = -2; /* Parse error */ + FILE *fp; + char *buffer, *line; + char *variable, *value, *eol; + int lineno = 0; + int len; + bool ignore = false; + config_t *cfg; + size_t bufsize; -cp - if((fp = fopen (fname, "r")) == NULL) - { - syslog(LOG_ERR, _("Cannot open config file %s: %s"), fname, strerror(errno)); - return -3; - } + cp(); - bufsize = 100; - buffer = xmalloc(bufsize); + fp = fopen(fname, "r"); - for(;;) - { - if((line = readline(fp, &buffer, &bufsize)) == NULL) - { - err = -1; - break; + if(!fp) { + logger(LOG_ERR, _("Cannot open config file %s: %s"), fname, + strerror(errno)); + return -3; } - if(feof(fp)) - { - err = 0; - break; + bufsize = 100; + buffer = xmalloc(bufsize); + + for(;;) { + line = readline(fp, &buffer, &bufsize); + + if(!line) { + err = -1; + break; + } + + if(feof(fp)) { + err = 0; + break; + } + + lineno++; + + if(!*line || *line == '#') + continue; + + if(ignore) { + if(!strncmp(line, "-----END", 8)) + ignore = false; + continue; + } + + if(!strncmp(line, "-----BEGIN", 10)) { + ignore = true; + continue; + } + + variable = value = line; + + eol = line + strlen(line); + while(strchr("\t ", *--eol)) + *eol = '\0'; + + len = strcspn(value, "\t ="); + value += len; + value += strspn(value, "\t "); + if(*value == '=') { + value++; + value += strspn(value, "\t "); + } + variable[len] = '\0'; + + + if(!*value) { + logger(LOG_ERR, _("No value for variable `%s' on line %d while reading config file %s"), + variable, lineno, fname); + break; + } + + cfg = new_config(); + cfg->variable = xstrdup(variable); + cfg->value = xstrdup(value); + cfg->file = xstrdup(fname); + cfg->line = lineno; + + config_add(config_tree, cfg); } - lineno++; + free(buffer); + fclose(fp); - if((variable = strtok(line, "\t =")) == NULL) - continue; /* no tokens on this line */ - - if(variable[0] == '#') - continue; /* comment: ignore */ - - if(!strcmp(variable, "-----BEGIN")) - ignore = 1; - - if(!ignore) - { - if(((value = strtok(NULL, "\t\n\r =")) == NULL) || value[0] == '#') - { - syslog(LOG_ERR, _("No value for variable `%s' on line %d while reading config file %s"), - variable, lineno, fname); - break; - } - - cfg = new_config(); - cfg->variable = xstrdup(variable); - cfg->value = xstrdup(value); - cfg->file = xstrdup(fname); - cfg->line = lineno; - - config_add(config_tree, cfg); - } - - if(!strcmp(variable, "-----END")) - ignore = 0; - } - - free(buffer); - fclose (fp); -cp - return err; + return err; } -int read_server_config() +bool read_server_config() { - char *fname; - int x; -cp - asprintf(&fname, "%s/tinc.conf", confbase); - x = read_config_file(config_tree, fname); - if(x == -1) /* System error: complain */ - { - syslog(LOG_ERR, _("Failed to read `%s': %s"), fname, strerror(errno)); - } - free(fname); -cp - return x; -} + char *fname; + int x; -int isadir(const char* f) -{ - struct stat s; + cp(); - if(stat(f, &s) < 0) - return 0; - else - return S_ISDIR(s.st_mode); -} + asprintf(&fname, "%s/tinc.conf", confbase); + x = read_config_file(config_tree, fname); -int is_safe_path(const char *file) -{ - char *p; - const char *f; - char x; - struct stat s; - char l[MAXBUFSIZE]; - - if(*file != '/') - { - syslog(LOG_ERR, _("`%s' is not an absolute path"), file); - return 0; - } - - p = strrchr(file, '/'); - - if(p == file) /* It's in the root */ - p++; - - x = *p; - *p = '\0'; - - f = file; -check1: - if(lstat(f, &s) < 0) - { - syslog(LOG_ERR, _("Couldn't stat `%s': %s"), f, strerror(errno)); - return 0; - } - - if(s.st_uid != geteuid()) - { - syslog(LOG_ERR, _("`%s' is owned by UID %d instead of %d"), - f, s.st_uid, geteuid()); - return 0; - } - - if(S_ISLNK(s.st_mode)) - { - syslog(LOG_WARNING, _("Warning: `%s' is a symlink"), - f); - - if(readlink(f, l, MAXBUFSIZE) < 0) - { - syslog(LOG_ERR, _("Unable to read symbolic link `%s': %s"), f, strerror(errno)); - return 0; - } - - f = l; - goto check1; - } - - *p = x; - f = file; - -check2: - if(lstat(f, &s) < 0 && errno != ENOENT) - { - syslog(LOG_ERR, _("Couldn't stat `%s': %s"), f, strerror(errno)); - return 0; - } - - if(errno == ENOENT) - return 1; - - if(s.st_uid != geteuid()) - { - syslog(LOG_ERR, _("`%s' is owned by UID %d instead of %d"), - f, s.st_uid, geteuid()); - return 0; - } - - if(S_ISLNK(s.st_mode)) - { - syslog(LOG_WARNING, _("Warning: `%s' is a symlink"), - f); - - if(readlink(f, l, MAXBUFSIZE) < 0) - { - syslog(LOG_ERR, _("Unable to read symbolic link `%s': %s"), f, strerror(errno)); - return 0; - } - - f = l; - goto check2; - } - - if(s.st_mode & 0007) - { - /* Accessible by others */ - syslog(LOG_ERR, _("`%s' has unsecure permissions"), - f); - return 0; - } - - return 1; -} - -FILE *ask_and_safe_open(const char* filename, const char* what, const char* mode) -{ - FILE *r; - char *directory; - char *fn; - - /* Check stdin and stdout */ - if(!isatty(0) || !isatty(1)) - { - /* Argh, they are running us from a script or something. Write - the files to the current directory and let them burn in hell - for ever. */ - fn = xstrdup(filename); - } - else - { - /* Ask for a file and/or directory name. */ - fprintf(stdout, _("Please enter a file to save %s to [%s]: "), - what, filename); - fflush(stdout); - - if((fn = readline(stdin, NULL, NULL)) == NULL) - { - fprintf(stderr, _("Error while reading stdin: %s\n"), strerror(errno)); - return NULL; + if(x == -1) { /* System error: complain */ + logger(LOG_ERR, _("Failed to read `%s': %s"), fname, strerror(errno)); } - if(strlen(fn) == 0) - /* User just pressed enter. */ - fn = xstrdup(filename); - } + free(fname); - if((strchr(fn, '/') == NULL) || (fn[0] != '/')) - { - /* The directory is a relative path or a filename. */ - char *p; - - directory = get_current_dir_name(); - asprintf(&p, "%s/%s", directory, fn); - free(fn); - free(directory); - fn = p; - } - - umask(0077); /* Disallow everything for group and other */ - - /* Open it first to keep the inode busy */ - if((r = fopen(fn, mode)) == NULL) - { - fprintf(stderr, _("Error opening file `%s': %s\n"), - fn, strerror(errno)); - free(fn); - return NULL; - } - - /* Then check the file for nasty attacks */ - if(!is_safe_path(fn)) /* Do not permit any directories that are - readable or writeable by other users. */ - { - fprintf(stderr, _("The file `%s' (or any of the leading directories) has unsafe permissions.\n" - "I will not create or overwrite this file.\n"), - fn); - fclose(r); - free(fn); - return NULL; - } - - free(fn); - - return r; + return x == 0; +} + +FILE *ask_and_open(const char *filename, const char *what, const char *mode) +{ + FILE *r; + char *directory; + char *fn; + + /* Check stdin and stdout */ + if(!isatty(0) || !isatty(1)) { + /* Argh, they are running us from a script or something. Write + the files to the current directory and let them burn in hell + for ever. */ + fn = xstrdup(filename); + } else { + /* Ask for a file and/or directory name. */ + fprintf(stdout, _("Please enter a file to save %s to [%s]: "), + what, filename); + fflush(stdout); + + fn = readline(stdin, NULL, NULL); + + if(!fn) { + fprintf(stderr, _("Error while reading stdin: %s\n"), + strerror(errno)); + return NULL; + } + + if(!strlen(fn)) + /* User just pressed enter. */ + fn = xstrdup(filename); + } + +#ifdef HAVE_MINGW + if(fn[0] != '\\' && fn[0] != '/' && !strchr(fn, ':')) { +#else + if(fn[0] != '/') { +#endif + /* The directory is a relative path or a filename. */ + char *p; + + directory = get_current_dir_name(); + asprintf(&p, "%s/%s", directory, fn); + free(fn); + free(directory); + fn = p; + } + + umask(0077); /* Disallow everything for group and other */ + + /* Open it first to keep the inode busy */ + + r = fopen(fn, mode); + + if(!r) { + fprintf(stderr, _("Error opening file `%s': %s\n"), + fn, strerror(errno)); + free(fn); + return NULL; + } + + free(fn); + + return r; } diff --git a/src/conf.h b/src/conf.h index bf399dd..d6a2f2a 100644 --- a/src/conf.h +++ b/src/conf.h @@ -1,7 +1,7 @@ /* conf.h -- header for conf.c - Copyright (C) 1998-2002 Ivo Timmermans - 2000-2002 Guus Sliepen + Copyright (C) 1998-2004 Ivo Timmermans + 2000-2004 Guus Sliepen 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 @@ -17,54 +17,47 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: conf.h,v 1.6.4.32 2002/02/18 16:25:16 guus Exp $ + $Id: conf.h 1374 2004-03-21 14:21:22Z guus $ */ #ifndef __TINC_CONF_H__ #define __TINC_CONF_H__ -#include -#include -#include - -#include -#include "net.h" -#include "subnet.h" +#include "avl_tree.h" typedef struct config_t { - char *variable; - char *value; - char *file; - int line; + char *variable; + char *value; + char *file; + int line; } config_t; +#include "subnet.h" + extern avl_tree_t *config_tree; -extern int debug_lvl; extern int pingtimeout; extern int maxtimeout; -extern int bypass_security; +extern bool bypass_security; extern char *confbase; extern char *netname; extern void init_configuration(avl_tree_t **); extern void exit_configuration(avl_tree_t **); -extern config_t *new_config(void); +extern config_t *new_config(void) __attribute__ ((__malloc__)); extern void free_config(config_t *); extern void config_add(avl_tree_t *, config_t *); -extern config_t *lookup_config(avl_tree_t *, char *); -extern config_t *lookup_config_next(avl_tree_t *, config_t *); -extern int get_config_bool(config_t *, int *); -extern int get_config_int(config_t *, int *); -extern int get_config_port(config_t *, port_t *); -extern int get_config_string(config_t *, char **); -extern int get_config_address(config_t *, struct addrinfo **); -struct subnet_t; /* Needed for next line. */ -extern int get_config_subnet(config_t *, struct subnet_t **); +extern config_t *lookup_config(const avl_tree_t *, char *); +extern config_t *lookup_config_next(const avl_tree_t *, const config_t *); +extern bool get_config_bool(const config_t *, bool *); +extern bool get_config_int(const config_t *, int *); +extern bool get_config_string(const config_t *, char **); +extern bool get_config_address(const config_t *, struct addrinfo **); +extern bool get_config_subnet(const config_t *, struct subnet_t **); extern int read_config_file(avl_tree_t *, const char *); -extern int read_server_config(void); -extern FILE *ask_and_safe_open(const char*, const char*, const char *); -extern int is_safe_path(const char *); +extern bool read_server_config(void); +extern FILE *ask_and_open(const char *, const char *, const char *); +extern bool is_safe_path(const char *); -#endif /* __TINC_CONF_H__ */ +#endif /* __TINC_CONF_H__ */ diff --git a/src/connection.c b/src/connection.c index 391982a..8161dfd 100644 --- a/src/connection.c +++ b/src/connection.c @@ -1,7 +1,7 @@ /* connection.c -- connection list management - Copyright (C) 2000-2002 Guus Sliepen , - 2000-2002 Ivo Timmermans + Copyright (C) 2000-2004 Guus Sliepen , + 2000-2004 Ivo Timmermans 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 @@ -17,121 +17,127 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: connection.c,v 1.1.2.29 2002/03/22 13:31:18 guus Exp $ + $Id: connection.c 1374 2004-03-21 14:21:22Z guus $ */ -#include "config.h" - -#include -#include -#include -#include - -#include -#include - -#include "net.h" /* Don't ask. */ -#include "netutl.h" -#include "config.h" -#include "conf.h" -#include -#include "subnet.h" - -#include "xalloc.h" #include "system.h" -avl_tree_t *connection_tree; /* Meta connections */ +#include "avl_tree.h" +#include "conf.h" +#include "list.h" +#include "logger.h" +#include "net.h" /* Don't ask. */ +#include "netutl.h" +#include "subnet.h" +#include "utils.h" +#include "xalloc.h" -int connection_compare(connection_t *a, connection_t *b) +avl_tree_t *connection_tree; /* Meta connections */ +connection_t *broadcast; + +static int connection_compare(const connection_t *a, const connection_t *b) { - return a - b; + return (void *)a - (void *)b; } void init_connections(void) { -cp - connection_tree = avl_alloc_tree((avl_compare_t)connection_compare, NULL); -cp + cp(); + + connection_tree = avl_alloc_tree((avl_compare_t) connection_compare, NULL); + broadcast = new_connection(); + broadcast->name = xstrdup(_("everyone")); + broadcast->hostname = xstrdup(_("BROADCAST")); } void exit_connections(void) { -cp - avl_delete_tree(connection_tree); -cp + cp(); + + avl_delete_tree(connection_tree); + free_connection(broadcast); } connection_t *new_connection(void) { - connection_t *c; -cp - c = (connection_t *)xmalloc_and_zero(sizeof(connection_t)); + connection_t *c; - if(!c) - return NULL; + cp(); - gettimeofday(&c->start, NULL); -cp - return c; + c = xmalloc_and_zero(sizeof(connection_t)); + + if(!c) + return NULL; + + gettimeofday(&c->start, NULL); + + return c; } void free_connection(connection_t *c) { -cp - if(c->hostname) - free(c->hostname); - if(c->inkey) - free(c->inkey); - if(c->outkey) - free(c->outkey); - if(c->mychallenge) - free(c->mychallenge); - if(c->hischallenge) - free(c->hischallenge); - free(c); -cp + cp(); + + if(c->hostname) + free(c->hostname); + + if(c->inkey) + free(c->inkey); + + if(c->outkey) + free(c->outkey); + + if(c->mychallenge) + free(c->mychallenge); + + if(c->hischallenge) + free(c->hischallenge); + + free(c); } void connection_add(connection_t *c) { -cp - avl_insert(connection_tree, c); -cp + cp(); + + avl_insert(connection_tree, c); } void connection_del(connection_t *c) { -cp - avl_delete(connection_tree, c); -cp + cp(); + + avl_delete(connection_tree, c); } void dump_connections(void) { - avl_node_t *node; - connection_t *c; -cp - syslog(LOG_DEBUG, _("Connections:")); + avl_node_t *node; + connection_t *c; - for(node = connection_tree->head; node; node = node->next) - { - c = (connection_t *)node->data; - syslog(LOG_DEBUG, _(" %s at %s options %lx socket %d status %04x"), - c->name, c->hostname, c->options, c->socket, c->status); - } - - syslog(LOG_DEBUG, _("End of connections.")); -cp + cp(); + + logger(LOG_DEBUG, _("Connections:")); + + for(node = connection_tree->head; node; node = node->next) { + c = node->data; + logger(LOG_DEBUG, _(" %s at %s options %lx socket %d status %04x"), + c->name, c->hostname, c->options, c->socket, *(uint32_t *)&c->status); + } + + logger(LOG_DEBUG, _("End of connections.")); } -int read_connection_config(connection_t *c) +bool read_connection_config(connection_t *c) { - char *fname; - int x; -cp - asprintf(&fname, "%s/hosts/%s", confbase, c->name); - x = read_config_file(c->config_tree, fname); - free(fname); -cp - return x; + char *fname; + int x; + + cp(); + + asprintf(&fname, "%s/hosts/%s", confbase, c->name); + x = read_config_file(c->config_tree, fname); + free(fname); + + return x == 0; } diff --git a/src/connection.h b/src/connection.h index 0cdcc09..3e28d67 100644 --- a/src/connection.h +++ b/src/connection.h @@ -1,7 +1,7 @@ /* connection.h -- header for connection.c - Copyright (C) 2000-2002 Guus Sliepen , - 2000-2002 Ivo Timmermans + Copyright (C) 2000-2004 Guus Sliepen , + 2000-2004 Ivo Timmermans 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 @@ -17,105 +17,95 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: connection.h,v 1.1.2.26 2002/02/20 19:25:09 guus Exp $ + $Id: connection.h 1374 2004-03-21 14:21:22Z guus $ */ #ifndef __TINC_CONNECTION_H__ #define __TINC_CONNECTION_H__ -#include +#include +#include -#include -#include - -#ifdef HAVE_OPENSSL_EVP_H -# include -#else -# include -#endif - -#ifdef HAVE_OPENSSL_RSA_H -# include -#else -# include -#endif - -#include "net.h" -#include "conf.h" - -#include "node.h" -#include "edge.h" +#include "avl_tree.h" #define OPTION_INDIRECT 0x0001 #define OPTION_TCPONLY 0x0002 +#define OPTION_PMTU_DISCOVERY 0x0004 typedef struct connection_status_t { - int pinged:1; /* sent ping */ - int active:1; /* 1 if active.. */ - int connecting:1; /* 1 if we are waiting for a non-blocking connect() to finish */ - int termreq:1; /* the termination of this connection was requested */ - int remove:1; /* Set to 1 if you want this connection removed */ - int timeout:1; /* 1 if gotten timeout */ - int encryptout:1; /* 1 if we can encrypt outgoing traffic */ - int decryptin:1; /* 1 if we have to decrypt incoming traffic */ - int mst:1; /* 1 if this connection is part of a minimum spanning tree */ - int unused:18; + int pinged:1; /* sent ping */ + int active:1; /* 1 if active.. */ + int connecting:1; /* 1 if we are waiting for a non-blocking connect() to finish */ + int termreq:1; /* the termination of this connection was requested */ + int remove:1; /* Set to 1 if you want this connection removed */ + int timeout:1; /* 1 if gotten timeout */ + int encryptout:1; /* 1 if we can encrypt outgoing traffic */ + int decryptin:1; /* 1 if we have to decrypt incoming traffic */ + int mst:1; /* 1 if this connection is part of a minimum spanning tree */ + int unused:23; } connection_status_t; +#include "edge.h" +#include "list.h" +#include "net.h" +#include "node.h" + typedef struct connection_t { - char *name; /* name he claims to have */ + char *name; /* name he claims to have */ - sockaddr_t address; /* his real (internet) ip */ - char *hostname; /* the hostname of its real ip */ - int protocol_version; /* used protocol */ + union sockaddr_t address; /* his real (internet) ip */ + char *hostname; /* the hostname of its real ip */ + int protocol_version; /* used protocol */ - int socket; /* socket used for this connection */ - long int options; /* options for this connection */ - struct connection_status_t status; /* status info */ - int estimated_weight; /* estimation for the weight of the edge for this connection */ - struct timeval start; /* time this connection was started, used for above estimation */ - struct outgoing_t *outgoing; /* used to keep track of outgoing connections */ + int socket; /* socket used for this connection */ + long int options; /* options for this connection */ + struct connection_status_t status; /* status info */ + int estimated_weight; /* estimation for the weight of the edge for this connection */ + struct timeval start; /* time this connection was started, used for above estimation */ + struct outgoing_t *outgoing; /* used to keep track of outgoing connections */ - struct node_t *node; /* node associated with the other end */ - struct edge_t *edge; /* edge associated with this connection */ + struct node_t *node; /* node associated with the other end */ + struct edge_t *edge; /* edge associated with this connection */ - RSA *rsa_key; /* his public/private key */ - const EVP_CIPHER *incipher; /* Cipher he will use to send data to us */ - const EVP_CIPHER *outcipher; /* Cipher we will use to send data to him */ - EVP_CIPHER_CTX *inctx; /* Context of encrypted meta data that will come from him to us */ - EVP_CIPHER_CTX *outctx; /* Context of encrypted meta data that will be sent from us to him */ - char *inkey; /* His symmetric meta key + iv */ - char *outkey; /* Our symmetric meta key + iv */ - int inkeylength; /* Length of his key + iv */ - int outkeylength; /* Length of our key + iv */ - const EVP_MD *indigest; - const EVP_MD *outdigest; - int inmaclength; - int outmaclength; - int incompression; - int outcompression; - char *mychallenge; /* challenge we received from him */ - char *hischallenge; /* challenge we sent to him */ + RSA *rsa_key; /* his public/private key */ + const EVP_CIPHER *incipher; /* Cipher he will use to send data to us */ + const EVP_CIPHER *outcipher; /* Cipher we will use to send data to him */ + EVP_CIPHER_CTX *inctx; /* Context of encrypted meta data that will come from him to us */ + EVP_CIPHER_CTX *outctx; /* Context of encrypted meta data that will be sent from us to him */ + char *inkey; /* His symmetric meta key + iv */ + char *outkey; /* Our symmetric meta key + iv */ + int inkeylength; /* Length of his key + iv */ + int outkeylength; /* Length of our key + iv */ + const EVP_MD *indigest; + const EVP_MD *outdigest; + int inmaclength; + int outmaclength; + int incompression; + int outcompression; + char *mychallenge; /* challenge we received from him */ + char *hischallenge; /* challenge we sent to him */ - char buffer[MAXBUFSIZE]; /* metadata input buffer */ - int buflen; /* bytes read into buffer */ - int tcplen; /* length of incoming TCPpacket */ - int allow_request; /* defined if there's only one request possible */ + char buffer[MAXBUFSIZE]; /* metadata input buffer */ + int buflen; /* bytes read into buffer */ + int reqlen; /* length of incoming request */ + int tcplen; /* length of incoming TCPpacket */ + int allow_request; /* defined if there's only one request possible */ - time_t last_ping_time; /* last time we saw some activity from the other end */ + time_t last_ping_time; /* last time we saw some activity from the other end */ - avl_tree_t *config_tree; /* Pointer to configuration tree belonging to him */ + avl_tree_t *config_tree; /* Pointer to configuration tree belonging to him */ } connection_t; extern avl_tree_t *connection_tree; +extern connection_t *broadcast; extern void init_connections(void); extern void exit_connections(void); -extern connection_t *new_connection(void); +extern connection_t *new_connection(void) __attribute__ ((__malloc__)); extern void free_connection(connection_t *); extern void connection_add(connection_t *); extern void connection_del(connection_t *); extern void dump_connections(void); -extern int read_connection_config(connection_t *); +extern bool read_connection_config(connection_t *); -#endif /* __TINC_CONNECTION_H__ */ +#endif /* __TINC_CONNECTION_H__ */ diff --git a/src/cygwin/device.c b/src/cygwin/device.c new file mode 100644 index 0000000..c184362 --- /dev/null +++ b/src/cygwin/device.c @@ -0,0 +1,280 @@ +/* + device.c -- Interaction with Windows tap driver in a Cygwin environment + Copyright (C) 2002-2004 Ivo Timmermans , + 2002-2004 Guus Sliepen + + 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., 675 Mass Ave, Cambridge, MA 02139, USA. + + $Id: device.c 1400 2004-11-01 17:02:19Z guus $ +*/ + +#include "system.h" + +#include +#include + +#include "conf.h" +#include "logger.h" +#include "net.h" +#include "route.h" +#include "utils.h" +#include "xalloc.h" + +#include "mingw/common.h" + +int device_fd = -1; +static HANDLE device_handle = INVALID_HANDLE_VALUE; +char *device = NULL; +char *iface = NULL; +char *device_info = NULL; + +static int device_total_in = 0; +static int device_total_out = 0; + +static pid_t reader_pid; +static int sp[2]; + +bool setup_device(void) +{ + HKEY key, key2; + int i, err; + + char regpath[1024]; + char adapterid[1024]; + char adaptername[1024]; + char tapname[1024]; + char gelukt = 0; + long len; + + bool found = false; + + cp(); + + get_config_string(lookup_config(config_tree, "Device"), &device); + get_config_string(lookup_config(config_tree, "Interface"), &iface); + + /* Open registry and look for network adapters */ + + if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, NETWORK_CONNECTIONS_KEY, 0, KEY_READ, &key)) { + logger(LOG_ERR, _("Unable to read registry: %s"), winerror(GetLastError())); + return false; + } + + for (i = 0; ; i++) { + len = sizeof(adapterid); + if(RegEnumKeyEx(key, i, adapterid, &len, 0, 0, 0, NULL)) + break; + + /* Find out more about this adapter */ + + snprintf(regpath, sizeof(regpath), "%s\\%s\\Connection", NETWORK_CONNECTIONS_KEY, adapterid); + + if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, regpath, 0, KEY_READ, &key2)) + continue; + + len = sizeof(adaptername); + err = RegQueryValueEx(key2, "Name", 0, 0, adaptername, &len); + + RegCloseKey(key2); + + if(err) + continue; + + if(device) { + if(!strcmp(device, adapterid)) { + found = true; + break; + } else + continue; + } + + if(iface) { + if(!strcmp(iface, adaptername)) { + found = true; + break; + } else + continue; + } + + snprintf(tapname, sizeof(tapname), USERMODEDEVICEDIR "%s" TAPSUFFIX, adapterid); + device_handle = CreateFile(tapname, GENERIC_WRITE | GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM, 0); + if(device_handle != INVALID_HANDLE_VALUE) { + CloseHandle(device_handle); + found = true; + break; + } + } + + RegCloseKey(key); + + if(!found) { + logger(LOG_ERR, _("No Windows tap device found!")); + return false; + } + + if(!device) + device = xstrdup(adapterid); + + if(!iface) + iface = xstrdup(adaptername); + + snprintf(tapname, sizeof(tapname), USERMODEDEVICEDIR "%s" TAPSUFFIX, device); + + /* Now we are going to open this device twice: once for reading and once for writing. + We do this because apparently it isn't possible to check for activity in the select() loop. + Furthermore I don't really know how to do it the "Windows" way. */ + + if(socketpair(AF_UNIX, SOCK_DGRAM, PF_UNIX, sp)) { + logger(LOG_DEBUG, _("System call `%s' failed: %s"), "socketpair", strerror(errno)); + return false; + } + + /* The parent opens the tap device for writing. */ + + device_handle = CreateFile(tapname, GENERIC_WRITE, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM , 0); + + if(device_handle == INVALID_HANDLE_VALUE) { + logger(LOG_ERR, _("Could not open Windows tap device %s (%s) for writing: %s"), device, iface, winerror(GetLastError())); + return false; + } + + device_fd = sp[0]; + + /* Get MAC address from tap device */ + + if(!DeviceIoControl(device_handle, TAP_IOCTL_GET_MAC, mymac.x, sizeof(mymac.x), mymac.x, sizeof(mymac.x), &len, 0)) { + logger(LOG_ERR, _("Could not get MAC address from Windows tap device %s (%s): %s"), device, iface, winerror(GetLastError())); + return false; + } + + if(routing_mode == RMODE_ROUTER) { + overwrite_mac = 1; + } + + /* Now we start the child */ + + reader_pid = fork(); + + if(reader_pid == -1) { + logger(LOG_DEBUG, _("System call `%s' failed: %s"), "fork", strerror(errno)); + return false; + } + + if(!reader_pid) { + /* The child opens the tap device for reading, blocking. + It passes everything it reads to the socket. */ + + char buf[MTU]; + long lenin; + + CloseHandle(device_handle); + + device_handle = CreateFile(tapname, GENERIC_READ, FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM, 0); + + if(device_handle == INVALID_HANDLE_VALUE) { + logger(LOG_ERR, _("Could not open Windows tap device %s (%s) for reading: %s"), device, iface, winerror(GetLastError())); + buf[0] = 0; + write(sp[1], buf, 1); + exit(1); + } + + logger(LOG_DEBUG, _("Tap reader forked and running.")); + + /* Notify success */ + + buf[0] = 1; + write(sp[1], buf, 1); + + /* Pass packets */ + + for(;;) { + ReadFile(device_handle, buf, MTU, &lenin, NULL); + write(sp[1], buf, lenin); + } + } + + read(device_fd, &gelukt, 1); + if(gelukt != 1) { + logger(LOG_DEBUG, _("Tap reader failed!")); + return false; + } + + device_info = _("Windows tap device"); + + logger(LOG_INFO, _("%s (%s) is a %s"), device, iface, device_info); + + return true; +} + +void close_device(void) +{ + cp(); + + close(sp[0]); + close(sp[1]); + CloseHandle(device_handle); + + kill(reader_pid, SIGKILL); +} + +bool read_packet(vpn_packet_t *packet) +{ + int lenin; + + cp(); + + if((lenin = read(sp[0], packet->data, MTU)) <= 0) { + logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, + device, strerror(errno)); + return false; + } + + packet->len = lenin; + + device_total_in += packet->len; + + ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Read packet of %d bytes from %s"), packet->len, + device_info); + + return true; +} + +bool write_packet(vpn_packet_t *packet) +{ + long lenout; + + cp(); + + ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Writing packet of %d bytes to %s"), + packet->len, device_info); + + if(!WriteFile (device_handle, packet->data, packet->len, &lenout, NULL)) { + logger(LOG_ERR, _("Error while writing to %s %s: %s"), device_info, device, winerror(GetLastError())); + return false; + } + + device_total_out += packet->len; + + return true; +} + +void dump_device_stats(void) +{ + cp(); + + logger(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device); + logger(LOG_DEBUG, _(" total bytes in: %10d"), device_total_in); + logger(LOG_DEBUG, _(" total bytes out: %10d"), device_total_out); +} diff --git a/src/device.c b/src/device.c deleted file mode 100644 index e896f54..0000000 --- a/src/device.c +++ /dev/null @@ -1,224 +0,0 @@ -/* - device.c -- Interaction with Linux ethertap and tun/tap device - Copyright (C) 2001-2002 Ivo Timmermans , - 2001-2002 Guus Sliepen - - 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., 675 Mass Ave, Cambridge, MA 02139, USA. - - $Id: device.c,v 1.1.2.8 2002/03/24 16:36:56 guus Exp $ -*/ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef HAVE_TUNTAP - #ifdef LINUX_IF_TUN_H - #include LINUX_IF_TUN_H - #else - #include - #endif - #define DEFAULT_DEVICE "/dev/misc/net/tun" -#else - #define DEFAULT_DEVICE "/dev/tap0" -#endif - -#include -#include "conf.h" -#include "net.h" -#include "subnet.h" - -#include "system.h" - -#define DEVICE_TYPE_ETHERTAP 0 -#define DEVICE_TYPE_TUNTAP 1 - -int device_fd = -1; -int device_type; -char *device; -char *interface; -char ifrname[IFNAMSIZ]; -char *device_info; - -int device_total_in = 0; -int device_total_out = 0; - -extern subnet_t mymac; - -/* - open the local ethertap device -*/ -int setup_device(void) -{ - struct ifreq ifr; - -cp - if(!get_config_string(lookup_config(config_tree, "Device"), &device)) - device = DEFAULT_DEVICE; - - if(!get_config_string(lookup_config(config_tree, "Interface"), &interface)) -#ifdef HAVE_TUNTAP - interface = netname; -#else - interface = rindex(device, '/')?rindex(device, '/')+1:device; -#endif -cp - if((device_fd = open(device, O_RDWR | O_NONBLOCK)) < 0) - { - syslog(LOG_ERR, _("Could not open %s: %s"), device, strerror(errno)); - return -1; - } -cp - /* Set default MAC address for ethertap devices */ - - mymac.type = SUBNET_MAC; - mymac.net.mac.address.x[0] = 0xfe; - mymac.net.mac.address.x[1] = 0xfd; - mymac.net.mac.address.x[2] = 0x00; - mymac.net.mac.address.x[3] = 0x00; - mymac.net.mac.address.x[4] = 0x00; - mymac.net.mac.address.x[5] = 0x00; - -#ifdef HAVE_TUNTAP - /* Ok now check if this is an old ethertap or a new tun/tap thingie */ - - memset(&ifr, 0, sizeof(ifr)); -cp - ifr.ifr_flags = IFF_TAP | IFF_NO_PI; - if (interface) - strncpy(ifr.ifr_name, interface, IFNAMSIZ); -cp - if (!ioctl(device_fd, TUNSETIFF, (void *) &ifr)) - { - device_info = _("Linux tun/tap device"); - device_type = DEVICE_TYPE_TUNTAP; - strncpy(ifrname, ifr.ifr_name, IFNAMSIZ); - interface = ifrname; - } - else - if (!ioctl(device_fd, (('T'<< 8) | 202), (void *) &ifr)) - { - syslog(LOG_WARNING, _("Old ioctl() request was needed for %s"), device); - device_type = DEVICE_TYPE_TUNTAP; - device_info = _("Linux tun/tap device"); - strncpy(ifrname, ifr.ifr_name, IFNAMSIZ); - interface = ifrname; - } - else -#endif - { - device_info = _("Linux ethertap device"); - device_type = DEVICE_TYPE_ETHERTAP; - interface = rindex(device, '/')?rindex(device, '/')+1:device; - } - - syslog(LOG_INFO, _("%s is a %s"), device, device_info); -cp - return 0; -} - -void close_device(void) -{ -cp - close(device_fd); -} - -/* - read, encrypt and send data that is - available through the ethertap device -*/ -int read_packet(vpn_packet_t *packet) -{ - int lenin; -cp - if(device_type == DEVICE_TYPE_TUNTAP) - { - if((lenin = read(device_fd, packet->data, MTU)) <= 0) - { - syslog(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, device, strerror(errno)); - return -1; - } - - packet->len = lenin; - } - else /* ethertap */ - { - if((lenin = read(device_fd, packet->data - 2, MTU + 2)) <= 0) - { - syslog(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, device, strerror(errno)); - return -1; - } - - packet->len = lenin - 2; - } - - device_total_in += packet->len; - - if(debug_lvl >= DEBUG_TRAFFIC) - { - syslog(LOG_DEBUG, _("Read packet of %d bytes from %s"), packet->len, device_info); - } - - return 0; -cp -} - -int write_packet(vpn_packet_t *packet) -{ -cp - if(debug_lvl >= DEBUG_TRAFFIC) - syslog(LOG_DEBUG, _("Writing packet of %d bytes to %s"), - packet->len, device_info); - - if(device_type == DEVICE_TYPE_TUNTAP) - { - if(write(device_fd, packet->data, packet->len) < 0) - { - syslog(LOG_ERR, _("Can't write to %s %s: %s"), device_info, device, strerror(errno)); - return -1; - } - } - else/* ethertap */ - { - *(short int *)(packet->data - 2) = packet->len; - if(write(device_fd, packet->data - 2, packet->len + 2) < 0) - { - syslog(LOG_ERR, _("Can't write to %s %s: %s"), device_info, device, strerror(errno)); - return -1; - } - } - - device_total_out += packet->len; -cp - return 0; -} - -void dump_device_stats(void) -{ -cp - syslog(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device); - syslog(LOG_DEBUG, _(" total bytes in: %10d"), device_total_in); - syslog(LOG_DEBUG, _(" total bytes out: %10d"), device_total_out); -cp -} diff --git a/src/device.h b/src/device.h index 3d3aa76..6ecbd92 100644 --- a/src/device.h +++ b/src/device.h @@ -1,7 +1,7 @@ /* net.h -- generic header for device.c - Copyright (C) 2001-2002 Ivo Timmermans - 2001-2002 Guus Sliepen + Copyright (C) 2001-2004 Ivo Timmermans + 2001-2004 Guus Sliepen 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 @@ -17,20 +17,23 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: device.h,v 1.1.2.5 2002/02/10 21:57:54 guus Exp $ + $Id: device.h 1374 2004-03-21 14:21:22Z guus $ */ #ifndef __TINC_DEVICE_H__ #define __TINC_DEVICE_H__ +#include "net.h" + extern int device_fd; extern char *device; -extern char *interface; -extern int setup_device(void); +extern char *iface; + +extern bool setup_device(void); extern void close_device(void); -extern int read_packet(vpn_packet_t *); -extern int write_packet(vpn_packet_t *); +extern bool read_packet(struct vpn_packet_t *); +extern bool write_packet(struct vpn_packet_t *); extern void dump_device_stats(void); -#endif /* __TINC_DEVICE_H__ */ +#endif /* __TINC_DEVICE_H__ */ diff --git a/src/edge.c b/src/edge.c index c35af07..be4cd4b 100644 --- a/src/edge.c +++ b/src/edge.c @@ -1,7 +1,7 @@ /* edge.c -- edge tree management - Copyright (C) 2000-2002 Guus Sliepen , - 2000-2002 Ivo Timmermans + Copyright (C) 2000-2004 Guus Sliepen , + 2000-2004 Ivo Timmermans 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 @@ -17,195 +17,146 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: edge.c,v 1.1.2.10 2002/03/27 15:26:43 guus Exp $ + $Id: edge.c 1374 2004-03-21 14:21:22Z guus $ */ -#include "config.h" - -#include -#include -#include - -#include -#include - -#include "net.h" /* Don't ask. */ -#include "netutl.h" -#include "config.h" -#include "conf.h" -#include -#include "subnet.h" - -#include "xalloc.h" #include "system.h" -avl_tree_t *edge_tree; /* Tree with all known edges (replaces active_tree) */ -avl_tree_t *edge_weight_tree; /* Tree with all edges, sorted on weight */ +#include "avl_tree.h" +#include "edge.h" +#include "logger.h" +#include "netutl.h" +#include "node.h" +#include "utils.h" +#include "xalloc.h" -int edge_compare(edge_t *a, edge_t *b) +avl_tree_t *edge_weight_tree; /* Tree with all edges, sorted on weight */ + +static int edge_compare(const edge_t *a, const edge_t *b) { - int result; - - result = strcmp(a->from.node->name, b->from.node->name); - - if(result) - return result; - else - return strcmp(a->to.node->name, b->to.node->name); + return strcmp(a->to->name, b->to->name); } -/* Evil edge_compare() from a parallel universe ;) - -int edge_compare(edge_t *a, edge_t *b) +static int edge_weight_compare(const edge_t *a, const edge_t *b) { - int result; + int result; - return (result = strcmp(a->from.node->name, b->from.node->name)) || (result = strcmp(a->to.node->name, b->to.node->name)), result; -} + result = a->weight - b->weight; -*/ + if(result) + return result; -int edge_name_compare(edge_t *a, edge_t *b) -{ - int result; - char *name_a1, *name_a2, *name_b1, *name_b2; + result = strcmp(a->from->name, b->from->name); - if(strcmp(a->from.node->name, a->to.node->name) < 0) - name_a1 = a->from.node->name, name_a2 = a->to.node->name; - else - name_a1 = a->to.node->name, name_a2 = a->from.node->name; + if(result) + return result; - if(strcmp(b->from.node->name, b->to.node->name) < 0) - name_b1 = b->from.node->name, name_b2 = b->to.node->name; - else - name_b1 = b->to.node->name, name_b2 = b->from.node->name; - - result = strcmp(name_a1, name_b1); - - if(result) - return result; - else - return strcmp(name_a2, name_b2); -} - -int edge_weight_compare(edge_t *a, edge_t *b) -{ - int result; - - result = a->weight - b->weight; - - if(result) - return result; - else - return edge_name_compare(a, b); + return strcmp(a->to->name, b->to->name); } void init_edges(void) { -cp - edge_tree = avl_alloc_tree((avl_compare_t)edge_compare, NULL); - edge_weight_tree = avl_alloc_tree((avl_compare_t)edge_weight_compare, NULL); -cp + cp(); + + edge_weight_tree = avl_alloc_tree((avl_compare_t) edge_weight_compare, NULL); } avl_tree_t *new_edge_tree(void) { -cp - return avl_alloc_tree((avl_compare_t)edge_name_compare, NULL); -cp + cp(); + + return avl_alloc_tree((avl_compare_t) edge_compare, (avl_action_t) free_edge); } void free_edge_tree(avl_tree_t *edge_tree) { -cp - avl_delete_tree(edge_tree); -cp + cp(); + + avl_delete_tree(edge_tree); } void exit_edges(void) { -cp - avl_delete_tree(edge_tree); -cp + cp(); + + avl_delete_tree(edge_weight_tree); } /* Creation and deletion of connection elements */ edge_t *new_edge(void) { - edge_t *e; -cp - e = (edge_t *)xmalloc_and_zero(sizeof(*e)); -cp - return e; + cp(); + + return xmalloc_and_zero(sizeof(edge_t)); } void free_edge(edge_t *e) { -cp - free(e); -cp + cp(); + + sockaddrfree(&e->address); + + free(e); } void edge_add(edge_t *e) { -cp - avl_insert(edge_tree, e); - avl_insert(edge_weight_tree, e); - avl_insert(e->from.node->edge_tree, e); - avl_insert(e->to.node->edge_tree, e); -cp + cp(); + + avl_insert(edge_weight_tree, e); + avl_insert(e->from->edge_tree, e); + + e->reverse = lookup_edge(e->to, e->from); + + if(e->reverse) + e->reverse->reverse = e; } void edge_del(edge_t *e) { -cp - avl_delete(edge_tree, e); - avl_delete(edge_weight_tree, e); - avl_delete(e->from.node->edge_tree, e); - avl_delete(e->to.node->edge_tree, e); -cp + cp(); + + if(e->reverse) + e->reverse->reverse = NULL; + + avl_delete(edge_weight_tree, e); + avl_delete(e->from->edge_tree, e); } edge_t *lookup_edge(node_t *from, node_t *to) { - edge_t v, *result; -cp - v.from.node = from; - v.to.node = to; + edge_t v; + + cp(); - result = avl_search(edge_tree, &v); + v.from = from; + v.to = to; - if(result) - return result; -cp - v.from.node = to; - v.to.node = from; - - return avl_search(edge_tree, &v); + return avl_search(from->edge_tree, &v); } void dump_edges(void) { - avl_node_t *node; - edge_t *e; - char *from_udp, *to_udp; -cp - syslog(LOG_DEBUG, _("Edges:")); + avl_node_t *node, *node2; + node_t *n; + edge_t *e; + char *address; - for(node = edge_tree->head; node; node = node->next) - { - e = (edge_t *)node->data; - from_udp = sockaddr2hostname(&e->from.udpaddress); - to_udp = sockaddr2hostname(&e->to.udpaddress); - syslog(LOG_DEBUG, _(" %s at %s - %s at %s options %lx weight %d"), - e->from.node->name, from_udp, - e->to.node->name, to_udp, - e->options, e->weight); - free(from_udp); - free(to_udp); - } + cp(); - syslog(LOG_DEBUG, _("End of edges.")); -cp + logger(LOG_DEBUG, _("Edges:")); + + for(node = node_tree->head; node; node = node->next) { + n = node->data; + for(node2 = n->edge_tree->head; node2; node2 = node2->next) { + e = node2->data; + address = sockaddr2hostname(&e->address); + logger(LOG_DEBUG, _(" %s to %s at %s options %lx weight %d"), + e->from->name, e->to->name, address, e->options, e->weight); + free(address); + } + } + + logger(LOG_DEBUG, _("End of edges.")); } diff --git a/src/edge.h b/src/edge.h index 604082f..0755376 100644 --- a/src/edge.h +++ b/src/edge.h @@ -1,7 +1,7 @@ /* edge.h -- header for edge.c - Copyright (C) 2001-2002 Guus Sliepen , - 2001-2002 Ivo Timmermans + Copyright (C) 2001-2004 Guus Sliepen , + 2001-2004 Ivo Timmermans 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 @@ -17,46 +17,40 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: edge.h,v 1.1.2.7 2002/03/22 11:43:46 guus Exp $ + $Id: edge.h 1374 2004-03-21 14:21:22Z guus $ */ #ifndef __TINC_EDGE_H__ #define __TINC_EDGE_H__ -#include - +#include "avl_tree.h" +#include "connection.h" #include "net.h" #include "node.h" -#include "connection.h" - -typedef struct halfconnection_t { - struct node_t *node; /* node associated with this end of the connection */ -// sockaddr_t tcpaddress; /* real (internet) ip on this end of the meta connection */ - sockaddr_t udpaddress; /* real (internet) ip on this end of the vpn connection */ -} halfconnection_t; typedef struct edge_t { - struct halfconnection_t from; - struct halfconnection_t to; + struct node_t *from; + struct node_t *to; + sockaddr_t address; - long int options; /* options turned on for this edge */ - int weight; /* weight of this edge */ - - struct connection_t *connection; /* connection associated with this edge, if available */ + long int options; /* options turned on for this edge */ + int weight; /* weight of this edge */ + + struct connection_t *connection; /* connection associated with this edge, if available */ + struct edge_t *reverse; /* edge in the opposite direction, if available */ } edge_t; -extern avl_tree_t *edge_tree; /* Tree with all known edges (replaces active_tree) */ -extern avl_tree_t *edge_weight_tree; /* Tree with all known edges sorted on weight */ +extern avl_tree_t *edge_weight_tree; /* Tree with all known edges sorted on weight */ extern void init_edges(void); extern void exit_edges(void); -extern edge_t *new_edge(void); +extern edge_t *new_edge(void) __attribute__ ((__malloc__)); extern void free_edge(edge_t *); -extern avl_tree_t *new_edge_tree(void); +extern avl_tree_t *new_edge_tree(void) __attribute__ ((__malloc__)); extern void free_edge_tree(avl_tree_t *); extern void edge_add(edge_t *); extern void edge_del(edge_t *); extern edge_t *lookup_edge(struct node_t *, struct node_t *); extern void dump_edges(void); -#endif /* __TINC_EDGE_H__ */ +#endif /* __TINC_EDGE_H__ */ diff --git a/src/event.c b/src/event.c index 028483b..8c54e22 100644 --- a/src/event.c +++ b/src/event.c @@ -1,7 +1,7 @@ /* event.c -- event queue - Copyright (C) 2002 Guus Sliepen , - 2002 Ivo Timmermans + Copyright (C) 2002-2004 Guus Sliepen , + 2002-2004 Ivo Timmermans 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 @@ -17,94 +17,89 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: event.c,v 1.1.4.2 2002/03/01 14:09:30 guus Exp $ + $Id: event.c 1374 2004-03-21 14:21:22Z guus $ */ -#include "config.h" - -#include -#include -#include -#include -#include -#include - -#include "event.h" - #include "system.h" +#include "avl_tree.h" +#include "event.h" +#include "utils.h" +#include "xalloc.h" + avl_tree_t *event_tree; extern time_t now; int id; -int event_compare(event_t *a, event_t *b) +static int event_compare(const event_t *a, const event_t *b) { - if(a->time > b->time) - return 1; - if(a->time < b->time) - return -1; - return a->id - b->id; + if(a->time > b->time) + return 1; + + if(a->time < b->time) + return -1; + + return a->id - b->id; } void init_events(void) { -cp - event_tree = avl_alloc_tree((avl_compare_t)event_compare, NULL); -cp + cp(); + + event_tree = avl_alloc_tree((avl_compare_t) event_compare, NULL); } void exit_events(void) { -cp - avl_delete_tree(event_tree); -cp + cp(); + + avl_delete_tree(event_tree); } event_t *new_event(void) { - event_t *event; -cp - event = (event_t *)xmalloc_and_zero(sizeof(*event)); -cp - return event; + cp(); + + return xmalloc_and_zero(sizeof(event_t)); } void free_event(event_t *event) { -cp - free(event); -cp + cp(); + + free(event); } void event_add(event_t *event) { -cp - event->id = ++id; - avl_insert(event_tree, event); -cp + cp(); + + event->id = ++id; + avl_insert(event_tree, event); } void event_del(event_t *event) { -cp - avl_delete(event_tree, event); -cp + cp(); + + avl_delete(event_tree, event); } event_t *get_expired_event(void) { - event_t *event; -cp - if(event_tree->head) - { - event = (event_t *)event_tree->head->data; - if(event->time < now) - { - avl_delete(event_tree, event); - return event; - } - } -cp - return NULL; + event_t *event; + + cp(); + + if(event_tree->head) { + event = event_tree->head->data; + + if(event->time < now) { + avl_delete(event_tree, event); + return event; + } + } + + return NULL; } diff --git a/src/event.h b/src/event.h index 7a35612..a09544a 100644 --- a/src/event.h +++ b/src/event.h @@ -1,7 +1,7 @@ /* event.h -- header for event.c - Copyright (C) 2002 Guus Sliepen , - 2002 Ivo Timmermans + Copyright (C) 2002-2004 Guus Sliepen , + 2002-2004 Ivo Timmermans 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 @@ -17,32 +17,31 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: event.h,v 1.1.4.1 2002/02/11 10:05:58 guus Exp $ + $Id: event.h 1374 2004-03-21 14:21:22Z guus $ */ #ifndef __TINC_EVENT_H__ #define __TINC_EVENT_H__ -#include -#include +#include "avl_tree.h" -avl_tree_t *event_tree; +extern avl_tree_t *event_tree; typedef void (*event_handler_t)(void *); typedef struct { - time_t time; - int id; - event_handler_t handler; - void *data; + time_t time; + int id; + event_handler_t handler; + void *data; } event_t; extern void init_events(void); extern void exit_events(void); -extern event_t *new_event(void); +extern event_t *new_event(void) __attribute__ ((__malloc__)); extern void free_event(event_t *); extern void event_add(event_t *); extern void event_del(event_t *); extern event_t *get_expired_event(void); -#endif /* __TINC_EVENT_H__ */ +#endif /* __TINC_EVENT_H__ */ diff --git a/src/freebsd/device.c b/src/freebsd/device.c deleted file mode 100644 index 2f5f32e..0000000 --- a/src/freebsd/device.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - device.c -- Interaction with FreeBSD tap device - Copyright (C) 2001-2002 Ivo Timmermans , - 2001-2002 Guus Sliepen - - 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., 675 Mass Ave, Cambridge, MA 02139, USA. - - $Id: device.c,v 1.1.2.4 2002/02/18 16:25:19 guus Exp $ -*/ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include "conf.h" -#include "net.h" -#include "subnet.h" - -#include "system.h" - -#define DEFAULT_DEVICE "/dev/tap0" - -int device_fd = -1; -int device_type; -char *device; -char *interface; -char *device_info; -int device_total_in = 0; -int device_total_out = 0; - -extern subnet_t mymac; - -/* - open the local ethertap device -*/ -int setup_device(void) -{ -cp - if(!get_config_string(lookup_config(config_tree, "Device"), &device)) - device = DEFAULT_DEVICE; - - if(!get_config_string(lookup_config(config_tree, "Interface"), &interface)) - interface = rindex(device, '/')?rindex(device, '/')+1:device; -cp - if((device_fd = open(device, O_RDWR | O_NONBLOCK)) < 0) - { - syslog(LOG_ERR, _("Could not open %s: %s"), device, strerror(errno)); - return -1; - } -cp - - /* Set default MAC address for ethertap devices */ - - mymac.type = SUBNET_MAC; - mymac.net.mac.address.x[0] = 0xfe; - mymac.net.mac.address.x[1] = 0xfd; - mymac.net.mac.address.x[2] = 0x00; - mymac.net.mac.address.x[3] = 0x00; - mymac.net.mac.address.x[4] = 0x00; - mymac.net.mac.address.x[5] = 0x00; - - device_info = _("FreeBSD tap device"); - - syslog(LOG_INFO, _("%s is a %s"), device, device_info); -cp - return 0; -} - -void close_device(void) -{ -cp - close(device_fd); -} - -/* - read, encrypt and send data that is - available through the ethertap device -*/ -int read_packet(vpn_packet_t *packet) -{ - int lenin; -cp - if((lenin = read(device_fd, packet->data, MTU)) <= 0) - { - syslog(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, device, strerror(errno)); - return -1; - } - - packet->len = lenin; - - device_total_in += packet->len; - - if(debug_lvl >= DEBUG_TRAFFIC) - syslog(LOG_DEBUG, _("Read packet of %d bytes from %s"), - packet->len, device_info); - - return 0; -cp -} - -int write_packet(vpn_packet_t *packet) -{ -cp - if(debug_lvl >= DEBUG_TRAFFIC) - syslog(LOG_DEBUG, _("Writing packet of %d bytes to %s"), - packet->len, device_info); - - if(write(device_fd, packet->data, packet->len) < 0) - { - syslog(LOG_ERR, _("Error while writing to %s %s: %s"), device_info, device, strerror(errno)); - return -1; - } - - device_total_out += packet->len; -cp -} - -void dump_device_stats(void) -{ -cp - syslog(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device); - syslog(LOG_DEBUG, _(" total bytes in: %10d"), device_total_in); - syslog(LOG_DEBUG, _(" total bytes out: %10d"), device_total_out); -cp -} diff --git a/src/graph.c b/src/graph.c index 53152a5..d115eca 100644 --- a/src/graph.c +++ b/src/graph.c @@ -1,7 +1,7 @@ /* graph.c -- graph algorithms - Copyright (C) 2001-2002 Guus Sliepen , - 2001-2002 Ivo Timmermans + Copyright (C) 2001-2004 Guus Sliepen , + 2001-2004 Ivo Timmermans 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 @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: graph.c,v 1.1.2.11 2002/03/24 16:28:27 guus Exp $ + $Id: graph.c 1374 2004-03-21 14:21:22Z guus $ */ /* We need to generate two trees from the graph: @@ -44,27 +44,17 @@ destination address and port of a node if possible. */ -#include "config.h" - -#include -#include -#include "config.h" -#include -#if defined(HAVE_FREEBSD) || defined(HAVE_OPENBSD) - #include -#endif -#include - -#include -#include +#include "system.h" +#include "avl_tree.h" +#include "connection.h" +#include "device.h" +#include "edge.h" +#include "logger.h" #include "netutl.h" #include "node.h" -#include "edge.h" -#include "connection.h" #include "process.h" - -#include "system.h" +#include "utils.h" /* Implementation of Kruskal's algorithm. Running time: O(EN) @@ -73,75 +63,76 @@ void mst_kruskal(void) { - avl_node_t *node, *next; - edge_t *e; - node_t *n; - connection_t *c; - int nodes = 0; - int safe_edges = 0; - int skipped; + avl_node_t *node, *next; + edge_t *e; + node_t *n; + connection_t *c; + int nodes = 0; + int safe_edges = 0; + bool skipped; - /* Clear MST status on connections */ + cp(); + + /* Clear MST status on connections */ - for(node = connection_tree->head; node; node = node->next) - { - c = (connection_t *)node->data; - c->status.mst = 0; - } + for(node = connection_tree->head; node; node = node->next) { + c = node->data; + c->status.mst = false; + } - /* Do we have something to do at all? */ - - if(!edge_weight_tree->head) - return; + /* Do we have something to do at all? */ - if(debug_lvl >= DEBUG_SCARY_THINGS) - syslog(LOG_DEBUG, "Running Kruskal's algorithm:"); + if(!edge_weight_tree->head) + return; - /* Clear visited status on nodes */ + ifdebug(SCARY_THINGS) logger(LOG_DEBUG, "Running Kruskal's algorithm:"); - for(node = node_tree->head; node; node = node->next) - { - n = (node_t *)node->data; - n->status.visited = 0; - nodes++; - } + /* Clear visited status on nodes */ - /* Starting point */ - - ((edge_t *)edge_weight_tree->head->data)->from.node->status.visited = 1; + for(node = node_tree->head; node; node = node->next) { + n = node->data; + n->status.visited = false; + nodes++; + } - /* Add safe edges */ + /* Starting point */ - for(skipped = 0, node = edge_weight_tree->head; node; node = next) - { - next = node->next; - e = (edge_t *)node->data; + ((edge_t *) edge_weight_tree->head->data)->from->status.visited = true; - if(e->from.node->status.visited == e->to.node->status.visited) - { - skipped = 1; - continue; - } + /* Add safe edges */ - e->from.node->status.visited = 1; - e->to.node->status.visited = 1; - if(e->connection) - e->connection->status.mst = 1; + for(skipped = false, node = edge_weight_tree->head; node; node = next) { + next = node->next; + e = node->data; - safe_edges++; + if(!e->reverse || e->from->status.visited == e->to->status.visited) { + skipped = true; + continue; + } - if(debug_lvl >= DEBUG_SCARY_THINGS) - syslog(LOG_DEBUG, " Adding edge %s - %s weight %d", e->from.node->name, e->to.node->name, e->weight); + e->from->status.visited = true; + e->to->status.visited = true; - if(skipped) - { - next = edge_weight_tree->head; - continue; - } - } + if(e->connection) + e->connection->status.mst = true; - if(debug_lvl >= DEBUG_SCARY_THINGS) - syslog(LOG_DEBUG, "Done, counted %d nodes and %d safe edges.", nodes, safe_edges); + if(e->reverse->connection) + e->reverse->connection->status.mst = true; + + safe_edges++; + + ifdebug(SCARY_THINGS) logger(LOG_DEBUG, " Adding edge %s - %s weight %d", e->from->name, + e->to->name, e->weight); + + if(skipped) { + skipped = false; + next = edge_weight_tree->head; + continue; + } + } + + ifdebug(SCARY_THINGS) logger(LOG_DEBUG, "Done, counted %d nodes and %d safe edges.", nodes, + safe_edges); } /* Implementation of a simple breadth-first search algorithm. @@ -150,141 +141,165 @@ void mst_kruskal(void) void sssp_bfs(void) { - avl_node_t *node, *from, *next, *to; - edge_t *e; - node_t *n; - halfconnection_t to_hc, from_hc; - avl_tree_t *todo_tree; - int indirect; - char *name; + avl_node_t *node, *from, *next, *to; + edge_t *e; + node_t *n; + avl_tree_t *todo_tree; + bool indirect; + char *name; + char *address, *port; + char *envp[7]; + int i; - todo_tree = avl_alloc_tree(NULL, NULL); + cp(); - /* Clear visited status on nodes */ + todo_tree = avl_alloc_tree(NULL, NULL); - for(node = node_tree->head; node; node = node->next) - { - n = (node_t *)node->data; - n->status.visited = 0; - n->status.indirect = 1; - } + /* Clear visited status on nodes */ - /* Begin with myself */ - - myself->status.visited = 1; - myself->status.indirect = 0; - myself->nexthop = myself; - myself->via = myself; - node = avl_alloc_node(); - node->data = myself; - avl_insert_top(todo_tree, node); - - /* Loop while todo_tree is filled */ - - while(todo_tree->head) - { - for(from = todo_tree->head; from; from = next) /* "from" is the node from which we start */ - { - next = from->next; - n = (node_t *)from->data; - - for(to = n->edge_tree->head; to; to = to->next) /* "to" is the edge connected to "from" */ - { - e = (edge_t *)to->data; - - if(e->from.node == n) /* "from_hc" is the halfconnection with .node == from */ - to_hc = e->to, from_hc = e->from; - else - to_hc = e->from, from_hc = e->to; - - /* Situation: - - / - / - ------(n)from_hc-----to_hc - \ - \ - - n->address is set to the to_hc.udpaddress of the edge left of n. - We are currently examining the edge right of n: - - - If from_hc.udpaddress != n->address, then to_hc.node is probably - not reachable for the nodes left of n. We do as if the indirectdata - flag is set on edge e. - - If edge e provides for better reachability of to_hc.node, update - to_hc.node and (re)add it to the todo_tree to (re)examine the reachability - of nodes behind it. - */ - - indirect = n->status.indirect || e->options & OPTION_INDIRECT || ((n != myself) && sockaddrcmp(&n->address, &from_hc.udpaddress)); - - if(to_hc.node->status.visited && (!to_hc.node->status.indirect || indirect)) - continue; - - to_hc.node->status.visited = 1; - to_hc.node->status.indirect = indirect; - to_hc.node->nexthop = (n->nexthop == myself) ? to_hc.node : n->nexthop; - to_hc.node->via = indirect ? n->via : to_hc.node; - to_hc.node->options = e->options; - if(sockaddrcmp(&to_hc.node->address, &to_hc.udpaddress)) - { - node = avl_unlink(node_udp_tree, to_hc.node); - to_hc.node->address = to_hc.udpaddress; - if(to_hc.node->hostname) - free(to_hc.node->hostname); - to_hc.node->hostname = sockaddr2hostname(&to_hc.udpaddress); - avl_insert_node(node_udp_tree, node); - } - node = avl_alloc_node(); - node->data = to_hc.node; - avl_insert_before(todo_tree, from, node); - } - - avl_delete_node(todo_tree, from); - } - } - - avl_free_tree(todo_tree); - - /* Check reachability status. */ - - for(node = node_tree->head; node; node = next) - { - next = node->next; - n = (node_t *)node->data; - - if(n->status.visited) - { - if(!n->status.reachable) - { - if(debug_lvl >= DEBUG_TRAFFIC) - syslog(LOG_DEBUG, _("Node %s (%s) became reachable"), n->name, n->hostname); - n->status.reachable = 1; - asprintf(&name, "hosts/%s-up", n->name); - execute_script(name); - free(name); + for(node = node_tree->head; node; node = node->next) { + n = node->data; + n->status.visited = false; + n->status.indirect = true; } - } - else - { - if(n->status.reachable) - { - if(debug_lvl >= DEBUG_TRAFFIC) - syslog(LOG_DEBUG, _("Node %s (%s) became unreachable"), n->name, n->hostname); - n->status.reachable = 0; - n->status.validkey = 0; - n->status.waitingforkey = 0; - n->sent_seqno = 0; - asprintf(&name, "hosts/%s-down", n->name); - execute_script(name); - free(name); + + /* Begin with myself */ + + myself->status.visited = true; + myself->status.indirect = false; + myself->nexthop = myself; + myself->via = myself; + node = avl_alloc_node(); + node->data = myself; + avl_insert_top(todo_tree, node); + + /* Loop while todo_tree is filled */ + + while(todo_tree->head) { + for(from = todo_tree->head; from; from = next) { /* "from" is the node from which we start */ + next = from->next; + n = from->data; + + for(to = n->edge_tree->head; to; to = to->next) { /* "to" is the edge connected to "from" */ + e = to->data; + + if(!e->reverse) + continue; + + /* Situation: + + / + / + ----->(n)---e-->(e->to) + \ + \ + + Where e is an edge, (n) and (e->to) are nodes. + n->address is set to the e->address of the edge left of n to n. + We are currently examining the edge e right of n from n: + + - If e->reverse->address != n->address, then e->to is probably + not reachable for the nodes left of n. We do as if the indirectdata + flag is set on edge e. + - If edge e provides for better reachability of e->to, update + e->to and (re)add it to the todo_tree to (re)examine the reachability + of nodes behind it. + */ + + indirect = n->status.indirect || e->options & OPTION_INDIRECT + || ((n != myself) && sockaddrcmp(&n->address, &e->reverse->address)); + + if(e->to->status.visited + && (!e->to->status.indirect || indirect)) + continue; + + e->to->status.visited = true; + e->to->status.indirect = indirect; + e->to->nexthop = (n->nexthop == myself) ? e->to : n->nexthop; + e->to->via = indirect ? n->via : e->to; + e->to->options = e->options; + + if(sockaddrcmp(&e->to->address, &e->address)) { + node = avl_unlink(node_udp_tree, e->to); + sockaddrfree(&e->to->address); + sockaddrcpy(&e->to->address, &e->address); + + if(e->to->hostname) + free(e->to->hostname); + + e->to->hostname = sockaddr2hostname(&e->to->address); + avl_insert_node(node_udp_tree, node); + + if(e->to->options & OPTION_PMTU_DISCOVERY) { + e->to->mtuprobes = 0; + e->to->minmtu = 0; + e->to->maxmtu = MTU; + if(e->to->status.validkey) + send_mtu_probe(e->to); + } + } + + node = avl_alloc_node(); + node->data = e->to; + avl_insert_before(todo_tree, from, node); + } + + avl_delete_node(todo_tree, from); + } + } + + avl_free_tree(todo_tree); + + /* Check reachability status. */ + + for(node = node_tree->head; node; node = next) { + next = node->next; + n = node->data; + + if(n->status.visited != n->status.reachable) { + n->status.reachable = !n->status.reachable; + + if(n->status.reachable) { + ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Node %s (%s) became reachable"), + n->name, n->hostname); + } else { + ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Node %s (%s) became unreachable"), + n->name, n->hostname); + } + + n->status.validkey = false; + n->status.waitingforkey = false; + + n->maxmtu = MTU; + n->minmtu = 0; + n->mtuprobes = 0; + + asprintf(&envp[0], "NETNAME=%s", netname ? : ""); + asprintf(&envp[1], "DEVICE=%s", device ? : ""); + asprintf(&envp[2], "INTERFACE=%s", iface ? : ""); + asprintf(&envp[3], "NODE=%s", n->name); + sockaddr2str(&n->address, &address, &port); + asprintf(&envp[4], "REMOTEADDRESS=%s", address); + asprintf(&envp[5], "REMOTEPORT=%s", port); + envp[6] = NULL; + + asprintf(&name, + n->status.reachable ? "hosts/%s-up" : "hosts/%s-down", + n->name); + execute_script(name, envp); + + free(name); + free(address); + free(port); + + for(i = 0; i < 7; i++) + free(envp[i]); + } } - } - } } void graph(void) { - mst_kruskal(); - sssp_bfs(); + mst_kruskal(); + sssp_bfs(); } diff --git a/src/graph.h b/src/graph.h index 3c8c0d5..d968f17 100644 --- a/src/graph.h +++ b/src/graph.h @@ -1,7 +1,7 @@ /* graph.h -- header for graph.c - Copyright (C) 2001-2002 Guus Sliepen , - 2001-2002 Ivo Timmermans + Copyright (C) 2001-2004 Guus Sliepen , + 2001-2004 Ivo Timmermans 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 @@ -17,9 +17,14 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: graph.h,v 1.1.2.3 2002/02/10 21:57:54 guus Exp $ + $Id: graph.h 1374 2004-03-21 14:21:22Z guus $ */ +#ifndef __TINC_GRAPH_H__ +#define __TINC_GRAPH_H__ + extern void graph(void); extern void mst_kruskal(void); extern void sssp_bfs(void); + +#endif /* __TINC_GRAPH_H__ */ diff --git a/src/linux/device.c b/src/linux/device.c index e896f54..63c9d7c 100644 --- a/src/linux/device.c +++ b/src/linux/device.c @@ -1,7 +1,7 @@ /* device.c -- Interaction with Linux ethertap and tun/tap device - Copyright (C) 2001-2002 Ivo Timmermans , - 2001-2002 Guus Sliepen + Copyright (C) 2001-2004 Ivo Timmermans , + 2001-2004 Guus Sliepen 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 @@ -17,208 +17,206 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: device.c,v 1.1.2.8 2002/03/24 16:36:56 guus Exp $ + $Id: device.c 1400 2004-11-01 17:02:19Z guus $ */ -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef HAVE_TUNTAP - #ifdef LINUX_IF_TUN_H - #include LINUX_IF_TUN_H - #else - #include - #endif - #define DEFAULT_DEVICE "/dev/misc/net/tun" -#else - #define DEFAULT_DEVICE "/dev/tap0" -#endif - -#include -#include "conf.h" -#include "net.h" -#include "subnet.h" - #include "system.h" -#define DEVICE_TYPE_ETHERTAP 0 -#define DEVICE_TYPE_TUNTAP 1 +#ifdef HAVE_TUNTAP +#ifdef LINUX_IF_TUN_H +#include LINUX_IF_TUN_H +#else +#include +#endif +#define DEFAULT_DEVICE "/dev/net/tun" +#else +#define DEFAULT_DEVICE "/dev/tap0" +#endif + +#include "conf.h" +#include "logger.h" +#include "net.h" +#include "route.h" +#include "utils.h" + +typedef enum device_type_t { + DEVICE_TYPE_ETHERTAP, + DEVICE_TYPE_TUN, + DEVICE_TYPE_TAP, +} device_type_t; int device_fd = -1; -int device_type; +static device_type_t device_type; char *device; -char *interface; +char *iface; char ifrname[IFNAMSIZ]; char *device_info; -int device_total_in = 0; -int device_total_out = 0; +static int device_total_in = 0; +static int device_total_out = 0; -extern subnet_t mymac; - -/* - open the local ethertap device -*/ -int setup_device(void) +bool setup_device(void) { - struct ifreq ifr; + struct ifreq ifr; -cp - if(!get_config_string(lookup_config(config_tree, "Device"), &device)) - device = DEFAULT_DEVICE; + cp(); - if(!get_config_string(lookup_config(config_tree, "Interface"), &interface)) + if(!get_config_string(lookup_config(config_tree, "Device"), &device)) + device = DEFAULT_DEVICE; + + if(!get_config_string(lookup_config(config_tree, "Interface"), &iface)) #ifdef HAVE_TUNTAP - interface = netname; + iface = netname; #else - interface = rindex(device, '/')?rindex(device, '/')+1:device; + iface = rindex(device, '/') ? rindex(device, '/') + 1 : device; #endif -cp - if((device_fd = open(device, O_RDWR | O_NONBLOCK)) < 0) - { - syslog(LOG_ERR, _("Could not open %s: %s"), device, strerror(errno)); - return -1; - } -cp - /* Set default MAC address for ethertap devices */ + device_fd = open(device, O_RDWR | O_NONBLOCK); - mymac.type = SUBNET_MAC; - mymac.net.mac.address.x[0] = 0xfe; - mymac.net.mac.address.x[1] = 0xfd; - mymac.net.mac.address.x[2] = 0x00; - mymac.net.mac.address.x[3] = 0x00; - mymac.net.mac.address.x[4] = 0x00; - mymac.net.mac.address.x[5] = 0x00; + if(device_fd < 0) { + logger(LOG_ERR, _("Could not open %s: %s"), device, strerror(errno)); + return false; + } #ifdef HAVE_TUNTAP - /* Ok now check if this is an old ethertap or a new tun/tap thingie */ + /* Ok now check if this is an old ethertap or a new tun/tap thingie */ - memset(&ifr, 0, sizeof(ifr)); -cp - ifr.ifr_flags = IFF_TAP | IFF_NO_PI; - if (interface) - strncpy(ifr.ifr_name, interface, IFNAMSIZ); -cp - if (!ioctl(device_fd, TUNSETIFF, (void *) &ifr)) - { - device_info = _("Linux tun/tap device"); - device_type = DEVICE_TYPE_TUNTAP; - strncpy(ifrname, ifr.ifr_name, IFNAMSIZ); - interface = ifrname; - } - else - if (!ioctl(device_fd, (('T'<< 8) | 202), (void *) &ifr)) - { - syslog(LOG_WARNING, _("Old ioctl() request was needed for %s"), device); - device_type = DEVICE_TYPE_TUNTAP; - device_info = _("Linux tun/tap device"); - strncpy(ifrname, ifr.ifr_name, IFNAMSIZ); - interface = ifrname; - } - else + memset(&ifr, 0, sizeof(ifr)); + if(routing_mode == RMODE_ROUTER) { + ifr.ifr_flags = IFF_TUN; + device_type = DEVICE_TYPE_TUN; + device_info = _("Linux tun/tap device (tun mode)"); + } else { + ifr.ifr_flags = IFF_TAP | IFF_NO_PI; + device_type = DEVICE_TYPE_TAP; + device_info = _("Linux tun/tap device (tap mode)"); + } + + if(iface) + strncpy(ifr.ifr_name, iface, IFNAMSIZ); + + if(!ioctl(device_fd, TUNSETIFF, &ifr)) { + strncpy(ifrname, ifr.ifr_name, IFNAMSIZ); + iface = ifrname; + } else if(!ioctl(device_fd, (('T' << 8) | 202), &ifr)) { + logger(LOG_WARNING, _("Old ioctl() request was needed for %s"), device); + strncpy(ifrname, ifr.ifr_name, IFNAMSIZ); + iface = ifrname; + } else #endif - { - device_info = _("Linux ethertap device"); - device_type = DEVICE_TYPE_ETHERTAP; - interface = rindex(device, '/')?rindex(device, '/')+1:device; - } + { + if(routing_mode == RMODE_ROUTER) + overwrite_mac = true; + device_info = _("Linux ethertap device"); + device_type = DEVICE_TYPE_ETHERTAP; + iface = rindex(device, '/') ? rindex(device, '/') + 1 : device; + } - syslog(LOG_INFO, _("%s is a %s"), device, device_info); -cp - return 0; + logger(LOG_INFO, _("%s is a %s"), device, device_info); + + return true; } void close_device(void) { -cp - close(device_fd); + cp(); + + close(device_fd); } -/* - read, encrypt and send data that is - available through the ethertap device -*/ -int read_packet(vpn_packet_t *packet) +bool read_packet(vpn_packet_t *packet) { - int lenin; -cp - if(device_type == DEVICE_TYPE_TUNTAP) - { - if((lenin = read(device_fd, packet->data, MTU)) <= 0) - { - syslog(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, device, strerror(errno)); - return -1; - } + int lenin; + + cp(); - packet->len = lenin; - } - else /* ethertap */ - { - if((lenin = read(device_fd, packet->data - 2, MTU + 2)) <= 0) - { - syslog(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, device, strerror(errno)); - return -1; - } + switch(device_type) { + case DEVICE_TYPE_TUN: + lenin = read(device_fd, packet->data + 10, MTU - 10); - packet->len = lenin - 2; - } + if(lenin <= 0) { + logger(LOG_ERR, _("Error while reading from %s %s: %s"), + device_info, device, strerror(errno)); + return false; + } - device_total_in += packet->len; + packet->len = lenin + 10; + break; + case DEVICE_TYPE_TAP: + lenin = read(device_fd, packet->data, MTU); - if(debug_lvl >= DEBUG_TRAFFIC) - { - syslog(LOG_DEBUG, _("Read packet of %d bytes from %s"), packet->len, device_info); - } + if(lenin <= 0) { + logger(LOG_ERR, _("Error while reading from %s %s: %s"), + device_info, device, strerror(errno)); + return false; + } - return 0; -cp + packet->len = lenin; + break; + case DEVICE_TYPE_ETHERTAP: + lenin = read(device_fd, packet->data - 2, MTU + 2); + + if(lenin <= 0) { + logger(LOG_ERR, _("Error while reading from %s %s: %s"), + device_info, device, strerror(errno)); + return false; + } + + packet->len = lenin - 2; + break; + } + + device_total_in += packet->len; + + ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Read packet of %d bytes from %s"), packet->len, + device_info); + + return true; } -int write_packet(vpn_packet_t *packet) +bool write_packet(vpn_packet_t *packet) { -cp - if(debug_lvl >= DEBUG_TRAFFIC) - syslog(LOG_DEBUG, _("Writing packet of %d bytes to %s"), - packet->len, device_info); + cp(); - if(device_type == DEVICE_TYPE_TUNTAP) - { - if(write(device_fd, packet->data, packet->len) < 0) - { - syslog(LOG_ERR, _("Can't write to %s %s: %s"), device_info, device, strerror(errno)); - return -1; - } - } - else/* ethertap */ - { - *(short int *)(packet->data - 2) = packet->len; - if(write(device_fd, packet->data - 2, packet->len + 2) < 0) - { - syslog(LOG_ERR, _("Can't write to %s %s: %s"), device_info, device, strerror(errno)); - return -1; - } - } + ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Writing packet of %d bytes to %s"), + packet->len, device_info); - device_total_out += packet->len; -cp - return 0; + switch(device_type) { + case DEVICE_TYPE_TUN: + packet->data[10] = packet->data[11] = 0; + if(write(device_fd, packet->data + 10, packet->len - 10) < 0) { + logger(LOG_ERR, _("Can't write to %s %s: %s"), device_info, device, + strerror(errno)); + return false; + } + break; + case DEVICE_TYPE_TAP: + if(write(device_fd, packet->data, packet->len) < 0) { + logger(LOG_ERR, _("Can't write to %s %s: %s"), device_info, device, + strerror(errno)); + return false; + } + break; + case DEVICE_TYPE_ETHERTAP: + *(short int *)(packet->data - 2) = packet->len; + + if(write(device_fd, packet->data - 2, packet->len + 2) < 0) { + logger(LOG_ERR, _("Can't write to %s %s: %s"), device_info, device, + strerror(errno)); + return false; + } + break; + } + + device_total_out += packet->len; + + return true; } void dump_device_stats(void) { -cp - syslog(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device); - syslog(LOG_DEBUG, _(" total bytes in: %10d"), device_total_in); - syslog(LOG_DEBUG, _(" total bytes out: %10d"), device_total_out); -cp + cp(); + + logger(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device); + logger(LOG_DEBUG, _(" total bytes in: %10d"), device_total_in); + logger(LOG_DEBUG, _(" total bytes out: %10d"), device_total_out); } diff --git a/src/logger.c b/src/logger.c new file mode 100644 index 0000000..d2d3a28 --- /dev/null +++ b/src/logger.c @@ -0,0 +1,135 @@ +/* + logger.c -- logging code + Copyright (C) 2004 Guus Sliepen + 2004 Ivo Timmermans + + 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., 675 Mass Ave, Cambridge, MA 02139, USA. + + $Id: logger.c 1374 2004-03-21 14:21:22Z guus $ +*/ + +#include "system.h" + +#include "conf.h" +#include "logger.h" + +debug_t debug_level = DEBUG_NOTHING; +static logmode_t logmode = LOGMODE_STDERR; +static pid_t logpid; +extern char *logfilename; +static FILE *logfile = NULL; +#ifdef HAVE_MINGW +static HANDLE loghandle = NULL; +#endif +static const char *logident = NULL; + +void openlogger(const char *ident, logmode_t mode) { + logident = ident; + logmode = mode; + + switch(mode) { + case LOGMODE_STDERR: + logpid = getpid(); + break; + case LOGMODE_FILE: + logpid = getpid(); + logfile = fopen(logfilename, "a"); + if(!logfile) + logmode = LOGMODE_NULL; + break; + case LOGMODE_SYSLOG: +#ifdef HAVE_MINGW + loghandle = RegisterEventSource(NULL, logident); + if(!loghandle) + logmode = LOGMODE_NULL; + break; +#else +#ifdef HAVE_SYSLOG_H + openlog(logident, LOG_CONS | LOG_PID, LOG_DAEMON); + break; +#endif +#endif + case LOGMODE_NULL: + break; + } +} + +void logger(int priority, const char *format, ...) { + va_list ap; + + va_start(ap, format); + + switch(logmode) { + case LOGMODE_STDERR: + vfprintf(stderr, format, ap); + fprintf(stderr, "\n"); + fflush(stderr); + break; + case LOGMODE_FILE: + fprintf(logfile, "%ld %s[%ld]: ", time(NULL), logident, (long)logpid); + vfprintf(logfile, format, ap); + fprintf(logfile, "\n"); + fflush(logfile); + break; + case LOGMODE_SYSLOG: +#ifdef HAVE_MINGW + { + char message[4096]; + char *messages[] = {message}; + vsnprintf(message, sizeof(message), format, ap); + ReportEvent(loghandle, priority, 0, 0, NULL, 1, 0, messages, NULL); + } +#else +#ifdef HAVE_SYSLOG_H +#ifdef HAVE_VSYSLOG + vsyslog(priority, format, ap); +#else + { + char message[4096]; + vsnprintf(message, sizeof(message), format, ap); + syslog(priority, "%s", message); + } +#endif + break; +#endif +#endif + case LOGMODE_NULL: + break; + } + + va_end(ap); +} + +void closelogger(void) { + switch(logmode) { + case LOGMODE_FILE: + fclose(logfile); + break; + case LOGMODE_SYSLOG: +#ifdef HAVE_MINGW + DeregisterEventSource(loghandle); + break; +#else +#ifdef HAVE_SYSLOG_H + closelog(); + break; +#endif +#endif + case LOGMODE_NULL: + case LOGMODE_STDERR: + break; + break; + } +} diff --git a/src/logger.h b/src/logger.h new file mode 100644 index 0000000..9c20ead --- /dev/null +++ b/src/logger.h @@ -0,0 +1,55 @@ +#ifndef __TINC_LOGGER_H__ +#define __TINC_LOGGER_H__ + +typedef enum debug_t { + DEBUG_NOTHING = 0, /* Quiet mode, only show starting/stopping of the daemon */ + DEBUG_ALWAYS = 0, + DEBUG_CONNECTIONS = 1, /* Show (dis)connects of other tinc daemons via TCP */ + DEBUG_ERROR = 2, /* Show error messages received from other hosts */ + DEBUG_STATUS = 2, /* Show status messages received from other hosts */ + DEBUG_PROTOCOL = 3, /* Show the requests that are sent/received */ + DEBUG_META = 4, /* Show contents of every request that is sent/received */ + DEBUG_TRAFFIC = 5, /* Show network traffic information */ + DEBUG_PACKET = 6, /* Show contents of each packet that is being sent/received */ + DEBUG_SCARY_THINGS = 10 /* You have been warned */ +} debug_t; + +typedef enum logmode_t { + LOGMODE_NULL, + LOGMODE_STDERR, + LOGMODE_FILE, + LOGMODE_SYSLOG +} logmode_t; + +#ifdef HAVE_MINGW +#define LOG_EMERG EVENTLOG_ERROR_TYPE +#define LOG_ALERT EVENTLOG_ERROR_TYPE +#define LOG_CRIT EVENTLOG_ERROR_TYPE +#define LOG_ERR EVENTLOG_ERROR_TYPE +#define LOG_WARNING EVENTLOG_WARNING_TYPE +#define LOG_NOTICE EVENTLOG_INFORMATION_TYPE +#define LOG_INFO EVENTLOG_INFORMATION_TYPE +#define LOG_DEBUG EVENTLOG_INFORMATION_TYPE +#else +#ifndef HAVE_SYSLOG_H +enum { + LOG_EMERG, + LOG_ALERT, + LOG_CRIT, + LOG_ERR, + LOG_WARNING, + LOG_NOTICE, + LOG_INFO, + LOG_DEBUG, +}; +#endif +#endif + +extern debug_t debug_level; +extern void openlogger(const char *, logmode_t); +extern void logger(int, const char *, ...) __attribute__ ((__format__(printf, 2, 3))); +extern void closelogger(void); + +#define ifdebug(l) if(debug_level >= DEBUG_##l) + +#endif /* __TINC_LOGGER_H__ */ diff --git a/src/meta.c b/src/meta.c index b51c64d..f3283f3 100644 --- a/src/meta.c +++ b/src/meta.c @@ -1,7 +1,7 @@ /* meta.c -- handle the meta communication - Copyright (C) 2000-2002 Guus Sliepen , - 2000-2002 Ivo Timmermans + Copyright (C) 2000-2004 Guus Sliepen , + 2000-2004 Ivo Timmermans 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 @@ -17,194 +17,182 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: meta.c,v 1.1.2.25 2002/03/01 14:09:31 guus Exp $ + $Id: meta.c 1391 2004-09-20 20:56:14Z guus $ */ -#include "config.h" -#include -#include - -#include -#include -#include -#include -/* This line must be below the rest for FreeBSD */ -#include -#include +#include "system.h" +#include #include -#include "net.h" +#include "avl_tree.h" #include "connection.h" -#include "system.h" +#include "logger.h" +#include "meta.h" +#include "net.h" #include "protocol.h" +#include "utils.h" -int send_meta(connection_t *c, char *buffer, int length) +bool send_meta(connection_t *c, const char *buffer, int length) { - char *bufp; - int outlen; - char outbuf[MAXBUFSIZE]; -cp - if(debug_lvl >= DEBUG_META) - syslog(LOG_DEBUG, _("Sending %d bytes of metadata to %s (%s)"), length, - c->name, c->hostname); + const char *bufp; + int outlen; + char outbuf[MAXBUFSIZE]; + int result; - if(c->status.encryptout) - { - EVP_EncryptUpdate(c->outctx, outbuf, &outlen, buffer, length); - bufp = outbuf; - length = outlen; - } - else - bufp = buffer; + cp(); - if(write(c->socket, bufp, length) < 0) - { - syslog(LOG_ERR, _("Sending meta data to %s (%s) failed: %s"), c->name, c->hostname, strerror(errno)); - return -1; - } -cp - return 0; + ifdebug(META) logger(LOG_DEBUG, _("Sending %d bytes of metadata to %s (%s)"), length, + c->name, c->hostname); + + if(c->status.encryptout) { + result = EVP_EncryptUpdate(c->outctx, outbuf, &outlen, buffer, length); + if(!result || outlen != length) { + logger(LOG_ERR, _("Error while encrypting metadata to %s (%s): %s"), + c->name, c->hostname, ERR_error_string(ERR_get_error(), NULL)); + return false; + } + bufp = outbuf; + length = outlen; + } else + bufp = buffer; + + while(length) { + result = send(c->socket, bufp, length, 0); + if(result <= 0) { + if(!errno || errno == EPIPE) { + ifdebug(CONNECTIONS) logger(LOG_NOTICE, _("Connection closed by %s (%s)"), + c->name, c->hostname); + } else if(errno == EINTR) + continue; + else + logger(LOG_ERR, _("Sending meta data to %s (%s) failed: %s"), c->name, + c->hostname, strerror(errno)); + return false; + } + bufp += result; + length -= result; + } + + return true; } -void broadcast_meta(connection_t *from, char *buffer, int length) +void broadcast_meta(connection_t *from, const char *buffer, int length) { - avl_node_t *node; - connection_t *c; -cp - for(node = connection_tree->head; node; node = node->next) - { - c = (connection_t *)node->data; - if(c != from && c->status.active) - send_meta(c, buffer, length); - } -cp + avl_node_t *node; + connection_t *c; + + cp(); + + for(node = connection_tree->head; node; node = node->next) { + c = node->data; + + if(c != from && c->status.active) + send_meta(c, buffer, length); + } } -int receive_meta(connection_t *c) +bool receive_meta(connection_t *c) { - int x, l = sizeof(x); - int oldlen, i; - int lenin, reqlen; - int decrypted = 0; - char inbuf[MAXBUFSIZE]; -cp - if(getsockopt(c->socket, SOL_SOCKET, SO_ERROR, &x, &l) < 0) - { - syslog(LOG_ERR, _("This is a bug: %s:%d: %d:%s %s (%s)"), __FILE__, __LINE__, c->socket, strerror(errno), - c->name, c->hostname); - return -1; - } - if(x) - { - syslog(LOG_ERR, _("Metadata socket error for %s (%s): %s"), - c->name, c->hostname, strerror(x)); - return -1; - } + int oldlen, i, result; + int lenin, lenout, reqlen; + bool decrypted = false; + char inbuf[MAXBUFSIZE]; - /* Strategy: - - Read as much as possible from the TCP socket in one go. - - Decrypt it. - - Check if a full request is in the input buffer. - - If yes, process request and remove it from the buffer, - then check again. - - If not, keep stuff in buffer and exit. - */ + cp(); - lenin = read(c->socket, c->buffer + c->buflen, MAXBUFSIZE - c->buflen); + /* Strategy: + - Read as much as possible from the TCP socket in one go. + - Decrypt it. + - Check if a full request is in the input buffer. + - If yes, process request and remove it from the buffer, + then check again. + - If not, keep stuff in buffer and exit. + */ - if(lenin<=0) - { - if(lenin==0) - { - if(debug_lvl >= DEBUG_CONNECTIONS) - syslog(LOG_NOTICE, _("Connection closed by %s (%s)"), - c->name, c->hostname); - } - else - if(errno==EINTR) - return 0; - else - syslog(LOG_ERR, _("Metadata socket read error for %s (%s): %s"), - c->name, c->hostname, strerror(errno)); + lenin = recv(c->socket, c->buffer + c->buflen, MAXBUFSIZE - c->buflen, 0); - return -1; - } + if(lenin <= 0) { + if(!lenin || !errno) { + ifdebug(CONNECTIONS) logger(LOG_NOTICE, _("Connection closed by %s (%s)"), + c->name, c->hostname); + } else if(errno == EINTR) + return true; + else + logger(LOG_ERR, _("Metadata socket read error for %s (%s): %s"), + c->name, c->hostname, strerror(errno)); - oldlen = c->buflen; - c->buflen += lenin; + return false; + } - while(lenin) - { - /* Decrypt */ + oldlen = c->buflen; + c->buflen += lenin; - if(c->status.decryptin && !decrypted) - { - EVP_DecryptUpdate(c->inctx, inbuf, &lenin, c->buffer + oldlen, lenin); - memcpy(c->buffer + oldlen, inbuf, lenin); - decrypted = 1; - } + while(lenin > 0) { + /* Decrypt */ - /* Are we receiving a TCPpacket? */ + if(c->status.decryptin && !decrypted) { + result = EVP_DecryptUpdate(c->inctx, inbuf, &lenout, c->buffer + oldlen, lenin); + if(!result || lenout != lenin) { + logger(LOG_ERR, _("Error while decrypting metadata from %s (%s): %s"), + c->name, c->hostname, ERR_error_string(ERR_get_error(), NULL)); + return false; + } + memcpy(c->buffer + oldlen, inbuf, lenin); + decrypted = true; + } - if(c->tcplen) - { - if(c->tcplen <= c->buflen) - { - receive_tcppacket(c, c->buffer, c->tcplen); + /* Are we receiving a TCPpacket? */ - c->buflen -= c->tcplen; - lenin -= c->tcplen; - memmove(c->buffer, c->buffer + c->tcplen, c->buflen); - oldlen = 0; - c->tcplen = 0; - continue; - } - else - { - break; - } - } + if(c->tcplen) { + if(c->tcplen <= c->buflen) { + receive_tcppacket(c, c->buffer, c->tcplen); - /* Otherwise we are waiting for a request */ + c->buflen -= c->tcplen; + lenin -= c->tcplen - oldlen; + memmove(c->buffer, c->buffer + c->tcplen, c->buflen); + oldlen = 0; + c->tcplen = 0; + continue; + } else { + break; + } + } - reqlen = 0; + /* Otherwise we are waiting for a request */ - for(i = oldlen; i < c->buflen; i++) - { - if(c->buffer[i] == '\n') - { - c->buffer[i] = '\0'; /* replace end-of-line by end-of-string so we can use sscanf */ - reqlen = i + 1; - break; - } - } + reqlen = 0; - if(reqlen) - { - if(receive_request(c)) - return -1; + for(i = oldlen; i < c->buflen; i++) { + if(c->buffer[i] == '\n') { + c->buffer[i] = '\0'; /* replace end-of-line by end-of-string so we can use sscanf */ + reqlen = i + 1; + break; + } + } - c->buflen -= reqlen; - lenin -= reqlen; - memmove(c->buffer, c->buffer + reqlen, c->buflen); - oldlen = 0; - continue; - } - else - { - break; - } - } + if(reqlen) { + c->reqlen = reqlen; + if(!receive_request(c)) + return false; - if(c->buflen >= MAXBUFSIZE) - { - syslog(LOG_ERR, _("Metadata read buffer overflow for %s (%s)"), - c->name, c->hostname); - return -1; - } + c->buflen -= reqlen; + lenin -= reqlen - oldlen; + memmove(c->buffer, c->buffer + reqlen, c->buflen); + oldlen = 0; + continue; + } else { + break; + } + } - c->last_ping_time = now; -cp - return 0; + if(c->buflen >= MAXBUFSIZE) { + logger(LOG_ERR, _("Metadata read buffer overflow for %s (%s)"), + c->name, c->hostname); + return false; + } + + c->last_ping_time = now; + + return true; } diff --git a/src/meta.h b/src/meta.h index d54573e..b0132c0 100644 --- a/src/meta.h +++ b/src/meta.h @@ -1,7 +1,7 @@ /* meta.h -- header for meta.c - Copyright (C) 2000-2002 Guus Sliepen , - 2000-2002 Ivo Timmermans + Copyright (C) 2000-2004 Guus Sliepen , + 2000-2004 Ivo Timmermans 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 @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: meta.h,v 1.1.2.6 2002/02/10 21:57:54 guus Exp $ + $Id: meta.h 1374 2004-03-21 14:21:22Z guus $ */ #ifndef __TINC_META_H__ @@ -25,8 +25,8 @@ #include "connection.h" -extern int send_meta(connection_t *, const char *, int); -extern int broadcast_meta(connection_t *, const char *, int); -extern int receive_meta(connection_t *); +extern bool send_meta(struct connection_t *, const char *, int); +extern void broadcast_meta(struct connection_t *, const char *, int); +extern bool receive_meta(struct connection_t *); -#endif /* __TINC_META_H__ */ +#endif /* __TINC_META_H__ */ diff --git a/src/mingw/common.h b/src/mingw/common.h new file mode 100644 index 0000000..39a8349 --- /dev/null +++ b/src/mingw/common.h @@ -0,0 +1,76 @@ +/* + * TAP-Win32 -- A kernel driver to provide virtual tap device functionality + * on Windows. Originally derived from the CIPE-Win32 + * project by Damion K. Wilson, with extensive modifications by + * James Yonan. + * + * All source code which derives from the CIPE-Win32 project is + * Copyright (C) Damion K. Wilson, 2003, and is released under the + * GPL version 2 (see below). + * + * All other source code is Copyright (C) James Yonan, 2003-2004, + * and is released under the GPL version 2 (see below). + * + * 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 (see the file COPYING included with this + * distribution); if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +//=============================================== +// This file is included both by OpenVPN and +// the TAP-Win32 driver and contains definitions +// common to both. +//=============================================== + +//============= +// TAP IOCTLs +//============= + +#define TAP_CONTROL_CODE(request,method) \ + CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS) + +#define TAP_IOCTL_GET_MAC TAP_CONTROL_CODE (1, METHOD_BUFFERED) +#define TAP_IOCTL_GET_VERSION TAP_CONTROL_CODE (2, METHOD_BUFFERED) +#define TAP_IOCTL_GET_MTU TAP_CONTROL_CODE (3, METHOD_BUFFERED) +#define TAP_IOCTL_GET_INFO TAP_CONTROL_CODE (4, METHOD_BUFFERED) +#define TAP_IOCTL_CONFIG_POINT_TO_POINT TAP_CONTROL_CODE (5, METHOD_BUFFERED) +#define TAP_IOCTL_SET_MEDIA_STATUS TAP_CONTROL_CODE (6, METHOD_BUFFERED) +#define TAP_IOCTL_CONFIG_DHCP_MASQ TAP_CONTROL_CODE (7, METHOD_BUFFERED) +#define TAP_IOCTL_GET_LOG_LINE TAP_CONTROL_CODE (8, METHOD_BUFFERED) +#define TAP_IOCTL_CONFIG_DHCP_SET_OPT TAP_CONTROL_CODE (9, METHOD_BUFFERED) + +//================= +// Registry keys +//================= + +#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}" + +#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}" + +//====================== +// Filesystem prefixes +//====================== + +#define USERMODEDEVICEDIR "\\\\.\\Global\\" +#define SYSDEVICEDIR "\\Device\\" +#define USERDEVICEDIR "\\DosDevices\\Global\\" +#define TAPSUFFIX ".tap" + +//========================================================= +// TAP_COMPONENT_ID -- This string defines the TAP driver +// type -- different component IDs can reside in the system +// simultaneously. +//========================================================= + +#define TAP_COMPONENT_ID "tap0801" diff --git a/src/mingw/device.c b/src/mingw/device.c new file mode 100644 index 0000000..363455a --- /dev/null +++ b/src/mingw/device.c @@ -0,0 +1,345 @@ +/* + device.c -- Interaction with Windows tap driver in a MinGW environment + Copyright (C) 2002-2004 Ivo Timmermans , + 2002-2004 Guus Sliepen + + 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., 675 Mass Ave, Cambridge, MA 02139, USA. + + $Id: device.c 1400 2004-11-01 17:02:19Z guus $ +*/ + +#include "system.h" + +#include +#include + +#include "conf.h" +#include "logger.h" +#include "net.h" +#include "route.h" +#include "utils.h" +#include "xalloc.h" + +#include "mingw/common.h" + +int device_fd = 0; +static HANDLE device_handle = INVALID_HANDLE_VALUE; +char *device = NULL; +char *iface = NULL; +char *device_info = NULL; + +static int device_total_in = 0; +static int device_total_out = 0; + +extern char *myport; + +DWORD WINAPI tapreader(void *bla) { + int sock, err, status; + struct addrinfo *ai; + struct addrinfo hint = { + .ai_family = AF_UNSPEC, + .ai_socktype = SOCK_DGRAM, + .ai_protocol = IPPROTO_UDP, + .ai_flags = 0, + }; + char buf[MTU]; + long len; + OVERLAPPED overlapped; + + /* Open a socket to the parent process */ + + err = getaddrinfo(NULL, myport, &hint, &ai); + + if(err || !ai) { + logger(LOG_ERR, _("System call `%s' failed: %s"), "getaddrinfo", gai_strerror(errno)); + return -1; + } + + sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); + + freeaddrinfo(ai); + + if(sock < 0) { + logger(LOG_ERR, _("System call `%s' failed: %s"), "socket", strerror(errno)); + return -1; + } + + if(connect(sock, ai->ai_addr, ai->ai_addrlen)) { + logger(LOG_ERR, _("System call `%s' failed: %s"), "connect", strerror(errno)); + return -1; + } + + logger(LOG_DEBUG, _("Tap reader running")); + + /* Read from tap device and send to parent */ + + overlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + + for(;;) { + overlapped.Offset = 0; + overlapped.OffsetHigh = 0; + ResetEvent(overlapped.hEvent); + + status = ReadFile(device_handle, buf, sizeof(buf), &len, &overlapped); + + if(!status) { + if(GetLastError() == ERROR_IO_PENDING) { + WaitForSingleObject(overlapped.hEvent, INFINITE); + if(!GetOverlappedResult(device_handle, &overlapped, &len, FALSE)) + continue; + } else { + logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, + device, strerror(errno)); + return -1; + } + } + + if(send(sock, buf, len, 0) <= 0) + return -1; + } +} + +bool setup_device(void) +{ + HKEY key, key2; + int i; + + char regpath[1024]; + char adapterid[1024]; + char adaptername[1024]; + char tapname[1024]; + long len; + unsigned long status; + + bool found = false; + + int sock, err; + HANDLE thread; + + struct addrinfo *ai; + struct addrinfo hint = { + .ai_family = AF_UNSPEC, + .ai_socktype = SOCK_DGRAM, + .ai_protocol = IPPROTO_UDP, + .ai_flags = 0, + }; + + cp(); + + get_config_string(lookup_config(config_tree, "Device"), &device); + get_config_string(lookup_config(config_tree, "Interface"), &iface); + + /* Open registry and look for network adapters */ + + if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, NETWORK_CONNECTIONS_KEY, 0, KEY_READ, &key)) { + logger(LOG_ERR, _("Unable to read registry: %s"), winerror(GetLastError())); + return false; + } + + for (i = 0; ; i++) { + len = sizeof(adapterid); + if(RegEnumKeyEx(key, i, adapterid, &len, 0, 0, 0, NULL)) + break; + + /* Find out more about this adapter */ + + snprintf(regpath, sizeof(regpath), "%s\\%s\\Connection", NETWORK_CONNECTIONS_KEY, adapterid); + + if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, regpath, 0, KEY_READ, &key2)) + continue; + + len = sizeof(adaptername); + err = RegQueryValueEx(key2, "Name", 0, 0, adaptername, &len); + + RegCloseKey(key2); + + if(err) + continue; + + if(device) { + if(!strcmp(device, adapterid)) { + found = true; + break; + } else + continue; + } + + if(iface) { + if(!strcmp(iface, adaptername)) { + found = true; + break; + } else + continue; + } + + snprintf(tapname, sizeof(tapname), USERMODEDEVICEDIR "%s" TAPSUFFIX, adapterid); + device_handle = CreateFile(tapname, GENERIC_WRITE | GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED, 0); + if(device_handle != INVALID_HANDLE_VALUE) { + found = true; + break; + } + } + + RegCloseKey(key); + + if(!found) { + logger(LOG_ERR, _("No Windows tap device found!")); + return false; + } + + if(!device) + device = xstrdup(adapterid); + + if(!iface) + iface = xstrdup(adaptername); + + /* Try to open the corresponding tap device */ + + if(device_handle == INVALID_HANDLE_VALUE) { + snprintf(tapname, sizeof(tapname), USERMODEDEVICEDIR "%s" TAPSUFFIX, device); + device_handle = CreateFile(tapname, GENERIC_WRITE | GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED, 0); + } + + if(device_handle == INVALID_HANDLE_VALUE) { + logger(LOG_ERR, _("%s (%s) is not a usable Windows tap device: %s"), device, iface, winerror(GetLastError())); + return false; + } + + /* Get MAC address from tap device */ + + if(!DeviceIoControl(device_handle, TAP_IOCTL_GET_MAC, mymac.x, sizeof(mymac.x), mymac.x, sizeof(mymac.x), &len, 0)) { + logger(LOG_ERR, _("Could not get MAC address from Windows tap device %s (%s): %s"), device, iface, winerror(GetLastError())); + return false; + } + + if(routing_mode == RMODE_ROUTER) { + overwrite_mac = 1; + } + + /* Create a listening socket */ + + err = getaddrinfo(NULL, myport, &hint, &ai); + + if(err || !ai) { + logger(LOG_ERR, _("System call `%s' failed: %s"), "getaddrinfo", gai_strerror(errno)); + return false; + } + + sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); + + if(sock < 0) { + logger(LOG_ERR, _("System call `%s' failed: %s"), "socket", strerror(errno)); + return false; + } + + if(bind(sock, ai->ai_addr, ai->ai_addrlen)) { + logger(LOG_ERR, _("System call `%s' failed: %s"), "bind", strerror(errno)); + return false; + } + + freeaddrinfo(ai); + + if(listen(sock, 1)) { + logger(LOG_ERR, _("System call `%s' failed: %s"), "listen", strerror(errno)); + return false; + } + + /* Start the tap reader */ + + thread = CreateThread(NULL, 0, tapreader, NULL, 0, NULL); + + if(!thread) { + logger(LOG_ERR, _("System call `%s' failed: %s"), "CreateThread", winerror(GetLastError())); + return false; + } + + /* Wait for the tap reader to connect back to us */ + + if((device_fd = accept(sock, NULL, 0)) == -1) { + logger(LOG_ERR, _("System call `%s' failed: %s"), "accept", strerror(errno)); + return false; + } + + closesocket(sock); + + /* Set media status for newer TAP-Win32 devices */ + + status = true; + DeviceIoControl(device_handle, TAP_IOCTL_SET_MEDIA_STATUS, &status, sizeof(status), &status, sizeof(status), &len, NULL); + + device_info = _("Windows tap device"); + + logger(LOG_INFO, _("%s (%s) is a %s"), device, iface, device_info); + + return true; +} + +void close_device(void) +{ + cp(); + + CloseHandle(device_handle); +} + +bool read_packet(vpn_packet_t *packet) +{ + int lenin; + + cp(); + + if((lenin = recv(device_fd, packet->data, MTU, 0)) <= 0) { + logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, + device, strerror(errno)); + return false; + } + + packet->len = lenin; + + device_total_in += packet->len; + + ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Read packet of %d bytes from %s"), packet->len, + device_info); + + return true; +} + +bool write_packet(vpn_packet_t *packet) +{ + long lenout; + OVERLAPPED overlapped = {0}; + + cp(); + + ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Writing packet of %d bytes to %s"), + packet->len, device_info); + + if(!WriteFile(device_handle, packet->data, packet->len, &lenout, &overlapped)) { + logger(LOG_ERR, _("Error while writing to %s %s: %s"), device_info, device, winerror(GetLastError())); + return false; + } + + device_total_out += packet->len; + + return true; +} + +void dump_device_stats(void) +{ + cp(); + + logger(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device); + logger(LOG_DEBUG, _(" total bytes in: %10d"), device_total_in); + logger(LOG_DEBUG, _(" total bytes out: %10d"), device_total_out); +} diff --git a/src/net.c b/src/net.c index 1df4e9e..6c27948 100644 --- a/src/net.c +++ b/src/net.c @@ -1,7 +1,7 @@ /* net.c -- most of the network code - Copyright (C) 1998-2002 Ivo Timmermans , - 2000-2002 Guus Sliepen + Copyright (C) 1998-2004 Ivo Timmermans , + 2000-2004 Guus Sliepen 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 @@ -17,213 +17,197 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net.c,v 1.35.4.169 2002/04/01 21:28:05 guus Exp $ + $Id: net.c 1387 2004-06-21 14:37:52Z guus $ */ -#include "config.h" - -#include -#include -#include -#include -#ifdef HAVE_LINUX - #include - #include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -/* SunOS really wants sys/socket.h BEFORE net/if.h, - and FreeBSD wants these lines below the rest. */ -#include -#include -#include +#include "system.h" #include -#include -#include -#include -#include - +#include "utils.h" +#include "avl_tree.h" #include "conf.h" #include "connection.h" +#include "device.h" +#include "event.h" +#include "graph.h" +#include "logger.h" #include "meta.h" #include "net.h" #include "netutl.h" #include "process.h" #include "protocol.h" -#include "subnet.h" -#include "graph.h" -#include "process.h" #include "route.h" -#include "device.h" -#include "event.h" +#include "subnet.h" +#include "xalloc.h" -#include "system.h" - -int do_purge = 0; -int sighup = 0; -int sigalrm = 0; +bool do_purge = false; +volatile bool running = false; time_t now = 0; /* Purge edges and subnets of unreachable nodes. Use carefully. */ -void purge(void) +static void purge(void) { - avl_node_t *nnode, *nnext, *enode, *enext, *snode, *snext, *cnode; - node_t *n; - edge_t *e; - subnet_t *s; - connection_t *c; -cp - if(debug_lvl >= DEBUG_PROTOCOL) - syslog(LOG_DEBUG, _("Purging unreachable nodes")); + avl_node_t *nnode, *nnext, *enode, *enext, *snode, *snext; + node_t *n; + edge_t *e; + subnet_t *s; - for(nnode = node_tree->head; nnode; nnode = nnext) - { - nnext = nnode->next; - n = (node_t *)nnode->data; + cp(); - if(!n->status.reachable) - { - if(debug_lvl >= DEBUG_SCARY_THINGS) - syslog(LOG_DEBUG, _("Purging node %s (%s)"), n->name, n->hostname); + ifdebug(PROTOCOL) logger(LOG_DEBUG, _("Purging unreachable nodes")); - for(snode = n->subnet_tree->head; snode; snode = snext) - { - snext = snode->next; - s = (subnet_t *)snode->data; + /* Remove all edges and subnets owned by unreachable nodes. */ - for(cnode = connection_tree->head; cnode; cnode = cnode->next) - { - c = (connection_t *)cnode->data; - if(c->status.active) - send_del_subnet(c, s); - } + for(nnode = node_tree->head; nnode; nnode = nnext) { + nnext = nnode->next; + n = nnode->data; - subnet_del(n, s); - } + if(!n->status.reachable) { + ifdebug(SCARY_THINGS) logger(LOG_DEBUG, _("Purging node %s (%s)"), n->name, + n->hostname); - for(enode = n->edge_tree->head; enode; enode = enext) - { - enext = enode->next; - e = (edge_t *)enode->data; + for(snode = n->subnet_tree->head; snode; snode = snext) { + snext = snode->next; + s = snode->data; + if(!tunnelserver) + send_del_subnet(broadcast, s); + subnet_del(n, s); + } - for(cnode = connection_tree->head; cnode; cnode = cnode->next) - { - c = (connection_t *)cnode->data; - if(c->status.active) - send_del_edge(c, e); - } + for(enode = n->edge_tree->head; enode; enode = enext) { + enext = enode->next; + e = enode->data; + if(!tunnelserver) + send_del_edge(broadcast, e); + edge_del(e); + } + } + } - edge_del(e); - } + /* Check if anyone else claims to have an edge to an unreachable node. If not, delete node. */ - node_del(n); - } - } -cp + for(nnode = node_tree->head; nnode; nnode = nnext) { + nnext = nnode->next; + n = nnode->data; + + if(!n->status.reachable) { + for(enode = edge_weight_tree->head; enode; enode = enext) { + enext = enode->next; + e = enode->data; + + if(e->to == n) + break; + } + + if(!enode) + node_del(n); + } + } } /* put all file descriptors in an fd_set array While we're at it, purge stuff that needs to be removed. */ -void build_fdset(fd_set *fs) +static int build_fdset(fd_set * fs) { - avl_node_t *node, *next; - connection_t *c; - int i; -cp - FD_ZERO(fs); + avl_node_t *node, *next; + connection_t *c; + int i, max = 0; - for(node = connection_tree->head; node; node = next) - { - next = node->next; - c = (connection_t *)node->data; + cp(); - if(c->status.remove) - connection_del(c); - else - FD_SET(c->socket, fs); - } + FD_ZERO(fs); - if(!connection_tree->head) - purge(); + for(node = connection_tree->head; node; node = next) { + next = node->next; + c = node->data; - for(i = 0; i < listen_sockets; i++) - { - FD_SET(listen_socket[i].tcp, fs); - FD_SET(listen_socket[i].udp, fs); - } + if(c->status.remove) { + connection_del(c); + if(!connection_tree->head) + purge(); + } else { + FD_SET(c->socket, fs); + if(c->socket > max) + max = c->socket; + } + } - FD_SET(device_fd, fs); -cp + for(i = 0; i < listen_sockets; i++) { + FD_SET(listen_socket[i].tcp, fs); + if(listen_socket[i].tcp > max) + max = listen_socket[i].tcp; + FD_SET(listen_socket[i].udp, fs); + if(listen_socket[i].udp > max) + max = listen_socket[i].udp; + } + + FD_SET(device_fd, fs); + if(device_fd > max) + max = device_fd; + + return max; } /* Terminate a connection: - Close the socket - - Remove associated edge and tell other connections about it if report = 1 + - Remove associated edge and tell other connections about it if report = true - Check if we need to retry making an outgoing connection - Deactivate the host */ -void terminate_connection(connection_t *c, int report) +void terminate_connection(connection_t *c, bool report) { - avl_node_t *node; - connection_t *other; -cp - if(c->status.remove) - return; + cp(); - if(debug_lvl >= DEBUG_CONNECTIONS) - syslog(LOG_NOTICE, _("Closing connection with %s (%s)"), - c->name, c->hostname); + if(c->status.remove) + return; - c->status.remove = 1; - c->status.active = 0; + ifdebug(CONNECTIONS) logger(LOG_NOTICE, _("Closing connection with %s (%s)"), + c->name, c->hostname); - if(c->node) - c->node->connection = NULL; + c->status.remove = true; + c->status.active = false; - if(c->socket) - close(c->socket); + if(c->node) + c->node->connection = NULL; - if(c->edge) - { - if(report) - { - for(node = connection_tree->head; node; node = node->next) - { - other = (connection_t *)node->data; - if(other->status.active && other != c) - send_del_edge(other, c->edge); - } - } + if(c->socket) + closesocket(c->socket); - edge_del(c->edge); + if(c->edge) { + if(report && !tunnelserver) + send_del_edge(broadcast, c->edge); - /* Run MST and SSSP algorithms */ + edge_del(c->edge); - graph(); - } + /* Run MST and SSSP algorithms */ - /* Check if this was our outgoing connection */ + graph(); - if(c->outgoing) - { - retry_outgoing(c->outgoing); - c->outgoing = NULL; - } -cp + /* If the node is not reachable anymore but we remember it had an edge to us, clean it up */ + + if(report && !c->node->status.reachable) { + edge_t *e; + e = lookup_edge(c->node, myself); + if(e) { + if(!tunnelserver) + send_del_edge(broadcast, e); + edge_del(e); + } + } + } + + /* Check if this was our outgoing connection */ + + if(c->outgoing) { + retry_outgoing(c->outgoing); + c->outgoing = NULL; + } } /* @@ -234,216 +218,239 @@ cp end does not reply in time, we consider them dead and close the connection. */ -void check_dead_connections(void) +static void check_dead_connections(void) { - avl_node_t *node, *next; - connection_t *c; -cp - for(node = connection_tree->head; node; node = next) - { - next = node->next; - c = (connection_t *)node->data; - if(c->last_ping_time + pingtimeout < now) - { - if(c->status.active) - { - if(c->status.pinged) - { - if(debug_lvl >= DEBUG_PROTOCOL) - syslog(LOG_INFO, _("%s (%s) didn't respond to PING"), - c->name, c->hostname); - c->status.timeout = 1; - terminate_connection(c, 1); - } - else - { - send_ping(c); - } - } - else - { - if(debug_lvl >= DEBUG_CONNECTIONS) - syslog(LOG_WARNING, _("Timeout from %s (%s) during authentication"), - c->name, c->hostname); - terminate_connection(c, 0); - } - } - } -cp + avl_node_t *node, *next; + connection_t *c; + + cp(); + + for(node = connection_tree->head; node; node = next) { + next = node->next; + c = node->data; + + if(c->last_ping_time + pingtimeout < now) { + if(c->status.active) { + if(c->status.pinged) { + ifdebug(CONNECTIONS) logger(LOG_INFO, _("%s (%s) didn't respond to PING"), + c->name, c->hostname); + c->status.timeout = true; + terminate_connection(c, true); + } else { + send_ping(c); + } + } else { + if(c->status.remove) { + logger(LOG_WARNING, _("Old connection_t for %s (%s) status %04x still lingering, deleting..."), + c->name, c->hostname, *(uint32_t *)&c->status); + connection_del(c); + continue; + } + ifdebug(CONNECTIONS) logger(LOG_WARNING, _("Timeout from %s (%s) during authentication"), + c->name, c->hostname); + if(c->status.connecting) { + c->status.connecting = false; + closesocket(c->socket); + do_outgoing_connection(c); + } else { + terminate_connection(c, false); + } + } + } + } } /* check all connections to see if anything happened on their sockets */ -void check_network_activity(fd_set *f) +static void check_network_activity(fd_set * f) { - connection_t *c; - avl_node_t *node; - int result, i; - int len = sizeof(result); - vpn_packet_t packet; -cp - if(FD_ISSET(device_fd, f)) - { - if(!read_packet(&packet)) - route_outgoing(&packet); - } + connection_t *c; + avl_node_t *node; + int result, i; + int len = sizeof(result); + vpn_packet_t packet; - for(node = connection_tree->head; node; node = node->next) - { - c = (connection_t *)node->data; + cp(); - if(c->status.remove) - continue; + if(FD_ISSET(device_fd, f)) { + if(read_packet(&packet)) + route(myself, &packet); + } - if(FD_ISSET(c->socket, f)) - { - if(c->status.connecting) - { - c->status.connecting = 0; - getsockopt(c->socket, SOL_SOCKET, SO_ERROR, &result, &len); - if(!result) - finish_connecting(c); - else - { - if(debug_lvl >= DEBUG_CONNECTIONS) - syslog(LOG_DEBUG, _("Error while connecting to %s (%s): %s"), c->name, c->hostname, strerror(result)); - close(c->socket); - do_outgoing_connection(c); - continue; - } - } - if(receive_meta(c) < 0) - { - terminate_connection(c, c->status.active); - continue; - } - } - } + for(node = connection_tree->head; node; node = node->next) { + c = node->data; - for(i = 0; i < listen_sockets; i++) - { - if(FD_ISSET(listen_socket[i].udp, f)) - handle_incoming_vpn_data(listen_socket[i].udp); - if(FD_ISSET(listen_socket[i].tcp, f)) - handle_new_meta_connection(listen_socket[i].tcp); - } -cp + if(c->status.remove) + continue; + + if(FD_ISSET(c->socket, f)) { + if(c->status.connecting) { + c->status.connecting = false; + getsockopt(c->socket, SOL_SOCKET, SO_ERROR, &result, &len); + + if(!result) + finish_connecting(c); + else { + ifdebug(CONNECTIONS) logger(LOG_DEBUG, + _("Error while connecting to %s (%s): %s"), + c->name, c->hostname, strerror(result)); + closesocket(c->socket); + do_outgoing_connection(c); + continue; + } + } + + if(!receive_meta(c)) { + terminate_connection(c, c->status.active); + continue; + } + } + } + + for(i = 0; i < listen_sockets; i++) { + if(FD_ISSET(listen_socket[i].udp, f)) + handle_incoming_vpn_data(listen_socket[i].udp); + + if(FD_ISSET(listen_socket[i].tcp, f)) + handle_new_meta_connection(listen_socket[i].tcp); + } } /* this is where it all happens... */ -void main_loop(void) +int main_loop(void) { - fd_set fset; - struct timeval tv; - int r; - time_t last_ping_check; - event_t *event; -cp - last_ping_check = now; + fd_set fset; + struct timeval tv; + int r, maxfd; + time_t last_ping_check, last_config_check; + event_t *event; - srand(now); + cp(); - for(;;) - { - now = time(NULL); + last_ping_check = now; + last_config_check = now; + srand(now); - tv.tv_sec = 1 + (rand() & 7); /* Approx. 5 seconds, randomized to prevent global synchronisation effects */ - tv.tv_usec = 0; + running = true; - build_fdset(&fset); + while(running) { + now = time(NULL); - if((r = select(FD_SETSIZE, &fset, NULL, NULL, &tv)) < 0) - { - if(errno != EINTR && errno != EAGAIN) - { - syslog(LOG_ERR, _("Error while waiting for input: %s"), strerror(errno)); - cp_trace(); - dump_connections(); - return; - } + // tv.tv_sec = 1 + (rand() & 7); /* Approx. 5 seconds, randomized to prevent global synchronisation effects */ + tv.tv_sec = 1; + tv.tv_usec = 0; - continue; - } + maxfd = build_fdset(&fset); - check_network_activity(&fset); + r = select(maxfd + 1, &fset, NULL, NULL, &tv); - if(do_purge) - { - purge(); - do_purge = 0; - } + if(r < 0) { + if(errno != EINTR && errno != EAGAIN) { + logger(LOG_ERR, _("Error while waiting for input: %s"), + strerror(errno)); + cp_trace(); + dump_connections(); + return 1; + } - /* Let's check if everybody is still alive */ + continue; + } - if(last_ping_check + pingtimeout < now) - { - check_dead_connections(); - last_ping_check = now; + check_network_activity(&fset); - if(routing_mode== RMODE_SWITCH) - age_mac(); + if(do_purge) { + purge(); + do_purge = false; + } - age_past_requests(); + /* Let's check if everybody is still alive */ - /* Should we regenerate our key? */ + if(last_ping_check + pingtimeout < now) { + check_dead_connections(); + last_ping_check = now; - if(keyexpires < now) - { - if(debug_lvl >= DEBUG_STATUS) - syslog(LOG_INFO, _("Regenerating symmetric key")); + if(routing_mode == RMODE_SWITCH) + age_subnets(); - RAND_pseudo_bytes(myself->key, myself->keylength); - send_key_changed(myself->connection, myself); - keyexpires = now + keylifetime; - } - } + age_past_requests(); + + /* Should we regenerate our key? */ + + if(keyexpires < now) { + ifdebug(STATUS) logger(LOG_INFO, _("Regenerating symmetric key")); + + RAND_pseudo_bytes(myself->key, myself->keylength); + if(myself->cipher) + EVP_DecryptInit_ex(&packet_ctx, myself->cipher, NULL, myself->key, myself->key + myself->cipher->key_len); + send_key_changed(broadcast, myself); + keyexpires = now + keylifetime; + } + } - while((event = get_expired_event())) - { - event->handler(event->data); - free(event); - } + while((event = get_expired_event())) { + event->handler(event->data); + free(event); + } - if(sigalrm) - { - syslog(LOG_INFO, _("Flushing event queue")); + if(sigalrm) { + logger(LOG_INFO, _("Flushing event queue")); - while(event_tree->head) - { - event = (event_t *)event_tree->head->data; - event->handler(event->data); - event_del(event); - } - sigalrm = 0; - } + while(event_tree->head) { + event = event_tree->head->data; + event->handler(event->data); + event_del(event); + } + sigalrm = false; + } - if(sighup) - { - sighup = 0; - close_network_connections(); - exit_configuration(&config_tree); + if(sighup) { + connection_t *c; + avl_node_t *node; + char *fname; + struct stat s; + + sighup = false; + + /* Reread our own configuration file */ - syslog(LOG_INFO, _("Rereading configuration file and restarting in 5 seconds...")); - sleep(5); + exit_configuration(&config_tree); + init_configuration(&config_tree); - init_configuration(&config_tree); + if(!read_server_config()) { + logger(LOG_ERR, _("Unable to reread configuration file, exitting.")); + return 1; + } - if(read_server_config()) - { - syslog(LOG_ERR, _("Unable to reread configuration file, exitting.")); - exit(1); - } + /* Close connections to hosts that have a changed or deleted host config file */ + + for(node = connection_tree->head; node; node = node->next) { + c = node->data; + + if(c->outgoing) { + free(c->outgoing->name); + freeaddrinfo(c->outgoing->ai); + free(c->outgoing); + c->outgoing = NULL; + } + + asprintf(&fname, "%s/hosts/%s", confbase, c->name); + if(stat(fname, &s) || s.st_mtime > last_config_check) + terminate_connection(c, c->status.active); + free(fname); + } - if(setup_network_connections()) - return; + last_config_check = now; - continue; - } - } -cp + /* Try to make outgoing connections */ + + try_outgoing_connections(); + } + } + + return 0; } diff --git a/src/net.h b/src/net.h index 922c5cf..2728f76 100644 --- a/src/net.h +++ b/src/net.h @@ -1,7 +1,7 @@ /* net.h -- header for net.c - Copyright (C) 1998-2002 Ivo Timmermans - 2000-2002 Guus Sliepen + Copyright (C) 1998-2004 Ivo Timmermans + 2000-2004 Guus Sliepen 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 @@ -17,61 +17,61 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net.h,v 1.9.4.49 2002/03/27 15:01:36 guus Exp $ + $Id: net.h 1413 2004-11-10 21:56:31Z guus $ */ #ifndef __TINC_NET_H__ #define __TINC_NET_H__ -#include -#include -#include -#include +#include -#include "config.h" +#include "ipv6.h" #ifdef ENABLE_JUMBOGRAMS - #define MTU 9014 /* 9000 bytes payload + 14 bytes ethernet header */ - #define MAXSIZE 9100 /* MTU + header (seqno) and trailer (CBC padding and HMAC) */ - #define MAXBUFSIZE 9100 /* Must support TCP packets of length 9000. */ +#define MTU 9018 /* 9000 bytes payload + 14 bytes ethernet header + 4 bytes VLAN tag */ #else - #define MTU 1514 /* 1500 bytes payload + 14 bytes ethernet header */ - #define MAXSIZE 1600 /* MTU + header (seqno) and trailer (CBC padding and HMAC) */ - #define MAXBUFSIZE 2100 /* Quite large but needed for support of keys up to 8192 bits. */ +#define MTU 1518 /* 1500 bytes payload + 14 bytes ethernet header + 4 bytes VLAN tag */ #endif -#define MAXSOCKETS 128 /* Overkill... */ +#define MAXSIZE (MTU + 4 + EVP_MAX_BLOCK_LENGTH + EVP_MAX_MD_SIZE + MTU/64 + 20) /* MTU + seqno + padding + HMAC + compressor overhead */ +#define MAXBUFSIZE ((MAXSIZE > 2048 ? MAXSIZE : 2048) + 128) /* Enough room for a request with a MAXSIZEd packet or a 8192 bits RSA key */ -#define MAXQUEUELENGTH 8 /* Maximum number of packats in a single queue */ +#define MAXSOCKETS 128 /* Overkill... */ -typedef struct mac_t -{ - unsigned char x[6]; +#define MAXQUEUELENGTH 8 /* Maximum number of packats in a single queue */ + +typedef struct mac_t { + uint8_t x[6]; } mac_t; -typedef struct ipv4_t -{ - unsigned char x[4]; +typedef struct ipv4_t { + uint8_t x[4]; } ipv4_t; -typedef struct ip_mask_t { - ipv4_t address; - ipv4_t mask; -} ip_mask_t; - -typedef struct ipv6_t -{ - unsigned short x[8]; +typedef struct ipv6_t { + uint16_t x[8]; } ipv6_t; -typedef unsigned short port_t; - typedef short length_t; -typedef union { - struct sockaddr sa; - struct sockaddr_in in; - struct sockaddr_in6 in6; +#define AF_UNKNOWN 255 + +struct sockaddr_unknown { + uint16_t family; + uint16_t pad1; + uint32_t pad2; + char *address; + char *port; +}; + +typedef union sockaddr_t { + struct sockaddr sa; + struct sockaddr_in in; + struct sockaddr_in6 in6; + struct sockaddr_unknown unknown; +#ifdef HAVE_STRUCT_SOCKADDR_STORAGE + struct sockaddr_storage storage; +#endif } sockaddr_t; #ifdef SA_LEN @@ -81,73 +81,80 @@ typedef union { #endif typedef struct vpn_packet_t { - length_t len; /* the actual number of bytes in the `data' field */ - int priority; /* priority or TOS */ - unsigned int seqno; /* 32 bits sequence number (network byte order of course) */ - unsigned char data[MAXSIZE]; + length_t len; /* the actual number of bytes in the `data' field */ + int priority; /* priority or TOS */ + uint32_t seqno; /* 32 bits sequence number (network byte order of course) */ + uint8_t data[MAXSIZE]; } vpn_packet_t; typedef struct queue_element_t { - void *packet; - struct queue_element_t *prev; - struct queue_element_t *next; + void *packet; + struct queue_element_t *prev; + struct queue_element_t *next; } queue_element_t; typedef struct packet_queue_t { - queue_element_t *head; - queue_element_t *tail; + queue_element_t *head; + queue_element_t *tail; } packet_queue_t; -typedef struct outgoing_t { - char *name; - int timeout; - struct config_t *cfg; - struct addrinfo *ai; - struct addrinfo *aip; -} outgoing_t; - typedef struct listen_socket_t { - int tcp; - int udp; - sockaddr_t sa; + int tcp; + int udp; + sockaddr_t sa; } listen_socket_t; +#include "conf.h" + +typedef struct outgoing_t { + char *name; + int timeout; + struct config_t *cfg; + struct addrinfo *ai; + struct addrinfo *aip; +} outgoing_t; + extern int maxtimeout; extern int seconds_till_retry; extern int addressfamily; - -extern char *request_name[]; -extern char *status_text[]; - -#include "connection.h" /* Yes, very strange placement indeed, but otherwise the typedefs get all tangled up */ +extern bool blockingtcp; extern listen_socket_t listen_socket[MAXSOCKETS]; extern int listen_sockets; extern int keyexpires; extern int keylifetime; -extern int do_prune; -extern int do_purge; +extern bool do_prune; +extern bool do_purge; extern char *myport; extern time_t now; +extern EVP_CIPHER_CTX packet_ctx; + +/* Yes, very strange placement indeed, but otherwise the typedefs get all tangled up */ +#include "connection.h" +#include "node.h" extern void retry_outgoing(outgoing_t *); extern void handle_incoming_vpn_data(int); -extern void finish_connecting(connection_t *); -extern void do_outgoing_connection(connection_t *); -extern int handle_new_meta_connection(int); -extern int setup_listen_socket(sockaddr_t *); -extern int setup_vpn_in_socket(sockaddr_t *); -extern void send_packet(struct node_t *, vpn_packet_t *); -extern void receive_packet(struct node_t *, vpn_packet_t *); +extern void finish_connecting(struct connection_t *); +extern void do_outgoing_connection(struct connection_t *); +extern bool handle_new_meta_connection(int); +extern int setup_listen_socket(const sockaddr_t *); +extern int setup_vpn_in_socket(const sockaddr_t *); +extern void send_packet(const struct node_t *, vpn_packet_t *); extern void receive_tcppacket(struct connection_t *, char *, int); -extern void broadcast_packet(struct node_t *, vpn_packet_t *); -extern int setup_network_connections(void); +extern void broadcast_packet(const struct node_t *, vpn_packet_t *); +extern bool setup_network_connections(void); extern void setup_outgoing_connection(struct outgoing_t *); extern void try_outgoing_connections(void); extern void close_network_connections(void); -extern void main_loop(void); -extern void terminate_connection(connection_t *, int); +extern int main_loop(void); +extern void terminate_connection(struct connection_t *, bool); extern void flush_queue(struct node_t *); -extern int read_rsa_public_key(struct connection_t *); +extern bool read_rsa_public_key(struct connection_t *); +extern void send_mtu_probe(struct node_t *); -#endif /* __TINC_NET_H__ */ +#ifndef HAVE_MINGW +#define closesocket(s) close(s) +#endif + +#endif /* __TINC_NET_H__ */ diff --git a/src/net_packet.c b/src/net_packet.c index fd2ae06..550294c 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -1,7 +1,7 @@ /* net_packet.c -- Handles in- and outgoing VPN packets - Copyright (C) 1998-2002 Ivo Timmermans , - 2000-2002 Guus Sliepen + Copyright (C) 1998-2004 Ivo Timmermans , + 2000-2004 Guus Sliepen 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 @@ -17,415 +17,497 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net_packet.c,v 1.1.2.13 2002/03/27 15:01:37 guus Exp $ + $Id: net_packet.c 1407 2004-11-09 09:51:35Z guus $ */ -#include "config.h" - -#include -#include -#include -#include -#ifdef HAVE_LINUX - #include - #include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -/* SunOS really wants sys/socket.h BEFORE net/if.h, - and FreeBSD wants these lines below the rest. */ -#include -#include -#include +#include "system.h" #include +#include #include #include #include -#ifndef HAVE_RAND_PSEUDO_BYTES -#define RAND_pseudo_bytes RAND_bytes -#endif - #include +#include -#include -#include -#include -#include - +#include "avl_tree.h" #include "conf.h" #include "connection.h" -#include "meta.h" +#include "device.h" +#include "ethernet.h" +#include "event.h" +#include "graph.h" +#include "list.h" +#include "logger.h" #include "net.h" #include "netutl.h" -#include "process.h" #include "protocol.h" -#include "subnet.h" -#include "graph.h" #include "process.h" #include "route.h" -#include "device.h" -#include "event.h" +#include "utils.h" +#include "xalloc.h" -#include "system.h" +#ifdef WSAEMSGSIZE +#define EMSGSIZE WSAEMSGSIZE +#endif int keylifetime = 0; int keyexpires = 0; +EVP_CIPHER_CTX packet_ctx; +static char lzo_wrkmem[LZO1X_999_MEM_COMPRESS > LZO1X_1_MEM_COMPRESS ? LZO1X_999_MEM_COMPRESS : LZO1X_1_MEM_COMPRESS]; + +static void send_udppacket(node_t *, vpn_packet_t *); #define MAX_SEQNO 1073741824 +void send_mtu_probe(node_t *n) +{ + vpn_packet_t packet; + int len, i; + + cp(); + + n->mtuprobes++; + n->mtuevent = NULL; + + if(n->mtuprobes >= 10 && !n->minmtu) { + ifdebug(TRAFFIC) logger(LOG_INFO, _("No response to MTU probes from %s (%s)"), n->name, n->hostname); + return; + } + + for(i = 0; i < 3; i++) { + if(n->mtuprobes >= 30 || n->minmtu >= n->maxmtu) { + n->mtu = n->minmtu; + ifdebug(TRAFFIC) logger(LOG_INFO, _("Fixing MTU of %s (%s) to %d after %d probes"), n->name, n->hostname, n->mtu, n->mtuprobes); + return; + } + + len = n->minmtu + 1 + random() % (n->maxmtu - n->minmtu); + if(len < 64) + len = 64; + + memset(packet.data, 0, 14); + RAND_pseudo_bytes(packet.data + 14, len - 14); + packet.len = len; + + ifdebug(TRAFFIC) logger(LOG_INFO, _("Sending MTU probe length %d to %s (%s)"), len, n->name, n->hostname); + + send_udppacket(n, &packet); + } + + n->mtuevent = xmalloc(sizeof(*n->mtuevent)); + n->mtuevent->handler = (event_handler_t)send_mtu_probe; + n->mtuevent->data = n; + n->mtuevent->time = now + 1; + event_add(n->mtuevent); +} + +void mtu_probe_h(node_t *n, vpn_packet_t *packet) { + ifdebug(TRAFFIC) logger(LOG_INFO, _("Got MTU probe length %d from %s (%s)"), packet->len, n->name, n->hostname); + + if(!packet->data[0]) { + packet->data[0] = 1; + send_packet(n, packet); + } else { + if(n->minmtu < packet->len) + n->minmtu = packet->len; + } +} + +static length_t compress_packet(uint8_t *dest, const uint8_t *source, length_t len, int level) +{ + if(level == 10) { + lzo_uint lzolen = MAXSIZE; + lzo1x_1_compress(source, len, dest, &lzolen, lzo_wrkmem); + return lzolen; + } else if(level < 10) { + unsigned long destlen = MAXSIZE; + if(compress2(dest, &destlen, source, len, level) == Z_OK) + return destlen; + else + return -1; + } else { + lzo_uint lzolen = MAXSIZE; + lzo1x_999_compress(source, len, dest, &lzolen, lzo_wrkmem); + return lzolen; + } + + return -1; +} + +static length_t uncompress_packet(uint8_t *dest, const uint8_t *source, length_t len, int level) +{ + if(level > 9) { + lzo_uint lzolen = MAXSIZE; + if(lzo1x_decompress_safe(source, len, dest, &lzolen, NULL) == LZO_E_OK) + return lzolen; + else + return -1; + } else { + unsigned long destlen = MAXSIZE; + if(uncompress(dest, &destlen, source, len) == Z_OK) + return destlen; + else + return -1; + } + + return -1; +} + /* VPN packet I/O */ -void receive_udppacket(node_t *n, vpn_packet_t *inpkt) +static void receive_packet(node_t *n, vpn_packet_t *packet) { - vpn_packet_t pkt1, pkt2; - vpn_packet_t *pkt[] = {&pkt1, &pkt2, &pkt1, &pkt2}; - int nextpkt = 0; - vpn_packet_t *outpkt = pkt[0]; - int outlen, outpad; - long int complen = MTU + 12; - EVP_CIPHER_CTX ctx; - char hmac[EVP_MAX_MD_SIZE]; -cp - /* Check the message authentication code */ + cp(); - if(myself->digest && myself->maclength) - { - inpkt->len -= myself->maclength; - HMAC(myself->digest, myself->key, myself->keylength, (char *)&inpkt->seqno, inpkt->len, hmac, NULL); - if(memcmp(hmac, (char *)&inpkt->seqno + inpkt->len, myself->maclength)) - { - if(debug_lvl >= DEBUG_TRAFFIC) - syslog(LOG_DEBUG, _("Got unauthenticated packet from %s (%s)"), n->name, n->hostname); - return; - } - } + ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Received packet of %d bytes from %s (%s)"), + packet->len, n->name, n->hostname); - /* Decrypt the packet */ + route(n, packet); +} - if(myself->cipher) - { - outpkt = pkt[nextpkt++]; +static void receive_udppacket(node_t *n, vpn_packet_t *inpkt) +{ + vpn_packet_t pkt1, pkt2; + vpn_packet_t *pkt[] = { &pkt1, &pkt2, &pkt1, &pkt2 }; + int nextpkt = 0; + vpn_packet_t *outpkt = pkt[0]; + int outlen, outpad; + char hmac[EVP_MAX_MD_SIZE]; + int i; - EVP_DecryptInit(&ctx, myself->cipher, myself->key, myself->key + myself->cipher->key_len); - EVP_DecryptUpdate(&ctx, (char *)&outpkt->seqno, &outlen, (char *)&inpkt->seqno, inpkt->len); - EVP_DecryptFinal(&ctx, (char *)&outpkt->seqno + outlen, &outpad); + cp(); - outpkt->len = outlen + outpad; - inpkt = outpkt; - } + /* Check packet length */ - /* Check the sequence number */ + if(inpkt->len < sizeof(inpkt->seqno) + myself->maclength) { + ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Got too short packet from %s (%s)"), + n->name, n->hostname); + return; + } - inpkt->len -= sizeof(inpkt->seqno); - inpkt->seqno = ntohl(inpkt->seqno); + /* Check the message authentication code */ - if(inpkt->seqno <= n->received_seqno) - { - if(debug_lvl >= DEBUG_TRAFFIC) - syslog(LOG_DEBUG, _("Got late or replayed packet from %s (%s), seqno %d"), n->name, n->hostname, inpkt->seqno); - return; - } - - n->received_seqno = inpkt->seqno; + if(myself->digest && myself->maclength) { + inpkt->len -= myself->maclength; + HMAC(myself->digest, myself->key, myself->keylength, + (char *) &inpkt->seqno, inpkt->len, hmac, NULL); - if(n->received_seqno > MAX_SEQNO) - keyexpires = 0; + if(memcmp(hmac, (char *) &inpkt->seqno + inpkt->len, myself->maclength)) { + ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Got unauthenticated packet from %s (%s)"), + n->name, n->hostname); + return; + } + } - /* Decompress the packet */ - - if(myself->compression) - { - outpkt = pkt[nextpkt++]; + /* Decrypt the packet */ - if(uncompress(outpkt->data, &complen, inpkt->data, inpkt->len) != Z_OK) - { - syslog(LOG_ERR, _("Error while uncompressing packet from %s (%s)"), n->name, n->hostname); - return; - } - - outpkt->len = complen; - inpkt = outpkt; - } + if(myself->cipher) { + outpkt = pkt[nextpkt++]; - receive_packet(n, inpkt); -cp + if(!EVP_DecryptInit_ex(&packet_ctx, NULL, NULL, NULL, NULL) + || !EVP_DecryptUpdate(&packet_ctx, (char *) &outpkt->seqno, &outlen, + (char *) &inpkt->seqno, inpkt->len) + || !EVP_DecryptFinal_ex(&packet_ctx, (char *) &outpkt->seqno + outlen, &outpad)) { + ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Error decrypting packet from %s (%s): %s"), + n->name, n->hostname, ERR_error_string(ERR_get_error(), NULL)); + return; + } + + outpkt->len = outlen + outpad; + inpkt = outpkt; + } + + /* Check the sequence number */ + + inpkt->len -= sizeof(inpkt->seqno); + inpkt->seqno = ntohl(inpkt->seqno); + + if(inpkt->seqno != n->received_seqno + 1) { + if(inpkt->seqno >= n->received_seqno + sizeof(n->late) * 8) { + logger(LOG_WARNING, _("Lost %d packets from %s (%s)"), + inpkt->seqno - n->received_seqno - 1, n->name, n->hostname); + + memset(n->late, 0, sizeof(n->late)); + } else if (inpkt->seqno <= n->received_seqno) { + if((n->received_seqno >= sizeof(n->late) * 8 && inpkt->seqno <= n->received_seqno - sizeof(n->late) * 8) || !(n->late[(inpkt->seqno / 8) % sizeof(n->late)] & (1 << inpkt->seqno % 8))) { + logger(LOG_WARNING, _("Got late or replayed packet from %s (%s), seqno %d, last received %d"), + n->name, n->hostname, inpkt->seqno, n->received_seqno); + return; + } + } else { + for(i = n->received_seqno + 1; i < inpkt->seqno; i++) + n->late[(i / 8) % sizeof(n->late)] |= 1 << i % 8; + } + } + + n->late[(inpkt->seqno / 8) % sizeof(n->late)] &= ~(1 << inpkt->seqno % 8); + + if(inpkt->seqno > n->received_seqno) + n->received_seqno = inpkt->seqno; + + if(n->received_seqno > MAX_SEQNO) + keyexpires = 0; + + /* Decompress the packet */ + + if(myself->compression) { + outpkt = pkt[nextpkt++]; + + if((outpkt->len = uncompress_packet(outpkt->data, inpkt->data, inpkt->len, myself->compression)) < 0) { + ifdebug(TRAFFIC) logger(LOG_ERR, _("Error while uncompressing packet from %s (%s)"), + n->name, n->hostname); + return; + } + + inpkt = outpkt; + } + + if(n->connection) + n->connection->last_ping_time = now; + + if(!inpkt->data[12] && !inpkt->data[13]) + mtu_probe_h(n, inpkt); + else + receive_packet(n, inpkt); } void receive_tcppacket(connection_t *c, char *buffer, int len) { - vpn_packet_t outpkt; -cp - outpkt.len = len; - memcpy(outpkt.data, buffer, len); + vpn_packet_t outpkt; - receive_packet(c->node, &outpkt); -cp + cp(); + + outpkt.len = len; + memcpy(outpkt.data, buffer, len); + + receive_packet(c->node, &outpkt); } -void receive_packet(node_t *n, vpn_packet_t *packet) +static void send_udppacket(node_t *n, vpn_packet_t *inpkt) { -cp - if(debug_lvl >= DEBUG_TRAFFIC) - syslog(LOG_DEBUG, _("Received packet of %d bytes from %s (%s)"), packet->len, n->name, n->hostname); + vpn_packet_t pkt1, pkt2; + vpn_packet_t *pkt[] = { &pkt1, &pkt2, &pkt1, &pkt2 }; + int nextpkt = 0; + vpn_packet_t *outpkt; + int origlen; + int outlen, outpad; + vpn_packet_t *copy; + static int priority = 0; + int origpriority; + int sock; - route_incoming(n, packet); -cp -} + cp(); -void send_udppacket(node_t *n, vpn_packet_t *inpkt) -{ - vpn_packet_t pkt1, pkt2; - vpn_packet_t *pkt[] = {&pkt1, &pkt2, &pkt1, &pkt2}; - int nextpkt = 0; - vpn_packet_t *outpkt; - int origlen; - int outlen, outpad; - long int complen = MTU + 12; - EVP_CIPHER_CTX ctx; - vpn_packet_t *copy; - static int priority = 0; - int origpriority; - int sock; -cp - /* Make sure we have a valid key */ + /* Make sure we have a valid key */ - if(!n->status.validkey) - { - if(debug_lvl >= DEBUG_TRAFFIC) - syslog(LOG_INFO, _("No valid key known yet for %s (%s), queueing packet"), - n->name, n->hostname); + if(!n->status.validkey) { + ifdebug(TRAFFIC) logger(LOG_INFO, + _("No valid key known yet for %s (%s), queueing packet"), + n->name, n->hostname); - /* Since packet is on the stack of handle_tap_input(), - we have to make a copy of it first. */ + /* Since packet is on the stack of handle_tap_input(), we have to make a copy of it first. */ - copy = xmalloc(sizeof(vpn_packet_t)); - memcpy(copy, inpkt, sizeof(vpn_packet_t)); + *(copy = xmalloc(sizeof(*copy))) = *inpkt; - list_insert_tail(n->queue, copy); + list_insert_tail(n->queue, copy); - if(n->queue->count > MAXQUEUELENGTH) - list_delete_head(n->queue); + if(n->queue->count > MAXQUEUELENGTH) + list_delete_head(n->queue); - if(!n->status.waitingforkey) - send_req_key(n->nexthop->connection, myself, n); + if(!n->status.waitingforkey) + send_req_key(n->nexthop->connection, myself, n); - n->status.waitingforkey = 1; + n->status.waitingforkey = true; - return; - } + return; + } - origlen = inpkt->len; - origpriority = inpkt->priority; + origlen = inpkt->len; + origpriority = inpkt->priority; - /* Compress the packet */ + /* Compress the packet */ - if(n->compression) - { - outpkt = pkt[nextpkt++]; + if(n->compression) { + outpkt = pkt[nextpkt++]; - if(compress2(outpkt->data, &complen, inpkt->data, inpkt->len, n->compression) != Z_OK) - { - syslog(LOG_ERR, _("Error while compressing packet to %s (%s)"), n->name, n->hostname); - return; - } - - outpkt->len = complen; - inpkt = outpkt; - } + if((outpkt->len = compress_packet(outpkt->data, inpkt->data, inpkt->len, n->compression)) < 0) { + ifdebug(TRAFFIC) logger(LOG_ERR, _("Error while compressing packet to %s (%s)"), + n->name, n->hostname); + return; + } - /* Add sequence number */ + inpkt = outpkt; + } - inpkt->seqno = htonl(++(n->sent_seqno)); - inpkt->len += sizeof(inpkt->seqno); + /* Add sequence number */ - /* Encrypt the packet */ + inpkt->seqno = htonl(++(n->sent_seqno)); + inpkt->len += sizeof(inpkt->seqno); - if(n->cipher) - { - outpkt = pkt[nextpkt++]; + /* Encrypt the packet */ - EVP_EncryptInit(&ctx, n->cipher, n->key, n->key + n->cipher->key_len); - EVP_EncryptUpdate(&ctx, (char *)&outpkt->seqno, &outlen, (char *)&inpkt->seqno, inpkt->len); - EVP_EncryptFinal(&ctx, (char *)&outpkt->seqno + outlen, &outpad); + if(n->cipher) { + outpkt = pkt[nextpkt++]; - outpkt->len = outlen + outpad; - inpkt = outpkt; - } + if(!EVP_EncryptInit_ex(&n->packet_ctx, NULL, NULL, NULL, NULL) + || !EVP_EncryptUpdate(&n->packet_ctx, (char *) &outpkt->seqno, &outlen, + (char *) &inpkt->seqno, inpkt->len) + || !EVP_EncryptFinal_ex(&n->packet_ctx, (char *) &outpkt->seqno + outlen, &outpad)) { + ifdebug(TRAFFIC) logger(LOG_ERR, _("Error while encrypting packet to %s (%s): %s"), + n->name, n->hostname, ERR_error_string(ERR_get_error(), NULL)); + goto end; + } - /* Add the message authentication code */ + outpkt->len = outlen + outpad; + inpkt = outpkt; + } - if(n->digest && n->maclength) - { - HMAC(n->digest, n->key, n->keylength, (char *)&inpkt->seqno, inpkt->len, (char *)&inpkt->seqno + inpkt->len, &outlen); - inpkt->len += n->maclength; - } + /* Add the message authentication code */ - /* Determine which socket we have to use */ + if(n->digest && n->maclength) { + HMAC(n->digest, n->key, n->keylength, (char *) &inpkt->seqno, + inpkt->len, (char *) &inpkt->seqno + inpkt->len, &outlen); + inpkt->len += n->maclength; + } - for(sock = 0; sock < listen_sockets; sock++) - if(n->address.sa.sa_family == listen_socket[sock].sa.sa.sa_family) - break; + /* Determine which socket we have to use */ - if(sock >= listen_sockets) - sock = 0; /* If none is available, just use the first and hope for the best. */ - - /* Send the packet */ + for(sock = 0; sock < listen_sockets; sock++) + if(n->address.sa.sa_family == listen_socket[sock].sa.sa.sa_family) + break; + + if(sock >= listen_sockets) + sock = 0; /* If none is available, just use the first and hope for the best. */ + + /* Send the packet */ #if defined(SOL_IP) && defined(IP_TOS) - if(priorityinheritance && origpriority != priority && listen_socket[sock].sa.sa.sa_family == AF_INET) - { - priority = origpriority; - if(debug_lvl >= DEBUG_TRAFFIC) - syslog(LOG_DEBUG, _("Setting outgoing packet priority to %d"), priority); - if(setsockopt(sock, SOL_IP, IP_TOS, &priority, sizeof(priority))) /* SO_PRIORITY doesn't seem to work */ - syslog(LOG_ERR, _("System call `%s' failed: %s"), "setsockopt", strerror(errno)); - } + if(priorityinheritance && origpriority != priority + && listen_socket[sock].sa.sa.sa_family == AF_INET) { + priority = origpriority; + ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Setting outgoing packet priority to %d"), priority); + if(setsockopt(listen_socket[sock].udp, SOL_IP, IP_TOS, &priority, sizeof(priority))) /* SO_PRIORITY doesn't seem to work */ + logger(LOG_ERR, _("System call `%s' failed: %s"), "setsockopt", strerror(errno)); + } #endif - if((sendto(listen_socket[sock].udp, (char *)&inpkt->seqno, inpkt->len, 0, &(n->address.sa), SALEN(n->address.sa))) < 0) - { - syslog(LOG_ERR, _("Error sending packet to %s (%s): %s"), - n->name, n->hostname, strerror(errno)); - return; - } - - inpkt->len = origlen; -cp + if((sendto(listen_socket[sock].udp, (char *) &inpkt->seqno, inpkt->len, 0, &(n->address.sa), SALEN(n->address.sa))) < 0) { + if(errno == EMSGSIZE) { + if(n->maxmtu >= origlen) + n->maxmtu = origlen - 1; + if(n->mtu >= origlen) + n->mtu = origlen - 1; + } else + logger(LOG_ERR, _("Error sending packet to %s (%s): %s"), n->name, n->hostname, strerror(errno)); + } + +end: + inpkt->len = origlen; } /* send a packet to the given vpn ip. */ -void send_packet(node_t *n, vpn_packet_t *packet) +void send_packet(const node_t *n, vpn_packet_t *packet) { - node_t *via; -cp - if(debug_lvl >= DEBUG_TRAFFIC) - syslog(LOG_ERR, _("Sending packet of %d bytes to %s (%s)"), - packet->len, n->name, n->hostname); + node_t *via; - if(n == myself) - { - if(debug_lvl >= DEBUG_TRAFFIC) - { - syslog(LOG_NOTICE, _("Packet is looping back to us!")); - } + cp(); - return; - } - - if(!n->status.reachable) - { - if(debug_lvl >= DEBUG_TRAFFIC) - syslog(LOG_INFO, _("Node %s (%s) is not reachable"), - n->name, n->hostname); - return; - } + if(n == myself) { + if(overwrite_mac) + memcpy(packet->data, mymac.x, ETH_ALEN); + write_packet(packet); + return; + } - via = (n->via == myself)?n->nexthop:n->via; + ifdebug(TRAFFIC) logger(LOG_ERR, _("Sending packet of %d bytes to %s (%s)"), + packet->len, n->name, n->hostname); - if(via != n && debug_lvl >= DEBUG_TRAFFIC) - syslog(LOG_ERR, _("Sending packet to %s via %s (%s)"), - n->name, via->name, n->via->hostname); + if(!n->status.reachable) { + ifdebug(TRAFFIC) logger(LOG_INFO, _("Node %s (%s) is not reachable"), + n->name, n->hostname); + return; + } - if((myself->options | via->options) & OPTION_TCPONLY) - { - if(send_tcppacket(via->connection, packet)) - terminate_connection(via->connection, 1); - } - else - send_udppacket(via, packet); + via = (n->via == myself) ? n->nexthop : n->via; + + if(via != n) + ifdebug(TRAFFIC) logger(LOG_ERR, _("Sending packet to %s via %s (%s)"), + n->name, via->name, n->via->hostname); + + if((myself->options | via->options) & OPTION_TCPONLY) { + if(!send_tcppacket(via->connection, packet)) + terminate_connection(via->connection, true); + } else + send_udppacket(via, packet); } /* Broadcast a packet using the minimum spanning tree */ -void broadcast_packet(node_t *from, vpn_packet_t *packet) +void broadcast_packet(const node_t *from, vpn_packet_t *packet) { - avl_node_t *node; - connection_t *c; -cp - if(debug_lvl >= DEBUG_TRAFFIC) - syslog(LOG_INFO, _("Broadcasting packet of %d bytes from %s (%s)"), - packet->len, from->name, from->hostname); + avl_node_t *node; + connection_t *c; - for(node = connection_tree->head; node; node = node->next) - { - c = (connection_t *)node->data; - if(c->status.active && c->status.mst && c != from->nexthop->connection) - send_packet(c->node, packet); - } -cp + cp(); + + ifdebug(TRAFFIC) logger(LOG_INFO, _("Broadcasting packet of %d bytes from %s (%s)"), + packet->len, from->name, from->hostname); + + for(node = connection_tree->head; node; node = node->next) { + c = node->data; + + if(c->status.active && c->status.mst && c != from->nexthop->connection) + send_packet(c->node, packet); + } } void flush_queue(node_t *n) { - list_node_t *node, *next; -cp - if(debug_lvl >= DEBUG_TRAFFIC) - syslog(LOG_INFO, _("Flushing queue for %s (%s)"), n->name, n->hostname); + list_node_t *node, *next; - for(node = n->queue->head; node; node = next) - { - next = node->next; - send_udppacket(n, (vpn_packet_t *)node->data); - list_delete_node(n->queue, node); - } -cp + cp(); + + ifdebug(TRAFFIC) logger(LOG_INFO, _("Flushing queue for %s (%s)"), n->name, n->hostname); + + for(node = n->queue->head; node; node = next) { + next = node->next; + send_udppacket(n, node->data); + list_delete_node(n->queue, node); + } } void handle_incoming_vpn_data(int sock) { - vpn_packet_t pkt; - int x, l = sizeof(x); - char *hostname; - sockaddr_t from; - socklen_t fromlen = sizeof(from); - node_t *n; -cp - if(getsockopt(sock, SOL_SOCKET, SO_ERROR, &x, &l) < 0) - { - syslog(LOG_ERR, _("This is a bug: %s:%d: %d:%s"), - __FILE__, __LINE__, sock, strerror(errno)); - cp_trace(); - exit(1); - } - if(x) - { - syslog(LOG_ERR, _("Incoming data socket error: %s"), strerror(x)); - return; - } + vpn_packet_t pkt; + char *hostname; + sockaddr_t from; + socklen_t fromlen = sizeof(from); + node_t *n; - if((pkt.len = recvfrom(sock, (char *)&pkt.seqno, MAXSIZE, 0, &from.sa, &fromlen)) <= 0) - { - syslog(LOG_ERR, _("Receiving packet failed: %s"), strerror(errno)); - return; - } + cp(); - sockaddrunmap(&from); /* Some braindead IPv6 implementations do stupid things. */ + pkt.len = recvfrom(sock, (char *) &pkt.seqno, MAXSIZE, 0, &from.sa, &fromlen); - n = lookup_node_udp(&from); + if(pkt.len < 0) { + logger(LOG_ERR, _("Receiving packet failed: %s"), strerror(errno)); + return; + } - if(!n) - { - hostname = sockaddr2hostname(&from); - syslog(LOG_WARNING, _("Received UDP packet from unknown source %s"), hostname); - free(hostname); - return; - } + sockaddrunmap(&from); /* Some braindead IPv6 implementations do stupid things. */ - if(n->connection) - n->connection->last_ping_time = now; + n = lookup_node_udp(&from); - receive_udppacket(n, &pkt); -cp + if(!n) { + hostname = sockaddr2hostname(&from); + logger(LOG_WARNING, _("Received UDP packet from unknown source %s"), + hostname); + free(hostname); + return; + } + + receive_udppacket(n, &pkt); } - diff --git a/src/net_setup.c b/src/net_setup.c index b5dc727..adab035 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -1,7 +1,7 @@ /* net_setup.c -- Setup. - Copyright (C) 1998-2002 Ivo Timmermans , - 2000-2002 Guus Sliepen + Copyright (C) 1998-2004 Ivo Timmermans , + 2000-2004 Guus Sliepen 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 @@ -17,509 +17,534 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net_setup.c,v 1.1.2.14 2002/04/01 21:28:39 guus Exp $ + $Id: net_setup.c 1413 2004-11-10 21:56:31Z guus $ */ -#include "config.h" - -#include -#include -#include -#include -#ifdef HAVE_LINUX - #include - #include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -/* SunOS really wants sys/socket.h BEFORE net/if.h, - and FreeBSD wants these lines below the rest. */ -#include -#include -#include +#include "system.h" #include #include #include +#include +#include -#include -#include -#include -#include - +#include "avl_tree.h" #include "conf.h" #include "connection.h" -#include "meta.h" +#include "device.h" +#include "event.h" +#include "graph.h" +#include "logger.h" #include "net.h" #include "netutl.h" #include "process.h" #include "protocol.h" -#include "subnet.h" -#include "graph.h" -#include "process.h" #include "route.h" -#include "device.h" -#include "event.h" - -#include "system.h" +#include "subnet.h" +#include "utils.h" +#include "xalloc.h" char *myport; -int read_rsa_public_key(connection_t *c) +bool read_rsa_public_key(connection_t *c) { - FILE *fp; - char *fname; - char *key; -cp - if(!c->rsa_key) - c->rsa_key = RSA_new(); + FILE *fp; + char *fname; + char *key; - /* First, check for simple PublicKey statement */ + cp(); - if(get_config_string(lookup_config(c->config_tree, "PublicKey"), &key)) - { - BN_hex2bn(&c->rsa_key->n, key); - BN_hex2bn(&c->rsa_key->e, "FFFF"); - free(key); - return 0; - } + if(!c->rsa_key) { + c->rsa_key = RSA_new(); +// RSA_blinding_on(c->rsa_key, NULL); + } - /* Else, check for PublicKeyFile statement and read it */ + /* First, check for simple PublicKey statement */ - if(get_config_string(lookup_config(c->config_tree, "PublicKeyFile"), &fname)) - { - if(is_safe_path(fname)) - { - if((fp = fopen(fname, "r")) == NULL) - { - syslog(LOG_ERR, _("Error reading RSA public key file `%s': %s"), - fname, strerror(errno)); - free(fname); - return -1; - } - free(fname); - c->rsa_key = PEM_read_RSAPublicKey(fp, &c->rsa_key, NULL, NULL); - fclose(fp); - if(!c->rsa_key) - { - syslog(LOG_ERR, _("Reading RSA public key file `%s' failed: %s"), - fname, strerror(errno)); - return -1; - } - return 0; - } - else - { - free(fname); - return -1; - } - } + if(get_config_string(lookup_config(c->config_tree, "PublicKey"), &key)) { + BN_hex2bn(&c->rsa_key->n, key); + BN_hex2bn(&c->rsa_key->e, "FFFF"); + free(key); + return true; + } - /* Else, check if a harnessed public key is in the config file */ + /* Else, check for PublicKeyFile statement and read it */ - asprintf(&fname, "%s/hosts/%s", confbase, c->name); - if((fp = fopen(fname, "r"))) - { - c->rsa_key = PEM_read_RSAPublicKey(fp, &c->rsa_key, NULL, NULL); - fclose(fp); - } + if(get_config_string(lookup_config(c->config_tree, "PublicKeyFile"), &fname)) { + fp = fopen(fname, "r"); - free(fname); + if(!fp) { + logger(LOG_ERR, _("Error reading RSA public key file `%s': %s"), + fname, strerror(errno)); + free(fname); + return false; + } - if(c->rsa_key) - return 0; - else - { - syslog(LOG_ERR, _("No public key for %s specified!"), c->name); - return -1; - } + free(fname); + c->rsa_key = PEM_read_RSAPublicKey(fp, &c->rsa_key, NULL, NULL); + fclose(fp); + + if(c->rsa_key) + return true; /* Woohoo. */ + + /* If it fails, try PEM_read_RSA_PUBKEY. */ + fp = fopen(fname, "r"); + + if(!fp) { + logger(LOG_ERR, _("Error reading RSA public key file `%s': %s"), + fname, strerror(errno)); + free(fname); + return false; + } + + free(fname); + c->rsa_key = PEM_read_RSA_PUBKEY(fp, &c->rsa_key, NULL, NULL); + fclose(fp); + + if(c->rsa_key) { +// RSA_blinding_on(c->rsa_key, NULL); + return true; + } + + logger(LOG_ERR, _("Reading RSA public key file `%s' failed: %s"), + fname, strerror(errno)); + return false; + } + + /* Else, check if a harnessed public key is in the config file */ + + asprintf(&fname, "%s/hosts/%s", confbase, c->name); + fp = fopen(fname, "r"); + + if(fp) { + c->rsa_key = PEM_read_RSAPublicKey(fp, &c->rsa_key, NULL, NULL); + fclose(fp); + } + + free(fname); + + if(c->rsa_key) + return true; + + /* Try again with PEM_read_RSA_PUBKEY. */ + + asprintf(&fname, "%s/hosts/%s", confbase, c->name); + fp = fopen(fname, "r"); + + if(fp) { + c->rsa_key = PEM_read_RSA_PUBKEY(fp, &c->rsa_key, NULL, NULL); +// RSA_blinding_on(c->rsa_key, NULL); + fclose(fp); + } + + free(fname); + + if(c->rsa_key) + return true; + + logger(LOG_ERR, _("No public key for %s specified!"), c->name); + + return false; } -int read_rsa_private_key(void) +bool read_rsa_private_key(void) { - FILE *fp; - char *fname, *key; -cp - if(get_config_string(lookup_config(config_tree, "PrivateKey"), &key)) - { - myself->connection->rsa_key = RSA_new(); - BN_hex2bn(&myself->connection->rsa_key->d, key); - BN_hex2bn(&myself->connection->rsa_key->e, "FFFF"); - free(key); - return 0; - } + FILE *fp; + char *fname, *key, *pubkey; + struct stat s; - if(!get_config_string(lookup_config(config_tree, "PrivateKeyFile"), &fname)) - asprintf(&fname, "%s/rsa_key.priv", confbase); + cp(); - if(is_safe_path(fname)) - { - if((fp = fopen(fname, "r")) == NULL) - { - syslog(LOG_ERR, _("Error reading RSA private key file `%s': %s"), - fname, strerror(errno)); - free(fname); - return -1; - } - free(fname); - myself->connection->rsa_key = PEM_read_RSAPrivateKey(fp, NULL, NULL, NULL); - fclose(fp); - if(!myself->connection->rsa_key) - { - syslog(LOG_ERR, _("Reading RSA private key file `%s' failed: %s"), - fname, strerror(errno)); - return -1; - } - return 0; - } + if(get_config_string(lookup_config(config_tree, "PrivateKey"), &key)) { + if(!get_config_string(lookup_config(myself->connection->config_tree, "PublicKey"), &pubkey)) { + logger(LOG_ERR, _("PrivateKey used but no PublicKey found!")); + return false; + } + myself->connection->rsa_key = RSA_new(); +// RSA_blinding_on(myself->connection->rsa_key, NULL); + BN_hex2bn(&myself->connection->rsa_key->d, key); + BN_hex2bn(&myself->connection->rsa_key->n, pubkey); + BN_hex2bn(&myself->connection->rsa_key->e, "FFFF"); + free(key); + free(pubkey); + return true; + } - free(fname); - return -1; + if(!get_config_string(lookup_config(config_tree, "PrivateKeyFile"), &fname)) + asprintf(&fname, "%s/rsa_key.priv", confbase); + + fp = fopen(fname, "r"); + + if(!fp) { + logger(LOG_ERR, _("Error reading RSA private key file `%s': %s"), + fname, strerror(errno)); + free(fname); + return false; + } + +#if !defined(HAVE_MINGW) && !defined(HAVE_CYGWIN) + if(fstat(fileno(fp), &s)) { + logger(LOG_ERR, _("Could not stat RSA private key file `%s': %s'"), + fname, strerror(errno)); + free(fname); + return false; + } + + if(s.st_mode & ~0100700) + logger(LOG_WARNING, _("Warning: insecure file permissions for RSA private key file `%s'!"), fname); +#endif + + myself->connection->rsa_key = PEM_read_RSAPrivateKey(fp, NULL, NULL, NULL); + fclose(fp); + + if(!myself->connection->rsa_key) { + logger(LOG_ERR, _("Reading RSA private key file `%s' failed: %s"), + fname, strerror(errno)); + free(fname); + return false; + } + + free(fname); + return true; } /* Configure node_t myself and set up the local sockets (listen only) */ -int setup_myself(void) +bool setup_myself(void) { - config_t *cfg; - subnet_t *subnet; - char *name, *hostname, *mode, *afname, *cipher, *digest; - struct addrinfo hint, *ai, *aip; - int choice, err; -cp - myself = new_node(); - myself->connection = new_connection(); - init_configuration(&myself->connection->config_tree); + config_t *cfg; + subnet_t *subnet; + char *name, *hostname, *mode, *afname, *cipher, *digest; + char *address = NULL; + char *envp[5]; + struct addrinfo *ai, *aip, hint = {0}; + bool choice; + int i, err; - asprintf(&myself->hostname, _("MYSELF")); - asprintf(&myself->connection->hostname, _("MYSELF")); + cp(); - myself->connection->options = 0; - myself->connection->protocol_version = PROT_CURRENT; + myself = new_node(); + myself->connection = new_connection(); + init_configuration(&myself->connection->config_tree); - if(!get_config_string(lookup_config(config_tree, "Name"), &name)) /* Not acceptable */ - { - syslog(LOG_ERR, _("Name for tinc daemon required!")); - return -1; - } + asprintf(&myself->hostname, _("MYSELF")); + asprintf(&myself->connection->hostname, _("MYSELF")); - if(check_id(name)) - { - syslog(LOG_ERR, _("Invalid name for myself!")); - free(name); - return -1; - } + myself->connection->options = 0; + myself->connection->protocol_version = PROT_CURRENT; - myself->name = name; - myself->connection->name = xstrdup(name); - -cp - if(read_rsa_private_key()) - return -1; - - if(read_connection_config(myself->connection)) - { - syslog(LOG_ERR, _("Cannot open host configuration file for myself!")); - return -1; - } - - if(read_rsa_public_key(myself->connection)) - return -1; -cp - - if(!get_config_string(lookup_config(myself->connection->config_tree, "Port"), &myport)) - asprintf(&myport, "655"); - -/* Read in all the subnets specified in the host configuration file */ - - cfg = lookup_config(myself->connection->config_tree, "Subnet"); - - while(cfg) - { - if(!get_config_subnet(cfg, &subnet)) - return -1; - - subnet_add(myself, subnet); - - cfg = lookup_config_next(myself->connection->config_tree, cfg); - } - -cp - /* Check some options */ - - if(get_config_bool(lookup_config(config_tree, "IndirectData"), &choice)) - if(choice) - myself->options |= OPTION_INDIRECT; - - if(get_config_bool(lookup_config(config_tree, "TCPOnly"), &choice)) - if(choice) - myself->options |= OPTION_TCPONLY; - - if(get_config_bool(lookup_config(myself->connection->config_tree, "IndirectData"), &choice)) - if(choice) - myself->options |= OPTION_INDIRECT; - - if(get_config_bool(lookup_config(myself->connection->config_tree, "TCPOnly"), &choice)) - if(choice) - myself->options |= OPTION_TCPONLY; - - if(myself->options & OPTION_TCPONLY) - myself->options |= OPTION_INDIRECT; - - if(get_config_string(lookup_config(config_tree, "Mode"), &mode)) - { - if(!strcasecmp(mode, "router")) - routing_mode = RMODE_ROUTER; - else if (!strcasecmp(mode, "switch")) - routing_mode = RMODE_SWITCH; - else if (!strcasecmp(mode, "hub")) - routing_mode = RMODE_HUB; - else - { - syslog(LOG_ERR, _("Invalid routing mode!")); - return -1; - } - free(mode); - } - else - routing_mode = RMODE_ROUTER; - - get_config_bool(lookup_config(config_tree, "PriorityInheritance"), &priorityinheritance); -#if !defined(SOL_IP) || !defined(IP_TOS) - if(priorityinheritance) - syslog(LOG_WARNING, _("PriorityInheritance not supported on this platform")); -#endif - - if(!get_config_int(lookup_config(config_tree, "MACExpire"), &macexpire)) - macexpire= 600; - - if(get_config_int(lookup_config(myself->connection->config_tree, "MaxTimeout"), &maxtimeout)) - { - if(maxtimeout <= 0) - { - syslog(LOG_ERR, _("Bogus maximum timeout!")); - return -1; - } - } - else - maxtimeout = 900; - - if(get_config_string(lookup_config(config_tree, "AddressFamily"), &afname)) - { - if(!strcasecmp(afname, "IPv4")) - addressfamily = AF_INET; - else if (!strcasecmp(afname, "IPv6")) - addressfamily = AF_INET6; - else if (!strcasecmp(afname, "any")) - addressfamily = AF_UNSPEC; - else - { - syslog(LOG_ERR, _("Invalid address family!")); - return -1; - } - free(afname); - } - else - addressfamily = AF_INET; - - get_config_bool(lookup_config(config_tree, "Hostnames"), &hostnames); -cp - /* Generate packet encryption key */ - - if(get_config_string(lookup_config(myself->connection->config_tree, "Cipher"), &cipher)) - { - if(!strcasecmp(cipher, "none")) - { - myself->cipher = NULL; - } - else - { - if(!(myself->cipher = EVP_get_cipherbyname(cipher))) - { - syslog(LOG_ERR, _("Unrecognized cipher type!")); - return -1; - } - } - } - else - myself->cipher = EVP_bf_cbc(); - - if(myself->cipher) - myself->keylength = myself->cipher->key_len + myself->cipher->iv_len; - else - myself->keylength = 1; - - myself->connection->outcipher = EVP_bf_ofb(); - - myself->key = (char *)xmalloc(myself->keylength); - RAND_pseudo_bytes(myself->key, myself->keylength); - - if(!get_config_int(lookup_config(config_tree, "KeyExpire"), &keylifetime)) - keylifetime = 3600; - - keyexpires = now + keylifetime; - - /* Check if we want to use message authentication codes... */ - - if(get_config_string(lookup_config(myself->connection->config_tree, "Digest"), &digest)) - { - if(!strcasecmp(digest, "none")) - { - myself->digest = NULL; - } - else - { - if(!(myself->digest = EVP_get_digestbyname(digest))) - { - syslog(LOG_ERR, _("Unrecognized digest type!")); - return -1; - } - } - } - else - myself->digest = EVP_sha1(); - - myself->connection->outdigest = EVP_sha1(); - - if(get_config_int(lookup_config(myself->connection->config_tree, "MACLength"), &myself->maclength)) - { - if(myself->digest) - { - if(myself->maclength > myself->digest->md_size) - { - syslog(LOG_ERR, _("MAC length exceeds size of digest!")); - return -1; - } - else if (myself->maclength < 0) - { - syslog(LOG_ERR, _("Bogus MAC length!")); - return -1; - } - } - } - else - myself->maclength = 4; - - myself->connection->outmaclength = 0; - - /* Compression */ - - if(get_config_int(lookup_config(myself->connection->config_tree, "Compression"), &myself->compression)) - { - if(myself->compression < 0 || myself->compression > 9) - { - syslog(LOG_ERR, _("Bogus compression level!")); - return -1; - } - } - else - myself->compression = 0; - - myself->connection->outcompression = 0; -cp - /* Done */ - - myself->nexthop = myself; - myself->via = myself; - myself->status.active = 1; - myself->status.reachable = 1; - node_add(myself); - - graph(); - -cp - /* Open sockets */ - - memset(&hint, 0, sizeof(hint)); - - hint.ai_family = addressfamily; - hint.ai_socktype = SOCK_STREAM; - hint.ai_protocol = IPPROTO_TCP; - hint.ai_flags = AI_PASSIVE; - - if((err = getaddrinfo(NULL, myport, &hint, &ai)) || !ai) - { - syslog(LOG_ERR, _("System call `%s' failed: %s"), "getaddrinfo", gai_strerror(err)); - return -1; - } - - for(aip = ai; aip; aip = aip->ai_next) - { - if((listen_socket[listen_sockets].tcp = setup_listen_socket((sockaddr_t *)aip->ai_addr)) < 0) - continue; - - if((listen_socket[listen_sockets].udp = setup_vpn_in_socket((sockaddr_t *)aip->ai_addr)) < 0) - continue; - - if(debug_lvl >= DEBUG_CONNECTIONS) - { - hostname = sockaddr2hostname((sockaddr_t *)aip->ai_addr); - syslog(LOG_NOTICE, _("Listening on %s"), hostname); - free(hostname); + if(!get_config_string(lookup_config(config_tree, "Name"), &name)) { /* Not acceptable */ + logger(LOG_ERR, _("Name for tinc daemon required!")); + return false; } - listen_socket[listen_sockets].sa.sa = *aip->ai_addr; - listen_sockets++; - } + if(!check_id(name)) { + logger(LOG_ERR, _("Invalid name for myself!")); + free(name); + return false; + } - freeaddrinfo(ai); + myself->name = name; + myself->connection->name = xstrdup(name); - if(listen_sockets) - syslog(LOG_NOTICE, _("Ready")); - else - { - syslog(LOG_ERR, _("Unable to create any listening socket!")); - return -1; - } -cp - return 0; + if(!read_connection_config(myself->connection)) { + logger(LOG_ERR, _("Cannot open host configuration file for myself!")); + return false; + } + + if(!read_rsa_private_key()) + return false; + + if(!get_config_string(lookup_config(myself->connection->config_tree, "Port"), &myport)) + asprintf(&myport, "655"); + + /* Read in all the subnets specified in the host configuration file */ + + cfg = lookup_config(myself->connection->config_tree, "Subnet"); + + while(cfg) { + if(!get_config_subnet(cfg, &subnet)) + return false; + + subnet_add(myself, subnet); + + cfg = lookup_config_next(myself->connection->config_tree, cfg); + } + + /* Check some options */ + + if(get_config_bool(lookup_config(config_tree, "IndirectData"), &choice) && choice) + myself->options |= OPTION_INDIRECT; + + if(get_config_bool(lookup_config(config_tree, "TCPOnly"), &choice) && choice) + myself->options |= OPTION_TCPONLY; + + if(get_config_bool(lookup_config(myself->connection->config_tree, "IndirectData"), &choice) && choice) + myself->options |= OPTION_INDIRECT; + + if(get_config_bool(lookup_config(myself->connection->config_tree, "TCPOnly"), &choice) && choice) + myself->options |= OPTION_TCPONLY; + + get_config_bool(lookup_config(config_tree, "BlockingTCP"), &blockingtcp); + + if(get_config_bool(lookup_config(myself->connection->config_tree, "PMTUDiscovery"), &choice) && choice) + myself->options |= OPTION_PMTU_DISCOVERY; + + if(myself->options & OPTION_TCPONLY) + myself->options |= OPTION_INDIRECT; + + get_config_bool(lookup_config(config_tree, "TunnelServer"), &tunnelserver); + + if(get_config_string(lookup_config(config_tree, "Mode"), &mode)) { + if(!strcasecmp(mode, "router")) + routing_mode = RMODE_ROUTER; + else if(!strcasecmp(mode, "switch")) + routing_mode = RMODE_SWITCH; + else if(!strcasecmp(mode, "hub")) + routing_mode = RMODE_HUB; + else { + logger(LOG_ERR, _("Invalid routing mode!")); + return false; + } + free(mode); + } else + routing_mode = RMODE_ROUTER; + + get_config_bool(lookup_config(config_tree, "PriorityInheritance"), &priorityinheritance); + +#if !defined(SOL_IP) || !defined(IP_TOS) + if(priorityinheritance) + logger(LOG_WARNING, _("PriorityInheritance not supported on this platform")); +#endif + + if(!get_config_int(lookup_config(config_tree, "MACExpire"), &macexpire)) + macexpire = 600; + + if(get_config_int(lookup_config(config_tree, "MaxTimeout"), &maxtimeout)) { + if(maxtimeout <= 0) { + logger(LOG_ERR, _("Bogus maximum timeout!")); + return false; + } + } else + maxtimeout = 900; + + if(get_config_string(lookup_config(config_tree, "AddressFamily"), &afname)) { + if(!strcasecmp(afname, "IPv4")) + addressfamily = AF_INET; + else if(!strcasecmp(afname, "IPv6")) + addressfamily = AF_INET6; + else if(!strcasecmp(afname, "any")) + addressfamily = AF_UNSPEC; + else { + logger(LOG_ERR, _("Invalid address family!")); + return false; + } + free(afname); + } + + get_config_bool(lookup_config(config_tree, "Hostnames"), &hostnames); + + /* Generate packet encryption key */ + + if(get_config_string + (lookup_config(myself->connection->config_tree, "Cipher"), &cipher)) { + if(!strcasecmp(cipher, "none")) { + myself->cipher = NULL; + } else { + myself->cipher = EVP_get_cipherbyname(cipher); + + if(!myself->cipher) { + logger(LOG_ERR, _("Unrecognized cipher type!")); + return false; + } + } + } else + myself->cipher = EVP_bf_cbc(); + + if(myself->cipher) + myself->keylength = myself->cipher->key_len + myself->cipher->iv_len; + else + myself->keylength = 1; + + myself->connection->outcipher = EVP_bf_ofb(); + + myself->key = xmalloc(myself->keylength); + RAND_pseudo_bytes(myself->key, myself->keylength); + + if(!get_config_int(lookup_config(config_tree, "KeyExpire"), &keylifetime)) + keylifetime = 3600; + + keyexpires = now + keylifetime; + + if(myself->cipher) { + EVP_CIPHER_CTX_init(&packet_ctx); + if(!EVP_DecryptInit_ex(&packet_ctx, myself->cipher, NULL, myself->key, myself->key + myself->cipher->key_len)) { + logger(LOG_ERR, _("Error during initialisation of cipher for %s (%s): %s"), + myself->name, myself->hostname, ERR_error_string(ERR_get_error(), NULL)); + return false; + } + + } + + /* Check if we want to use message authentication codes... */ + + if(get_config_string + (lookup_config(myself->connection->config_tree, "Digest"), &digest)) { + if(!strcasecmp(digest, "none")) { + myself->digest = NULL; + } else { + myself->digest = EVP_get_digestbyname(digest); + + if(!myself->digest) { + logger(LOG_ERR, _("Unrecognized digest type!")); + return false; + } + } + } else + myself->digest = EVP_sha1(); + + myself->connection->outdigest = EVP_sha1(); + + if(get_config_int(lookup_config(myself->connection->config_tree, "MACLength"), + &myself->maclength)) { + if(myself->digest) { + if(myself->maclength > myself->digest->md_size) { + logger(LOG_ERR, _("MAC length exceeds size of digest!")); + return false; + } else if(myself->maclength < 0) { + logger(LOG_ERR, _("Bogus MAC length!")); + return false; + } + } + } else + myself->maclength = 4; + + myself->connection->outmaclength = 0; + + /* Compression */ + + if(get_config_int(lookup_config(myself->connection->config_tree, "Compression"), + &myself->compression)) { + if(myself->compression < 0 || myself->compression > 11) { + logger(LOG_ERR, _("Bogus compression level!")); + return false; + } + } else + myself->compression = 0; + + myself->connection->outcompression = 0; + + /* Done */ + + myself->nexthop = myself; + myself->via = myself; + myself->status.active = true; + myself->status.reachable = true; + node_add(myself); + + graph(); + + /* Open device */ + + if(!setup_device()) + return false; + + /* Run tinc-up script to further initialize the tap interface */ + asprintf(&envp[0], "NETNAME=%s", netname ? : ""); + asprintf(&envp[1], "DEVICE=%s", device ? : ""); + asprintf(&envp[2], "INTERFACE=%s", iface ? : ""); + asprintf(&envp[3], "NAME=%s", myself->name); + envp[4] = NULL; + + execute_script("tinc-up", envp); + + for(i = 0; i < 5; i++) + free(envp[i]); + + /* Open sockets */ + + get_config_string(lookup_config(config_tree, "BindToAddress"), &address); + + hint.ai_family = addressfamily; + hint.ai_socktype = SOCK_STREAM; + hint.ai_protocol = IPPROTO_TCP; + hint.ai_flags = AI_PASSIVE; + + err = getaddrinfo(address, myport, &hint, &ai); + + if(err || !ai) { + logger(LOG_ERR, _("System call `%s' failed: %s"), "getaddrinfo", + gai_strerror(err)); + return false; + } + + listen_sockets = 0; + + for(aip = ai; aip; aip = aip->ai_next) { + listen_socket[listen_sockets].tcp = + setup_listen_socket((sockaddr_t *) aip->ai_addr); + + if(listen_socket[listen_sockets].tcp < 0) + continue; + + listen_socket[listen_sockets].udp = + setup_vpn_in_socket((sockaddr_t *) aip->ai_addr); + + if(listen_socket[listen_sockets].udp < 0) + continue; + + ifdebug(CONNECTIONS) { + hostname = sockaddr2hostname((sockaddr_t *) aip->ai_addr); + logger(LOG_NOTICE, _("Listening on %s"), hostname); + free(hostname); + } + + listen_socket[listen_sockets].sa.sa = *aip->ai_addr; + listen_sockets++; + } + + freeaddrinfo(ai); + + if(listen_sockets) + logger(LOG_NOTICE, _("Ready")); + else { + logger(LOG_ERR, _("Unable to create any listening socket!")); + return false; + } + + return true; } /* setup all initial network connections */ -int setup_network_connections(void) +bool setup_network_connections(void) { -cp - now = time(NULL); + cp(); - init_connections(); - init_subnets(); - init_nodes(); - init_edges(); - init_events(); - init_requests(); + now = time(NULL); - if(get_config_int(lookup_config(config_tree, "PingTimeout"), &pingtimeout)) - { - if(pingtimeout < 1) - { - pingtimeout = 86400; - } - } - else - pingtimeout = 60; + init_connections(); + init_subnets(); + init_nodes(); + init_edges(); + init_events(); + init_requests(); - if(setup_device() < 0) - return -1; + if(get_config_int(lookup_config(config_tree, "PingTimeout"), &pingtimeout)) { + if(pingtimeout < 1) { + pingtimeout = 86400; + } + } else + pingtimeout = 60; - /* Run tinc-up script to further initialize the tap interface */ - execute_script("tinc-up"); + if(!setup_myself()) + return false; - if(setup_myself() < 0) - return -1; + try_outgoing_connections(); - try_outgoing_connections(); -cp - return 0; + return true; } /* @@ -527,38 +552,49 @@ cp */ void close_network_connections(void) { - avl_node_t *node, *next; - connection_t *c; - int i; -cp - for(node = connection_tree->head; node; node = next) - { - next = node->next; - c = (connection_t *)node->data; - if(c->outgoing) - free(c->outgoing->name), free(c->outgoing), c->outgoing = NULL; - terminate_connection(c, 0); - } + avl_node_t *node, *next; + connection_t *c; + char *envp[5]; + int i; - if(myself && myself->connection) - terminate_connection(myself->connection, 0); + cp(); - for(i = 0; i < listen_sockets; i++) - { - close(listen_socket[i].tcp); - close(listen_socket[i].udp); - } + for(node = connection_tree->head; node; node = next) { + next = node->next; + c = node->data; - exit_requests(); - exit_events(); - exit_edges(); - exit_subnets(); - exit_nodes(); - exit_connections(); + if(c->outgoing) + free(c->outgoing->name), free(c->outgoing), c->outgoing = NULL; + terminate_connection(c, false); + } - execute_script("tinc-down"); + if(myself && myself->connection) + terminate_connection(myself->connection, false); - close_device(); -cp - return; + for(i = 0; i < listen_sockets; i++) { + close(listen_socket[i].tcp); + close(listen_socket[i].udp); + } + + exit_requests(); + exit_events(); + exit_edges(); + exit_subnets(); + exit_nodes(); + exit_connections(); + + asprintf(&envp[0], "NETNAME=%s", netname ? : ""); + asprintf(&envp[1], "DEVICE=%s", device ? : ""); + asprintf(&envp[2], "INTERFACE=%s", iface ? : ""); + asprintf(&envp[3], "NAME=%s", myself->name); + envp[4] = NULL; + + execute_script("tinc-down", envp); + + for(i = 0; i < 4; i++) + free(envp[i]); + + close_device(); + + return; } diff --git a/src/net_socket.c b/src/net_socket.c index 73e5fb6..8dddd2b 100644 --- a/src/net_socket.c +++ b/src/net_socket.c @@ -1,7 +1,7 @@ /* net_socket.c -- Handle various kinds of sockets. - Copyright (C) 1998-2002 Ivo Timmermans , - 2000-2002 Guus Sliepen + Copyright (C) 1998-2004 Ivo Timmermans , + 2000-2004 Guus Sliepen 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 @@ -17,468 +17,465 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net_socket.c,v 1.1.2.11 2002/03/27 14:02:36 guus Exp $ + $Id: net_socket.c 1413 2004-11-10 21:56:31Z guus $ */ -#include "config.h" - -#include -#include -#include -#include -#ifdef HAVE_LINUX - #include - #include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -/* SunOS really wants sys/socket.h BEFORE net/if.h, - and FreeBSD wants these lines below the rest. */ -#include -#include -#include - -#include -#include -#include -#include - -#include "conf.h" -#include "connection.h" -#include "meta.h" -#include "net.h" -#include "netutl.h" -#include "process.h" -#include "protocol.h" -#include "subnet.h" -#include "graph.h" -#include "process.h" -#include "route.h" -#include "device.h" -#include "event.h" - #include "system.h" -int addressfamily = AF_INET; +#include "avl_tree.h" +#include "conf.h" +#include "connection.h" +#include "event.h" +#include "logger.h" +#include "meta.h" +#include "net.h" +#include "netutl.h" +#include "protocol.h" +#include "utils.h" +#include "xalloc.h" + +#ifdef WSAEINPROGRESS +#define EINPROGRESS WSAEINPROGRESS +#endif + +int addressfamily = AF_UNSPEC; int maxtimeout = 900; int seconds_till_retry = 5; +bool blockingtcp = false; listen_socket_t listen_socket[MAXSOCKETS]; -int listen_sockets = 0; +int listen_sockets; /* Setup sockets */ -int setup_listen_socket(sockaddr_t *sa) +int setup_listen_socket(const sockaddr_t *sa) { - int nfd, flags; - char *addrstr; - int option; -#if defined(SOL_SOCKET) && defined(SO_BINDTODEVICE) - char *interface; - struct ifreq ifr; + int nfd; + char *addrstr; + int option; + char *iface; + + cp(); + + nfd = socket(sa->sa.sa_family, SOCK_STREAM, IPPROTO_TCP); + + if(nfd < 0) { + ifdebug(STATUS) logger(LOG_ERR, _("Creating metasocket failed: %s"), strerror(errno)); + return -1; + } + +#ifdef O_NONBLOCK + { + int flags = fcntl(nfd, F_GETFL); + + if(fcntl(nfd, F_SETFL, flags | O_NONBLOCK) < 0) { + closesocket(nfd); + logger(LOG_ERR, _("System call `%s' failed: %s"), "fcntl", + strerror(errno)); + return -1; + } + } #endif -cp - if((nfd = socket(sa->sa.sa_family, SOCK_STREAM, IPPROTO_TCP)) < 0) - { - syslog(LOG_ERR, _("Creating metasocket failed: %s"), strerror(errno)); - return -1; - } - flags = fcntl(nfd, F_GETFL); - if(fcntl(nfd, F_SETFL, flags | O_NONBLOCK) < 0) - { - close(nfd); - syslog(LOG_ERR, _("System call `%s' failed: %s"), "fcntl", strerror(errno)); - return -1; - } + /* Optimize TCP settings */ - /* Optimize TCP settings */ - - option = 1; - setsockopt(nfd, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option)); + option = 1; + setsockopt(nfd, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option)); #if defined(SOL_TCP) && defined(TCP_NODELAY) - setsockopt(nfd, SOL_TCP, TCP_NODELAY, &option, sizeof(option)); + setsockopt(nfd, SOL_TCP, TCP_NODELAY, &option, sizeof(option)); #endif #if defined(SOL_IP) && defined(IP_TOS) && defined(IPTOS_LOWDELAY) - option = IPTOS_LOWDELAY; - setsockopt(nfd, SOL_IP, IP_TOS, &option, sizeof(option)); + option = IPTOS_LOWDELAY; + setsockopt(nfd, SOL_IP, IP_TOS, &option, sizeof(option)); #endif - if(get_config_string(lookup_config(config_tree, "BindToInterface"), &interface)) - { + if(get_config_string + (lookup_config(config_tree, "BindToInterface"), &iface)) { #if defined(SOL_SOCKET) && defined(SO_BINDTODEVICE) - memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_ifrn.ifrn_name, interface, IFNAMSIZ); - if(setsockopt(nfd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr))) - { - close(nfd); - syslog(LOG_ERR, _("Can't bind to interface %s: %s"), interface, strerror(errno)); - return -1; - } + struct ifreq ifr; + + memset(&ifr, 0, sizeof(ifr)); + strncpy(ifr.ifr_ifrn.ifrn_name, iface, IFNAMSIZ); + + if(setsockopt(nfd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr))) { + closesocket(nfd); + logger(LOG_ERR, _("Can't bind to interface %s: %s"), iface, + strerror(errno)); + return -1; + } #else - syslog(LOG_WARNING, _("BindToDevice not supported on this platform")); + logger(LOG_WARNING, _("BindToInterface not supported on this platform")); #endif - } + } - if(bind(nfd, &sa->sa, SALEN(sa->sa))) - { - close(nfd); - addrstr = sockaddr2hostname(sa); - syslog(LOG_ERR, _("Can't bind to %s/tcp: %s"), addrstr, strerror(errno)); - free(addrstr); - return -1; - } + if(bind(nfd, &sa->sa, SALEN(sa->sa))) { + closesocket(nfd); + addrstr = sockaddr2hostname(sa); + logger(LOG_ERR, _("Can't bind to %s/tcp: %s"), addrstr, + strerror(errno)); + free(addrstr); + return -1; + } - if(listen(nfd, 3)) - { - close(nfd); - syslog(LOG_ERR, _("System call `%s' failed: %s"), "listen", strerror(errno)); - return -1; - } -cp - return nfd; + if(listen(nfd, 3)) { + closesocket(nfd); + logger(LOG_ERR, _("System call `%s' failed: %s"), "listen", + strerror(errno)); + return -1; + } + + return nfd; } -int setup_vpn_in_socket(sockaddr_t *sa) +int setup_vpn_in_socket(const sockaddr_t *sa) { - int nfd, flags; - char *addrstr; - int option; -#if defined(SOL_SOCKET) && defined(SO_BINDTODEVICE) - char *interface; - struct ifreq ifr; -#endif -cp - if((nfd = socket(sa->sa.sa_family, SOCK_DGRAM, IPPROTO_UDP)) < 0) - { - syslog(LOG_ERR, _("Creating UDP socket failed: %s"), strerror(errno)); - return -1; - } + int nfd; + char *addrstr; + int option; - flags = fcntl(nfd, F_GETFL); - if(fcntl(nfd, F_SETFL, flags | O_NONBLOCK) < 0) - { - close(nfd); - syslog(LOG_ERR, _("System call `%s' failed: %s"), "fcntl", strerror(errno)); - return -1; - } + cp(); - option = 1; - setsockopt(nfd, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option)); + nfd = socket(sa->sa.sa_family, SOCK_DGRAM, IPPROTO_UDP); -#if defined(SOL_SOCKET) && defined(SO_BINDTODEVICE) - if(get_config_string(lookup_config(config_tree, "BindToInterface"), &interface)) - { - memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_ifrn.ifrn_name, interface, IFNAMSIZ); - if(setsockopt(nfd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr))) - { - close(nfd); - syslog(LOG_ERR, _("Can't bind to interface %s: %s"), interface, strerror(errno)); - return -1; + if(nfd < 0) { + logger(LOG_ERR, _("Creating UDP socket failed: %s"), strerror(errno)); + return -1; + } + +#ifdef O_NONBLOCK + { + int flags = fcntl(nfd, F_GETFL); + + if(fcntl(nfd, F_SETFL, flags | O_NONBLOCK) < 0) { + closesocket(nfd); + logger(LOG_ERR, _("System call `%s' failed: %s"), "fcntl", + strerror(errno)); + return -1; + } } - } #endif - if(bind(nfd, &sa->sa, SALEN(sa->sa))) - { - close(nfd); - addrstr = sockaddr2hostname(sa); - syslog(LOG_ERR, _("Can't bind to %s/udp: %s"), addrstr, strerror(errno)); - free(addrstr); - return -1; - } -cp - return nfd; + option = 1; + setsockopt(nfd, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option)); + +#if defined(SOL_IP) && defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DO) + { + bool choice; + + if(get_config_bool(lookup_config(myself->connection->config_tree, "PMTUDiscovery"), &choice) && choice) { + option = IP_PMTUDISC_DO; + setsockopt(nfd, SOL_IP, IP_MTU_DISCOVER, &option, sizeof(option)); + } + } +#endif + +#if defined(SOL_IPV6) && defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_DO) + { + bool choice; + + if(get_config_bool(lookup_config(myself->connection->config_tree, "PMTUDiscovery"), &choice) && choice) { + option = IPV6_PMTUDISC_DO; + setsockopt(nfd, SOL_IPV6, IPV6_MTU_DISCOVER, &option, sizeof(option)); + } + } +#endif + +#if defined(SOL_SOCKET) && defined(SO_BINDTODEVICE) + { + char *iface; + struct ifreq ifr; + + if(get_config_string(lookup_config(config_tree, "BindToInterface"), &iface)) { + memset(&ifr, 0, sizeof(ifr)); + strncpy(ifr.ifr_ifrn.ifrn_name, iface, IFNAMSIZ); + + if(setsockopt(nfd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr))) { + closesocket(nfd); + logger(LOG_ERR, _("Can't bind to interface %s: %s"), iface, + strerror(errno)); + return -1; + } + } + } +#endif + + if(bind(nfd, &sa->sa, SALEN(sa->sa))) { + closesocket(nfd); + addrstr = sockaddr2hostname(sa); + logger(LOG_ERR, _("Can't bind to %s/udp: %s"), addrstr, + strerror(errno)); + free(addrstr); + return -1; + } + + return nfd; } void retry_outgoing(outgoing_t *outgoing) { - event_t *event; -cp - outgoing->timeout += 5; - if(outgoing->timeout > maxtimeout) - outgoing->timeout = maxtimeout; + event_t *event; - event = new_event(); - event->handler = (event_handler_t)setup_outgoing_connection; - event->time = now + outgoing->timeout; - event->data = outgoing; - event_add(event); + cp(); - if(debug_lvl >= DEBUG_CONNECTIONS) - syslog(LOG_NOTICE, _("Trying to re-establish outgoing connection in %d seconds"), outgoing->timeout); -cp + outgoing->timeout += 5; + + if(outgoing->timeout > maxtimeout) + outgoing->timeout = maxtimeout; + + event = new_event(); + event->handler = (event_handler_t) setup_outgoing_connection; + event->time = now + outgoing->timeout; + event->data = outgoing; + event_add(event); + + ifdebug(CONNECTIONS) logger(LOG_NOTICE, + _("Trying to re-establish outgoing connection in %d seconds"), + outgoing->timeout); } -int setup_outgoing_socket(connection_t *c) -{ - int option; -cp - if(debug_lvl >= DEBUG_CONNECTIONS) - syslog(LOG_INFO, _("Trying to connect to %s (%s)"), c->name, c->hostname); - - c->socket = socket(c->address.sa.sa_family, SOCK_STREAM, IPPROTO_TCP); - - if(c->socket == -1) - { - syslog(LOG_ERR, _("Creating socket for %s failed: %s"), c->hostname, strerror(errno)); - return -1; - } - - /* Optimize TCP settings */ - -#ifdef HAVE_LINUX - option = 1; - setsockopt(c->socket, SOL_TCP, TCP_NODELAY, &option, sizeof(option)); - - option = IPTOS_LOWDELAY; - setsockopt(c->socket, SOL_IP, IP_TOS, &option, sizeof(option)); -#endif - - /* Connect */ - - if(connect(c->socket, &c->address.sa, SALEN(c->address.sa)) == -1) - { - close(c->socket); - syslog(LOG_ERR, _("Error while connecting to %s (%s): %s"), c->name, c->hostname, strerror(errno)); - return -1; - } - - if(debug_lvl >= DEBUG_CONNECTIONS) - syslog(LOG_INFO, _("Connected to %s (%s)"), c->name, c->hostname); -cp - return 0; -} - - void finish_connecting(connection_t *c) { -cp - if(debug_lvl >= DEBUG_CONNECTIONS) - syslog(LOG_INFO, _("Connected to %s (%s)"), c->name, c->hostname); + cp(); - c->last_ping_time = now; + ifdebug(CONNECTIONS) logger(LOG_INFO, _("Connected to %s (%s)"), c->name, c->hostname); - send_id(c); -cp +#ifdef O_NONBLOCK + if(blockingtcp) { + int flags = fcntl(c->socket, F_GETFL); + + if(fcntl(c->socket, F_SETFL, flags & ~O_NONBLOCK) < 0) { + logger(LOG_ERR, _("fcntl for %s: %s"), c->hostname, strerror(errno)); + } + } +#endif + + c->last_ping_time = now; + + send_id(c); } void do_outgoing_connection(connection_t *c) { - char *address, *port; - int option, result, flags; -cp + char *address, *port; + int option, result, flags; + + cp(); + begin: - if(!c->outgoing->ai) - { - if(!c->outgoing->cfg) - { - if(debug_lvl >= DEBUG_CONNECTIONS) - syslog(LOG_ERR, _("Could not set up a meta connection to %s"), c->name); - c->status.remove = 1; - retry_outgoing(c->outgoing); - return; - } + if(!c->outgoing->ai) { + if(!c->outgoing->cfg) { + ifdebug(CONNECTIONS) logger(LOG_ERR, _("Could not set up a meta connection to %s"), + c->name); + c->status.remove = true; + retry_outgoing(c->outgoing); + return; + } - get_config_string(c->outgoing->cfg, &address); + get_config_string(c->outgoing->cfg, &address); - if(!get_config_string(lookup_config(c->config_tree, "Port"), &port)) - asprintf(&port, "655"); + if(!get_config_string(lookup_config(c->config_tree, "Port"), &port)) + asprintf(&port, "655"); - c->outgoing->ai = str2addrinfo(address, port, SOCK_STREAM); - free(address); - free(port); + c->outgoing->ai = str2addrinfo(address, port, SOCK_STREAM); + free(address); + free(port); - c->outgoing->aip = c->outgoing->ai; - c->outgoing->cfg = lookup_config_next(c->config_tree, c->outgoing->cfg); - } - - if(!c->outgoing->aip) - { - freeaddrinfo(c->outgoing->ai); - c->outgoing->ai = NULL; - goto begin; - } - - memcpy(&c->address, c->outgoing->aip->ai_addr, c->outgoing->aip->ai_addrlen); - c->outgoing->aip = c->outgoing->aip->ai_next; - - if(c->hostname) - free(c->hostname); - - c->hostname = sockaddr2hostname(&c->address); - - if(debug_lvl >= DEBUG_CONNECTIONS) - syslog(LOG_INFO, _("Trying to connect to %s (%s)"), c->name, c->hostname); - - c->socket = socket(c->address.sa.sa_family, SOCK_STREAM, IPPROTO_TCP); - - if(c->socket == -1) - { - if(debug_lvl >= DEBUG_CONNECTIONS) - syslog(LOG_ERR, _("Creating socket for %s failed: %s"), c->hostname, strerror(errno)); - - goto begin; - } - - /* Optimize TCP settings */ - -#ifdef HAVE_LINUX - option = 1; - setsockopt(c->socket, SOL_TCP, TCP_NODELAY, &option, sizeof(option)); - - option = IPTOS_LOWDELAY; - setsockopt(c->socket, SOL_IP, IP_TOS, &option, sizeof(option)); -#endif - - /* Non-blocking */ - - flags = fcntl(c->socket, F_GETFL); - - if(fcntl(c->socket, F_SETFL, flags | O_NONBLOCK) < 0) - { - syslog(LOG_ERR, _("fcntl for %s: %s"), c->hostname, strerror(errno)); - } - - /* Connect */ - - result = connect(c->socket, &c->address.sa, SALEN(c->address.sa)); - - if(result == -1) - { - if(errno == EINPROGRESS) - { - c->status.connecting = 1; - return; + c->outgoing->aip = c->outgoing->ai; + c->outgoing->cfg = lookup_config_next(c->config_tree, c->outgoing->cfg); } - close(c->socket); + if(!c->outgoing->aip) { + freeaddrinfo(c->outgoing->ai); + c->outgoing->ai = NULL; + goto begin; + } - if(debug_lvl >= DEBUG_CONNECTIONS) - syslog(LOG_ERR, _("%s: %s"), c->hostname, strerror(errno)); + memcpy(&c->address, c->outgoing->aip->ai_addr, c->outgoing->aip->ai_addrlen); + c->outgoing->aip = c->outgoing->aip->ai_next; - goto begin; - } + if(c->hostname) + free(c->hostname); - finish_connecting(c); - return; -cp + c->hostname = sockaddr2hostname(&c->address); + + ifdebug(CONNECTIONS) logger(LOG_INFO, _("Trying to connect to %s (%s)"), c->name, + c->hostname); + + c->socket = socket(c->address.sa.sa_family, SOCK_STREAM, IPPROTO_TCP); + + if(c->socket == -1) { + ifdebug(CONNECTIONS) logger(LOG_ERR, _("Creating socket for %s failed: %s"), c->hostname, + strerror(errno)); + + goto begin; + } + + /* Optimize TCP settings */ + +#if defined(SOL_TCP) && defined(TCP_NODELAY) + option = 1; + setsockopt(c->socket, SOL_TCP, TCP_NODELAY, &option, sizeof(option)); +#endif + +#if defined(SOL_IP) && defined(IP_TOS) + option = IPTOS_LOWDELAY; + setsockopt(c->socket, SOL_IP, IP_TOS, &option, sizeof(option)); +#endif + + /* Non-blocking */ + +#ifdef O_NONBLOCK + flags = fcntl(c->socket, F_GETFL); + + if(fcntl(c->socket, F_SETFL, flags | O_NONBLOCK) < 0) { + logger(LOG_ERR, _("fcntl for %s: %s"), c->hostname, strerror(errno)); + } +#endif + + /* Connect */ + + result = connect(c->socket, &c->address.sa, SALEN(c->address.sa)); + + if(result == -1) { + if(errno == EINPROGRESS) { + c->status.connecting = true; + return; + } + + closesocket(c->socket); + + ifdebug(CONNECTIONS) logger(LOG_ERR, _("%s: %s"), c->hostname, strerror(errno)); + + goto begin; + } + + finish_connecting(c); + + return; } void setup_outgoing_connection(outgoing_t *outgoing) { - connection_t *c; - node_t *n; -cp - n = lookup_node(outgoing->name); - - if(n) - if(n->connection) - { - if(debug_lvl >= DEBUG_CONNECTIONS) - syslog(LOG_INFO, _("Already connected to %s"), outgoing->name); - n->connection->outgoing = outgoing; - return; - } + connection_t *c; + node_t *n; - c = new_connection(); - c->name = xstrdup(outgoing->name); - c->outcipher = myself->connection->outcipher; - c->outdigest = myself->connection->outdigest; - c->outmaclength = myself->connection->outmaclength; - c->outcompression = myself->connection->outcompression; + cp(); - init_configuration(&c->config_tree); - read_connection_config(c); - - outgoing->cfg = lookup_config(c->config_tree, "Address"); - - if(!outgoing->cfg) - { - syslog(LOG_ERR, _("No address specified for %s"), c->name); - free_connection(c); - free(outgoing->name); - free(outgoing); - return; - } - - c->outgoing = outgoing; - c->last_ping_time = now; + n = lookup_node(outgoing->name); - connection_add(c); + if(n) + if(n->connection) { + ifdebug(CONNECTIONS) logger(LOG_INFO, _("Already connected to %s"), outgoing->name); - do_outgoing_connection(c); + n->connection->outgoing = outgoing; + return; + } + + c = new_connection(); + c->name = xstrdup(outgoing->name); + c->outcipher = myself->connection->outcipher; + c->outdigest = myself->connection->outdigest; + c->outmaclength = myself->connection->outmaclength; + c->outcompression = myself->connection->outcompression; + + init_configuration(&c->config_tree); + read_connection_config(c); + + outgoing->cfg = lookup_config(c->config_tree, "Address"); + + if(!outgoing->cfg) { + logger(LOG_ERR, _("No address specified for %s"), c->name); + free_connection(c); + free(outgoing->name); + free(outgoing); + return; + } + + c->outgoing = outgoing; + c->last_ping_time = now; + + connection_add(c); + + do_outgoing_connection(c); } /* accept a new tcp connect and create a new connection */ -int handle_new_meta_connection(int sock) +bool handle_new_meta_connection(int sock) { - connection_t *c; - sockaddr_t sa; - int fd, len = sizeof(sa); -cp - if((fd = accept(sock, &sa.sa, &len)) < 0) - { - syslog(LOG_ERR, _("Accepting a new connection failed: %s"), strerror(errno)); - return -1; - } + connection_t *c; + sockaddr_t sa; + int fd, len = sizeof(sa); - sockaddrunmap(&sa); + cp(); - c = new_connection(); - c->outcipher = myself->connection->outcipher; - c->outdigest = myself->connection->outdigest; - c->outmaclength = myself->connection->outmaclength; - c->outcompression = myself->connection->outcompression; + fd = accept(sock, &sa.sa, &len); - c->address = sa; - c->hostname = sockaddr2hostname(&sa); - c->socket = fd; - c->last_ping_time = now; + if(fd < 0) { + logger(LOG_ERR, _("Accepting a new connection failed: %s"), + strerror(errno)); + return false; + } - if(debug_lvl >= DEBUG_CONNECTIONS) - syslog(LOG_NOTICE, _("Connection from %s"), c->hostname); + sockaddrunmap(&sa); - connection_add(c); + c = new_connection(); + c->outcipher = myself->connection->outcipher; + c->outdigest = myself->connection->outdigest; + c->outmaclength = myself->connection->outmaclength; + c->outcompression = myself->connection->outcompression; - c->allow_request = ID; - send_id(c); -cp - return 0; + c->address = sa; + c->hostname = sockaddr2hostname(&sa); + c->socket = fd; + c->last_ping_time = now; + + ifdebug(CONNECTIONS) logger(LOG_NOTICE, _("Connection from %s"), c->hostname); + +#ifdef O_NONBLOCK + if(blockingtcp) { + int flags = fcntl(c->socket, F_GETFL); + + if(fcntl(c->socket, F_SETFL, flags & ~O_NONBLOCK) < 0) { + logger(LOG_ERR, _("fcntl for %s: %s"), c->hostname, strerror(errno)); + } + } +#endif + + connection_add(c); + + c->allow_request = ID; + send_id(c); + + return true; } void try_outgoing_connections(void) { - static config_t *cfg = NULL; - char *name; - outgoing_t *outgoing; -cp - for(cfg = lookup_config(config_tree, "ConnectTo"); cfg; cfg = lookup_config_next(config_tree, cfg)) - { - get_config_string(cfg, &name); + static config_t *cfg = NULL; + char *name; + outgoing_t *outgoing; - if(check_id(name)) - { - syslog(LOG_ERR, _("Invalid name for outgoing connection in %s line %d"), cfg->file, cfg->line); - free(name); - continue; - } + cp(); - outgoing = xmalloc_and_zero(sizeof(*outgoing)); - outgoing->name = name; - setup_outgoing_connection(outgoing); - } + for(cfg = lookup_config(config_tree, "ConnectTo"); cfg; + cfg = lookup_config_next(config_tree, cfg)) { + get_config_string(cfg, &name); + + if(!check_id(name)) { + logger(LOG_ERR, + _("Invalid name for outgoing connection in %s line %d"), + cfg->file, cfg->line); + free(name); + continue; + } + + outgoing = xmalloc_and_zero(sizeof(*outgoing)); + outgoing->name = name; + setup_outgoing_connection(outgoing); + } } diff --git a/src/netutl.c b/src/netutl.c index 20d3809..3f3570c 100644 --- a/src/netutl.c +++ b/src/netutl.c @@ -1,7 +1,7 @@ /* netutl.c -- some supporting network utility code - Copyright (C) 1998-2002 Ivo Timmermans - 2000-2002 Guus Sliepen + Copyright (C) 1998-2004 Ivo Timmermans + 2000-2004 Guus Sliepen 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 @@ -17,230 +17,288 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: netutl.c,v 1.12.4.34 2002/04/05 09:11:38 guus Exp $ + $Id: netutl.c 1374 2004-03-21 14:21:22Z guus $ */ -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "errno.h" -#include "conf.h" -#include "net.h" -#include "netutl.h" - #include "system.h" -int hostnames = 0; +#include "net.h" +#include "netutl.h" +#include "logger.h" +#include "utils.h" +#include "xalloc.h" + +bool hostnames = false; /* Turn a string into a struct addrinfo. Return NULL on failure. */ -struct addrinfo *str2addrinfo(char *address, char *service, int socktype) +struct addrinfo *str2addrinfo(const char *address, const char *service, int socktype) { - struct addrinfo hint, *ai; - int err; -cp - memset(&hint, 0, sizeof(hint)); + struct addrinfo *ai, hint = {0}; + int err; - hint.ai_family = addressfamily; - hint.ai_socktype = socktype; + cp(); - if((err = getaddrinfo(address, service, &hint, &ai))) - { - if(debug_lvl >= DEBUG_ERROR) - syslog(LOG_WARNING, _("Error looking up %s port %s: %s\n"), address, service, gai_strerror(err)); - cp_trace(); - return NULL; - } + hint.ai_family = addressfamily; + hint.ai_socktype = socktype; -cp - return ai; + err = getaddrinfo(address, service, &hint, &ai); + + if(err) { + logger(LOG_WARNING, _("Error looking up %s port %s: %s"), address, + service, gai_strerror(err)); + return NULL; + } + + return ai; } -sockaddr_t str2sockaddr(char *address, char *port) +sockaddr_t str2sockaddr(const char *address, const char *port) { - struct addrinfo hint, *ai; - sockaddr_t result; - int err; -cp - memset(&hint, 0, sizeof(hint)); + struct addrinfo *ai, hint = {0}; + sockaddr_t result; + int err; - hint.ai_family = AF_UNSPEC; - hint.ai_flags = AI_NUMERICHOST; - hint.ai_socktype = SOCK_STREAM; + cp(); - if((err = getaddrinfo(address, port, &hint, &ai) || !ai)) - { - syslog(LOG_ERR, _("Error looking up %s port %s: %s\n"), address, port, gai_strerror(err)); - cp_trace(); - raise(SIGFPE); - exit(0); - } + hint.ai_family = AF_UNSPEC; + hint.ai_flags = AI_NUMERICHOST; + hint.ai_socktype = SOCK_STREAM; - result = *(sockaddr_t *)ai->ai_addr; - freeaddrinfo(ai); -cp - return result; + err = getaddrinfo(address, port, &hint, &ai); + + if(err || !ai) { + ifdebug(SCARY_THINGS) + logger(LOG_DEBUG, "Unknown type address %s port %s", address, port); + result.sa.sa_family = AF_UNKNOWN; + result.unknown.address = xstrdup(address); + result.unknown.port = xstrdup(port); + return result; + } + + result = *(sockaddr_t *) ai->ai_addr; + freeaddrinfo(ai); + + return result; } -void sockaddr2str(sockaddr_t *sa, char **addrstr, char **portstr) +void sockaddr2str(const sockaddr_t *sa, char **addrstr, char **portstr) { - char address[NI_MAXHOST]; - char port[NI_MAXSERV]; - char *scopeid; - int err; -cp - if((err = getnameinfo(&sa->sa, SALEN(sa->sa), address, sizeof(address), port, sizeof(port), NI_NUMERICHOST|NI_NUMERICSERV))) - { - syslog(LOG_ERR, _("Error while translating addresses: %s"), gai_strerror(err)); - cp_trace(); - raise(SIGFPE); - exit(0); - } + char address[NI_MAXHOST]; + char port[NI_MAXSERV]; + char *scopeid; + int err; -#ifdef HAVE_LINUX - if((scopeid = strchr(address, '%'))) - *scopeid = '\0'; /* Descope. */ -#endif + cp(); - *addrstr = xstrdup(address); - *portstr = xstrdup(port); -cp + if(sa->sa.sa_family == AF_UNKNOWN) { + *addrstr = xstrdup(sa->unknown.address); + *portstr = xstrdup(sa->unknown.port); + return; + } + + err = getnameinfo(&sa->sa, SALEN(sa->sa), address, sizeof(address), port, sizeof(port), NI_NUMERICHOST | NI_NUMERICSERV); + + if(err) { + logger(LOG_ERR, _("Error while translating addresses: %s"), + gai_strerror(err)); + cp_trace(); + raise(SIGFPE); + exit(0); + } + + scopeid = strchr(address, '%'); + + if(scopeid) + *scopeid = '\0'; /* Descope. */ + + *addrstr = xstrdup(address); + *portstr = xstrdup(port); } -char *sockaddr2hostname(sockaddr_t *sa) +char *sockaddr2hostname(const sockaddr_t *sa) { - char *str; - char address[NI_MAXHOST] = "unknown"; - char port[NI_MAXSERV] = "unknown"; - int err; -cp - if((err = getnameinfo(&sa->sa, SALEN(sa->sa), address, sizeof(address), port, sizeof(port), hostnames?0:(NI_NUMERICHOST|NI_NUMERICSERV)))) - { - syslog(LOG_ERR, _("Error while looking up hostname: %s"), gai_strerror(err)); - } + char *str; + char address[NI_MAXHOST] = "unknown"; + char port[NI_MAXSERV] = "unknown"; + int err; - asprintf(&str, _("%s port %s"), address, port); -cp - return str; + cp(); + + if(sa->sa.sa_family == AF_UNKNOWN) { + asprintf(&str, _("%s port %s"), sa->unknown.address, sa->unknown.port); + return str; + } + + err = getnameinfo(&sa->sa, SALEN(sa->sa), address, sizeof(address), port, sizeof(port), + hostnames ? 0 : (NI_NUMERICHOST | NI_NUMERICSERV)); + if(err) { + logger(LOG_ERR, _("Error while looking up hostname: %s"), + gai_strerror(err)); + } + + asprintf(&str, _("%s port %s"), address, port); + + return str; } -int sockaddrcmp(sockaddr_t *a, sockaddr_t *b) +int sockaddrcmp(const sockaddr_t *a, const sockaddr_t *b) { - int result; -cp - result = a->sa.sa_family - b->sa.sa_family; - - if(result) - return result; - - switch(a->sa.sa_family) - { - case AF_UNSPEC: - return 0; - case AF_INET: - result = memcmp(&a->in.sin_addr, &b->in.sin_addr, sizeof(a->in.sin_addr)); + int result; + + cp(); + + result = a->sa.sa_family - b->sa.sa_family; + if(result) - return result; - return memcmp(&a->in.sin_port, &b->in.sin_port, sizeof(a->in.sin_port)); - case AF_INET6: - result = memcmp(&a->in6.sin6_addr, &b->in6.sin6_addr, sizeof(a->in6.sin6_addr)); - if(result) - return result; - return memcmp(&a->in6.sin6_port, &b->in6.sin6_port, sizeof(a->in6.sin6_port)); - default: - syslog(LOG_ERR, _("sockaddrcmp() was called with unknown address family %d, exitting!"), a->sa.sa_family); - cp_trace(); - raise(SIGFPE); - exit(0); - } -cp + return result; + + switch (a->sa.sa_family) { + case AF_UNSPEC: + return 0; + + case AF_UNKNOWN: + result = strcmp(a->unknown.address, b->unknown.address); + + if(result) + return result; + + return strcmp(a->unknown.port, b->unknown.port); + + case AF_INET: + result = memcmp(&a->in.sin_addr, &b->in.sin_addr, sizeof(a->in.sin_addr)); + + if(result) + return result; + + return memcmp(&a->in.sin_port, &b->in.sin_port, sizeof(a->in.sin_port)); + + case AF_INET6: + result = memcmp(&a->in6.sin6_addr, &b->in6.sin6_addr, sizeof(a->in6.sin6_addr)); + + if(result) + return result; + + return memcmp(&a->in6.sin6_port, &b->in6.sin6_port, sizeof(a->in6.sin6_port)); + + default: + logger(LOG_ERR, _("sockaddrcmp() was called with unknown address family %d, exitting!"), + a->sa.sa_family); + cp_trace(); + raise(SIGFPE); + exit(0); + } } +void sockaddrcpy(sockaddr_t *a, const sockaddr_t *b) { + cp(); + + if(b->sa.sa_family != AF_UNKNOWN) { + *a = *b; + } else { + a->unknown.family = AF_UNKNOWN; + a->unknown.address = xstrdup(b->unknown.address); + a->unknown.port = xstrdup(b->unknown.port); + } +} + +void sockaddrfree(sockaddr_t *a) { + cp(); + + if(a->sa.sa_family == AF_UNKNOWN) { + free(a->unknown.address); + free(a->unknown.port); + } +} + void sockaddrunmap(sockaddr_t *sa) { - if(sa->sa.sa_family == AF_INET6 && IN6_IS_ADDR_V4MAPPED(&sa->in6.sin6_addr)) - { - sa->in.sin_addr.s_addr = ((uint32_t *)&sa->in6.sin6_addr)[3]; - sa->in.sin_family = AF_INET; - } + cp(); + + if(sa->sa.sa_family == AF_INET6 && IN6_IS_ADDR_V4MAPPED(&sa->in6.sin6_addr)) { + sa->in.sin_addr.s_addr = ((uint32_t *) & sa->in6.sin6_addr)[3]; + sa->in.sin_family = AF_INET; + } } /* Subnet mask handling */ -int maskcmp(char *a, char *b, int masklen, int len) +int maskcmp(const void *va, const void *vb, int masklen, int len) { - int i, m, result; -cp - for(m = masklen, i = 0; m >= 8; m -= 8, i++) - if((result = a[i] - b[i])) - return result; + int i, m, result; + const char *a = va; + const char *b = vb; - if(m) - return (a[i] & (0x100 - (1 << (8 - m)))) - (b[i] & (0x100 - (1 << (8 - m)))); + cp(); - return 0; + for(m = masklen, i = 0; m >= 8; m -= 8, i++) { + result = a[i] - b[i]; + if(result) + return result; + } + + if(m) + return (a[i] & (0x100 - (1 << (8 - m)))) - + (b[i] & (0x100 - (1 << (8 - m)))); + + return 0; } -void mask(char *a, int masklen, int len) +void mask(void *va, int masklen, int len) { - int i; -cp - i = masklen / 8; - masklen %= 8; - - if(masklen) - a[i++] &= (0x100 - (1 << masklen)); - - for(; i < len; i++) - a[i] = 0; + int i; + char *a = va; + + cp(); + + i = masklen / 8; + masklen %= 8; + + if(masklen) + a[i++] &= (0x100 - (1 << masklen)); + + for(; i < len; i++) + a[i] = 0; } -void maskcpy(char *a, char *b, int masklen, int len) +void maskcpy(void *va, const void *vb, int masklen, int len) { - int i, m; -cp - for(m = masklen, i = 0; m >= 8; m -= 8, i++) - a[i] = b[i]; + int i, m; + char *a = va; + const char *b = vb; - if(m) - { - a[i] = b[i] & (0x100 - (1 << m)); - i++; - } + cp(); - for(; i < len; i++) - a[i] = 0; + for(m = masklen, i = 0; m >= 8; m -= 8, i++) + a[i] = b[i]; + + if(m) { + a[i] = b[i] & (0x100 - (1 << m)); + i++; + } + + for(; i < len; i++) + a[i] = 0; } -int maskcheck(char *a, int masklen, int len) +bool maskcheck(const void *va, int masklen, int len) { - int i; -cp - i = masklen / 8; - masklen %= 8; - - if(masklen) - if(a[i++] & (char)~(0x100 - (1 << masklen))) - return -1; - - for(; i < len; i++) - if(a[i] != 0) - return -1; + int i; + const char *a = va; - return 0; + cp(); + + i = masklen / 8; + masklen %= 8; + + if(masklen && a[i++] & (0xff >> masklen)) + return false; + + for(; i < len; i++) + if(a[i] != 0) + return false; + + return true; } diff --git a/src/netutl.h b/src/netutl.h index 654d7ad..9e3ad50 100644 --- a/src/netutl.h +++ b/src/netutl.h @@ -1,7 +1,7 @@ /* netutl.h -- header file for netutl.c - Copyright (C) 1998-2002 Ivo Timmermans - 2000-2002 Guus Sliepen + Copyright (C) 1998-2004 Ivo Timmermans + 2000-2004 Guus Sliepen 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 @@ -17,30 +17,27 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: netutl.h,v 1.2.4.11 2002/03/17 15:59:29 guus Exp $ + $Id: netutl.h 1374 2004-03-21 14:21:22Z guus $ */ #ifndef __TINC_NETUTL_H__ #define __TINC_NETUTL_H__ -#include -#include -#include - #include "net.h" -extern int hostnames; +extern bool hostnames; -extern char *hostlookup(unsigned long); -extern struct addrinfo *str2addrinfo(char *, char *, int); -extern sockaddr_t str2sockaddr(char *, char *); -extern void sockaddr2str(sockaddr_t *, char **, char **); -extern char *sockaddr2hostname(sockaddr_t *); -extern int sockaddrcmp(sockaddr_t *, sockaddr_t *); +extern struct addrinfo *str2addrinfo(const char *, const char *, int); +extern sockaddr_t str2sockaddr(const char *, const char *); +extern void sockaddr2str(const sockaddr_t *, char **, char **); +extern char *sockaddr2hostname(const sockaddr_t *); +extern int sockaddrcmp(const sockaddr_t *, const sockaddr_t *); extern void sockaddrunmap(sockaddr_t *); -extern int maskcmp(char *, char *, int, int); -extern void maskcpy(char *, char *, int, int); -extern void mask(char *, int, int); -extern int maskcheck(char *, int, int); +extern void sockaddrfree(sockaddr_t *); +extern void sockaddrcpy(sockaddr_t *, const sockaddr_t *); +extern int maskcmp(const void *, const void *, int, int); +extern void maskcpy(void *, const void *, int, int); +extern void mask(void *, int, int); +extern bool maskcheck(const void *, int, int); -#endif /* __TINC_NETUTL_H__ */ +#endif /* __TINC_NETUTL_H__ */ diff --git a/src/node.c b/src/node.c index e4581cc..e064ed7 100644 --- a/src/node.c +++ b/src/node.c @@ -1,7 +1,7 @@ /* node.c -- node tree management - Copyright (C) 2001-2002 Guus Sliepen , - 2001-2002 Ivo Timmermans + Copyright (C) 2001-2004 Guus Sliepen , + 2001-2004 Ivo Timmermans 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 @@ -17,157 +17,179 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: node.c,v 1.1.2.11 2002/03/22 13:31:18 guus Exp $ + $Id: node.c 1374 2004-03-21 14:21:22Z guus $ */ -#include "config.h" - -#include -#include - -#include -#include "node.h" -#include "netutl.h" -#include "net.h" -#include -#include - #include "system.h" -avl_tree_t *node_tree; /* Known nodes, sorted by name */ -avl_tree_t *node_udp_tree; /* Known nodes, sorted by address and port */ +#include "avl_tree.h" +#include "logger.h" +#include "net.h" +#include "netutl.h" +#include "node.h" +#include "utils.h" +#include "xalloc.h" + +avl_tree_t *node_tree; /* Known nodes, sorted by name */ +avl_tree_t *node_udp_tree; /* Known nodes, sorted by address and port */ node_t *myself; -int node_compare(node_t *a, node_t *b) +static int node_compare(const node_t *a, const node_t *b) { - return strcmp(a->name, b->name); + return strcmp(a->name, b->name); } -int node_udp_compare(node_t *a, node_t *b) +static int node_udp_compare(const node_t *a, const node_t *b) { - int result; -cp - result = sockaddrcmp(&a->address, &b->address); + int result; - if(result) - return result; + cp(); - return (a->name && b->name)?strcmp(a->name, b->name):0; + result = sockaddrcmp(&a->address, &b->address); + + if(result) + return result; + + return (a->name && b->name) ? strcmp(a->name, b->name) : 0; } void init_nodes(void) { -cp - node_tree = avl_alloc_tree((avl_compare_t)node_compare, NULL); - node_udp_tree = avl_alloc_tree((avl_compare_t)node_udp_compare, NULL); -cp + cp(); + + node_tree = avl_alloc_tree((avl_compare_t) node_compare, (avl_action_t) free_node); + node_udp_tree = avl_alloc_tree((avl_compare_t) node_udp_compare, NULL); } void exit_nodes(void) { -cp - avl_delete_tree(node_tree); - avl_delete_tree(node_udp_tree); -cp + cp(); + + avl_delete_tree(node_udp_tree); + avl_delete_tree(node_tree); } node_t *new_node(void) { - node_t *n = (node_t *)xmalloc_and_zero(sizeof(*n)); -cp - n->subnet_tree = new_subnet_tree(); - n->edge_tree = new_edge_tree(); - n->queue = list_alloc((list_action_t)free); -cp - return n; + node_t *n = xmalloc_and_zero(sizeof(*n)); + + cp(); + + n->subnet_tree = new_subnet_tree(); + n->edge_tree = new_edge_tree(); + n->queue = list_alloc((list_action_t) free); + EVP_CIPHER_CTX_init(&n->packet_ctx); + n->mtu = MTU; + n->maxmtu = MTU; + + return n; } void free_node(node_t *n) { -cp - if(n->queue) - list_delete_list(n->queue); - if(n->name) - free(n->name); - if(n->hostname) - free(n->hostname); - if(n->key) - free(n->key); - if(n->subnet_tree) - free_subnet_tree(n->subnet_tree); - if(n->edge_tree) - free_edge_tree(n->edge_tree); - free(n); -cp + cp(); + + if(n->queue) + list_delete_list(n->queue); + + if(n->name) + free(n->name); + + if(n->hostname) + free(n->hostname); + + if(n->key) + free(n->key); + + if(n->subnet_tree) + free_subnet_tree(n->subnet_tree); + + if(n->edge_tree) + free_edge_tree(n->edge_tree); + + sockaddrfree(&n->address); + + EVP_CIPHER_CTX_cleanup(&n->packet_ctx); + + if(n->mtuevent) + event_del(n->mtuevent); + + free(n); } void node_add(node_t *n) { -cp - avl_insert(node_tree, n); - avl_insert(node_udp_tree, n); -cp + cp(); + + avl_insert(node_tree, n); + avl_insert(node_udp_tree, n); } void node_del(node_t *n) { - avl_node_t *node, *next; - edge_t *e; - subnet_t *s; -cp - for(node = n->subnet_tree->head; node; node = next) - { - next = node->next; - s = (subnet_t *)node->data; - subnet_del(n, s); - } + avl_node_t *node, *next; + edge_t *e; + subnet_t *s; - for(node = n->subnet_tree->head; node; node = next) - { - next = node->next; - e = (edge_t *)node->data; - edge_del(e); - } -cp - avl_delete(node_tree, n); - avl_delete(node_udp_tree, n); -cp + cp(); + + for(node = n->subnet_tree->head; node; node = next) { + next = node->next; + s = node->data; + subnet_del(n, s); + } + + for(node = n->edge_tree->head; node; node = next) { + next = node->next; + e = node->data; + edge_del(e); + } + + avl_delete(node_tree, n); + avl_delete(node_udp_tree, n); } node_t *lookup_node(char *name) { - node_t n; -cp - n.name = name; - return avl_search(node_tree, &n); + node_t n = {0}; + + cp(); + + n.name = name; + + return avl_search(node_tree, &n); } -node_t *lookup_node_udp(sockaddr_t *sa) +node_t *lookup_node_udp(const sockaddr_t *sa) { - node_t n; -cp - n.address = *sa; - n.name = NULL; + node_t n = {0}; - return avl_search(node_udp_tree, &n); + cp(); + + n.address = *sa; + n.name = NULL; + + return avl_search(node_udp_tree, &n); } void dump_nodes(void) { - avl_node_t *node; - node_t *n; -cp - syslog(LOG_DEBUG, _("Nodes:")); + avl_node_t *node; + node_t *n; - for(node = node_tree->head; node; node = node->next) - { - n = (node_t *)node->data; - syslog(LOG_DEBUG, _(" %s at %s cipher %d digest %d maclength %d compression %d options %lx status %04x nexthop %s via %s"), - n->name, n->hostname, n->cipher?n->cipher->nid:0, n->digest?n->digest->type:0, n->maclength, n->compression, n->options, - n->status, n->nexthop?n->nexthop->name:"-", n->via?n->via->name:"-"); - } - - syslog(LOG_DEBUG, _("End of nodes.")); -cp + cp(); + + logger(LOG_DEBUG, _("Nodes:")); + + for(node = node_tree->head; node; node = node->next) { + n = node->data; + logger(LOG_DEBUG, _(" %s at %s cipher %d digest %d maclength %d compression %d options %lx status %04x nexthop %s via %s pmtu %d (min %d max %d)"), + n->name, n->hostname, n->cipher ? n->cipher->nid : 0, + n->digest ? n->digest->type : 0, n->maclength, n->compression, + n->options, *(uint32_t *)&n->status, n->nexthop ? n->nexthop->name : "-", + n->via ? n->via->name : "-", n->mtu, n->minmtu, n->maxmtu); + } + + logger(LOG_DEBUG, _("End of nodes.")); } diff --git a/src/node.h b/src/node.h index 98147d3..6715d31 100644 --- a/src/node.h +++ b/src/node.h @@ -1,7 +1,7 @@ /* node.h -- header for node.c - Copyright (C) 2001-2002 Guus Sliepen , - 2001-2002 Ivo Timmermans + Copyright (C) 2001-2004 Guus Sliepen , + 2001-2004 Ivo Timmermans 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 @@ -17,58 +17,67 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: node.h,v 1.1.2.13 2002/03/19 22:48:25 guus Exp $ + $Id: node.h 1374 2004-03-21 14:21:22Z guus $ */ #ifndef __TINC_NODE_H__ #define __TINC_NODE_H__ -#include - -#include "subnet.h" +#include "avl_tree.h" #include "connection.h" +#include "event.h" +#include "list.h" +#include "subnet.h" typedef struct node_status_t { - int active:1; /* 1 if active.. */ - int validkey:1; /* 1 if we currently have a valid key for him */ - int waitingforkey:1; /* 1 if we already sent out a request */ - int visited:1; /* 1 if this node has been visited by one of the graph algorithms */ - int reachable:1; /* 1 if this node is reachable in the graph */ - int indirect:1; /* 1 if this node is not directly reachable by us */ - int unused:26; + int active:1; /* 1 if active.. */ + int validkey:1; /* 1 if we currently have a valid key for him */ + int waitingforkey:1; /* 1 if we already sent out a request */ + int visited:1; /* 1 if this node has been visited by one of the graph algorithms */ + int reachable:1; /* 1 if this node is reachable in the graph */ + int indirect:1; /* 1 if this node is not directly reachable by us */ + int unused:26; } node_status_t; typedef struct node_t { - char *name; /* name of this node */ - long int options; /* options turned on for this node */ + char *name; /* name of this node */ + long int options; /* options turned on for this node */ - sockaddr_t address; /* his real (internet) ip to send UDP packets to */ - char *hostname; /* the hostname of its real ip */ + sockaddr_t address; /* his real (internet) ip to send UDP packets to */ + char *hostname; /* the hostname of its real ip */ - struct node_status_t status; + node_status_t status; - const EVP_CIPHER *cipher; /* Cipher type for UDP packets */ - char *key; /* Cipher key and iv */ - int keylength; /* Cipher key and iv length*/ + const EVP_CIPHER *cipher; /* Cipher type for UDP packets */ + char *key; /* Cipher key and iv */ + int keylength; /* Cipher key and iv length */ + EVP_CIPHER_CTX packet_ctx; /* Cipher context */ + + const EVP_MD *digest; /* Digest type for MAC */ + int maclength; /* Length of MAC */ - const EVP_MD *digest; /* Digest type for MAC */ - int maclength; /* Length of MAC */ + int compression; /* Compressionlevel, 0 = no compression */ - int compression; /* Compressionlevel, 0 = no compression */ + list_t *queue; /* Queue for packets awaiting to be encrypted */ - list_t *queue; /* Queue for packets awaiting to be encrypted */ + struct node_t *nexthop; /* nearest node from us to him */ + struct node_t *via; /* next hop for UDP packets */ - struct node_t *nexthop; /* nearest node from us to him */ - struct node_t *via; /* next hop for UDP packets */ - - avl_tree_t *subnet_tree; /* Pointer to a tree of subnets belonging to this node */ + avl_tree_t *subnet_tree; /* Pointer to a tree of subnets belonging to this node */ - avl_tree_t *edge_tree; /* Edges with this node as one of the endpoints */ + avl_tree_t *edge_tree; /* Edges with this node as one of the endpoints */ - struct connection_t *connection; /* Connection associated with this node (if a direct connection exists) */ + struct connection_t *connection; /* Connection associated with this node (if a direct connection exists) */ - unsigned int sent_seqno; /* Sequence number last sent to this node */ - unsigned int received_seqno; /* Sequence number last received from this node */ + uint32_t sent_seqno; /* Sequence number last sent to this node */ + uint32_t received_seqno; /* Sequence number last received from this node */ + unsigned char late[16]; /* Bitfield marking late packets */ + + length_t mtu; /* Maximum size of packets to send to this node */ + length_t minmtu; /* Probed minimum MTU */ + length_t maxmtu; /* Probed maximum MTU */ + int mtuprobes; /* Number of probes */ + event_t *mtuevent; /* Probe event */ } node_t; extern struct node_t *myself; @@ -77,12 +86,12 @@ extern avl_tree_t *node_udp_tree; extern void init_nodes(void); extern void exit_nodes(void); -extern node_t *new_node(void); +extern node_t *new_node(void) __attribute__ ((__malloc__)); extern void free_node(node_t *); extern void node_add(node_t *); extern void node_del(node_t *); extern node_t *lookup_node(char *); -extern node_t *lookup_node_udp(sockaddr_t *); +extern node_t *lookup_node_udp(const sockaddr_t *); extern void dump_nodes(void); -#endif /* __TINC_NODE_H__ */ +#endif /* __TINC_NODE_H__ */ diff --git a/src/openbsd/device.c b/src/openbsd/device.c deleted file mode 100644 index 3d7099f..0000000 --- a/src/openbsd/device.c +++ /dev/null @@ -1,195 +0,0 @@ -/* - device.c -- Interaction with OpenBSD tun device - Copyright (C) 2001-2002 Ivo Timmermans , - 2001-2002 Guus Sliepen - - 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., 675 Mass Ave, Cambridge, MA 02139, USA. - - $Id: device.c,v 1.1.2.8 2002/03/27 16:00:38 guus Exp $ -*/ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include "conf.h" -#include "net.h" -#include "subnet.h" - -#include "system.h" - -#define DEFAULT_DEVICE "/dev/tun0" - -#define DEVICE_TYPE_ETHERTAP 0 -#define DEVICE_TYPE_TUNTAP 1 - -int device_fd = -1; -int device_type; -char *device; -char *interface; -char *device_info; - -int device_total_in = 0; -int device_total_out = 0; - -extern subnet_t mymac; - -/* - open the local ethertap device -*/ -int setup_device(void) -{ - if(!get_config_string(lookup_config(config_tree, "Device"), &device)) - device = DEFAULT_DEVICE; - - if(!get_config_string(lookup_config(config_tree, "Interface"), &interface)) - interface = rindex(device, '/')?rindex(device, '/')+1:device; -cp - if((device_fd = open(device, O_RDWR | O_NONBLOCK)) < 0) - { - syslog(LOG_ERR, _("Could not open %s: %s"), device, strerror(errno)); - return -1; - } -cp - /* Set default MAC address for ethertap devices */ - - mymac.type = SUBNET_MAC; - mymac.net.mac.address.x[0] = 0xfe; - mymac.net.mac.address.x[1] = 0xfd; - mymac.net.mac.address.x[2] = 0x00; - mymac.net.mac.address.x[3] = 0x00; - mymac.net.mac.address.x[4] = 0x00; - mymac.net.mac.address.x[5] = 0x00; - - device_info = _("OpenBSD tun device"); - - syslog(LOG_INFO, _("%s is a %s"), device, device_info); -cp - return 0; -} - -void close_device(void) -{ -cp - close(device_fd); -cp -} - -int read_packet(vpn_packet_t *packet) -{ - int lenin; - u_int32_t type; - struct iovec vector[2] = {{&type, sizeof(type)}, {packet->data + 14, MTU - 14}}; -cp - - if((lenin = readv(device_fd, vector, 2)) <= 0) - { - syslog(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, device, strerror(errno)); - return -1; - } - - memcpy(packet->data, mymac.net.mac.address.x, 6); - memcpy(packet->data + 6, mymac.net.mac.address.x, 6); - - switch(ntohl(type)) - { - case AF_INET: - packet->data[12] = 0x8; - packet->data[13] = 0x0; - break; - case AF_INET6: - packet->data[12] = 0x86; - packet->data[13] = 0xDD; - break; - default: - if(debug_lvl >= DEBUG_TRAFFIC) - syslog(LOG_ERR, _("Unknown address family %d while reading packet from %s %s"), ntohl(type), device_info, device); - return -1; - } - - packet->len = lenin + 10; - - device_total_in += packet->len; - - if(debug_lvl >= DEBUG_TRAFFIC) - { - syslog(LOG_DEBUG, _("Read packet of %d bytes from %s"), packet->len, device_info); - } - - return 0; -cp -} - -int write_packet(vpn_packet_t *packet) -{ - u_int32_t type; - struct iovec vector[2]; - int af; -cp - if(debug_lvl >= DEBUG_TRAFFIC) - syslog(LOG_DEBUG, _("Writing packet of %d bytes to %s"), - packet->len, device_info); - - af = (packet->data[12] << 8) + packet->data[13]; - - switch(af) - { - case 0x800: - type = htonl(AF_INET); - break; - case 0x86DD: - type = htonl(AF_INET6); - break; - default: - if(debug_lvl >= DEBUG_TRAFFIC) - syslog(LOG_ERR, _("Unknown address family %d while writing packet to %s %s"), af, device_info, device); - return -1; - } - - vector[0].iov_base = &type; - vector[0].iov_len = sizeof(type); - vector[1].iov_base = packet->data + 14; - vector[1].iov_len = packet->len - 14; - - if(writev(device_fd, vector, 2) < 0) - { - syslog(LOG_ERR, _("Can't write to %s %s: %s"), device_info, device, strerror(errno)); - return -1; - } - - device_total_out += packet->len; -cp -} - -void dump_device_stats(void) -{ -cp - syslog(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device); - syslog(LOG_DEBUG, _(" total bytes in: %10d"), device_total_in); - syslog(LOG_DEBUG, _(" total bytes out: %10d"), device_total_out); -cp -} diff --git a/src/process.c b/src/process.c index bdd81e3..cac1dd5 100644 --- a/src/process.c +++ b/src/process.c @@ -1,7 +1,7 @@ /* process.c -- process management functions - Copyright (C) 1999-2002 Ivo Timmermans , - 2000-2002 Guus Sliepen + Copyright (C) 1999-2004 Ivo Timmermans , + 2000-2004 Guus Sliepen 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 @@ -17,304 +17,420 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: process.c,v 1.1.2.39 2002/03/26 12:00:38 guus Exp $ + $Id: process.c 1397 2004-11-01 15:18:22Z guus $ */ -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "conf.h" -#include "process.h" -#include "subnet.h" -#include "device.h" -#include "connection.h" -#include "device.h" - #include "system.h" +#include "conf.h" +#include "connection.h" +#include "device.h" +#include "edge.h" +#include "logger.h" +#include "node.h" +#include "pidfile.h" +#include "process.h" +#include "subnet.h" +#include "utils.h" +#include "xalloc.h" + /* If zero, don't detach from the terminal. */ -int do_detach = 1; +bool do_detach = true; +bool sighup = false; +bool sigalrm = false; extern char *identname; extern char *pidfilename; extern char **g_argv; +extern bool use_logfile; +extern volatile bool running; sigset_t emptysigset; -static int saved_debug_lvl = 0; +static int saved_debug_level = -1; -extern int sighup; -extern int sigalrm; -extern int do_purge; - -void memory_full(int size) +static void memory_full(int size) { - syslog(LOG_ERR, _("Memory exhausted (couldn't allocate %d bytes), exitting."), size); - cp_trace(); - exit(1); + logger(LOG_ERR, _("Memory exhausted (couldn't allocate %d bytes), exitting."), size); + cp_trace(); + exit(1); } /* Some functions the less gifted operating systems might lack... */ -#ifndef HAVE_FCLOSEALL -int fcloseall(void) +#ifdef HAVE_MINGW +extern char *identname; +extern char *program_name; +extern char **g_argv; + +static SC_HANDLE manager = NULL; +static SC_HANDLE service = NULL; +static SERVICE_STATUS status = {0}; +static SERVICE_STATUS_HANDLE statushandle = 0; + +bool install_service(void) { + char command[4096] = "\""; + char **argp; + bool space; + SERVICE_DESCRIPTION description = {"Virtual Private Network daemon"}; + + manager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if(!manager) { + logger(LOG_ERR, _("Could not open service manager: %s"), winerror(GetLastError())); + return false; + } + + if(!strchr(program_name, '\\')) { + GetCurrentDirectory(sizeof(command) - 1, command + 1); + strncat(command, "\\", sizeof(command)); + } + + strncat(command, program_name, sizeof(command)); + + strncat(command, "\"", sizeof(command)); + + for(argp = g_argv + 1; *argp; argp++) { + space = strchr(*argp, ' '); + strncat(command, " ", sizeof(command)); + + if(space) + strncat(command, "\"", sizeof(command)); + + strncat(command, *argp, sizeof(command)); + + if(space) + strncat(command, "\"", sizeof(command)); + } + + service = CreateService(manager, identname, identname, + SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, + command, NULL, NULL, NULL, NULL, NULL); + + if(!service) { + logger(LOG_ERR, _("Could not create %s service: %s"), identname, winerror(GetLastError())); + return false; + } + + ChangeServiceConfig2(service, SERVICE_CONFIG_DESCRIPTION, &description); + + logger(LOG_INFO, _("%s service installed"), identname); + + if(!StartService(service, 0, NULL)) + logger(LOG_WARNING, _("Could not start %s service: %s"), identname, winerror(GetLastError())); + else + logger(LOG_INFO, _("%s service started"), identname); + + return true; +} + +bool remove_service(void) { + manager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if(!manager) { + logger(LOG_ERR, _("Could not open service manager: %s"), winerror(GetLastError())); + return false; + } + + service = OpenService(manager, identname, SERVICE_ALL_ACCESS); + + if(!service) { + logger(LOG_ERR, _("Could not open %s service: %s"), identname, winerror(GetLastError())); + return false; + } + + if(!ControlService(service, SERVICE_CONTROL_STOP, &status)) + logger(LOG_ERR, _("Could not stop %s service: %s"), identname, winerror(GetLastError())); + else + logger(LOG_INFO, _("%s service stopped"), identname); + + if(!DeleteService(service)) { + logger(LOG_ERR, _("Could not remove %s service: %s"), identname, winerror(GetLastError())); + return false; + } + + logger(LOG_INFO, _("%s service removed"), identname); + + return true; +} + +DWORD WINAPI controlhandler(DWORD request, DWORD type, LPVOID boe, LPVOID bah) { + switch(request) { + case SERVICE_CONTROL_STOP: + logger(LOG_NOTICE, _("Got %s request"), "SERVICE_CONTROL_STOP"); + break; + case SERVICE_CONTROL_SHUTDOWN: + logger(LOG_NOTICE, _("Got %s request"), "SERVICE_CONTROL_SHUTDOWN"); + break; + default: + logger(LOG_WARNING, _("Got unexpected request %d"), request); + return ERROR_CALL_NOT_IMPLEMENTED; + } + + if(running) { + running = false; + status.dwWaitHint = 30000; + status.dwCurrentState = SERVICE_STOP_PENDING; + SetServiceStatus(statushandle, &status); + return NO_ERROR; + } else { + status.dwWaitHint = 0; + status.dwCurrentState = SERVICE_STOPPED; + SetServiceStatus(statushandle, &status); + exit(1); + } + +} + +VOID WINAPI run_service(DWORD argc, LPTSTR* argv) { - fflush(stdin); - fflush(stdout); - fflush(stderr); - fclose(stdin); - fclose(stdout); - fclose(stderr); - return 0; + int err = 1; + extern int main2(int argc, char **argv); + + + status.dwServiceType = SERVICE_WIN32; + status.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; + status.dwWin32ExitCode = 0; + status.dwServiceSpecificExitCode = 0; + status.dwCheckPoint = 0; + + statushandle = RegisterServiceCtrlHandlerEx(identname, controlhandler, NULL); + + if (!statushandle) { + logger(LOG_ERR, _("System call `%s' failed: %s"), "RegisterServiceCtrlHandlerEx", winerror(GetLastError())); + err = 1; + } else { + status.dwWaitHint = 30000; + status.dwCurrentState = SERVICE_START_PENDING; + SetServiceStatus(statushandle, &status); + + status.dwWaitHint = 0; + status.dwCurrentState = SERVICE_RUNNING; + SetServiceStatus(statushandle, &status); + + err = main2(argc, argv); + + status.dwWaitHint = 0; + status.dwCurrentState = SERVICE_STOPPED; + //status.dwWin32ExitCode = err; + SetServiceStatus(statushandle, &status); + } + + return; +} + +bool init_service(void) { + SERVICE_TABLE_ENTRY services[] = { + {identname, run_service}, + {NULL, NULL} + }; + + if(!StartServiceCtrlDispatcher(services)) { + if(GetLastError() == ERROR_FAILED_SERVICE_CONTROLLER_CONNECT) { + return false; + } + else + logger(LOG_ERR, _("System call `%s' failed: %s"), "StartServiceCtrlDispatcher", winerror(GetLastError())); + } + + return true; +} +#endif + +#ifndef HAVE_MINGW +/* + check for an existing tinc for this net, and write pid to pidfile +*/ +static bool write_pidfile(void) +{ + pid_t pid; + + cp(); + + pid = check_pid(pidfilename); + + if(pid) { + if(netname) + fprintf(stderr, _("A tincd is already running for net `%s' with pid %ld.\n"), + netname, (long)pid); + else + fprintf(stderr, _("A tincd is already running with pid %ld.\n"), (long)pid); + return false; + } + + /* if it's locked, write-protected, or whatever */ + if(!write_pid(pidfilename)) { + fprintf(stderr, _("Could write pid file %s: %s\n"), pidfilename, strerror(errno)); + return false; + } + + return true; } #endif -/* - Close network connections, and terminate neatly -*/ -void cleanup_and_exit(int c) -{ -cp - close_network_connections(); - - if(debug_lvl > DEBUG_NOTHING) - dump_device_stats(); - - syslog(LOG_NOTICE, _("Terminating")); - - closelog(); - exit(c); -} - -/* - check for an existing tinc for this net, and write pid to pidfile -*/ -int write_pidfile(void) -{ - int pid; -cp - if((pid = check_pid(pidfilename))) - { - if(netname) - fprintf(stderr, _("A tincd is already running for net `%s' with pid %d.\n"), - netname, pid); - else - fprintf(stderr, _("A tincd is already running with pid %d.\n"), pid); - return 1; - } - - /* if it's locked, write-protected, or whatever */ - if(!write_pid(pidfilename)) - return 1; -cp - return 0; -} - /* kill older tincd for this net */ -int kill_other(int signal) +bool kill_other(int signal) { - int pid; -cp - if(!(pid = read_pid(pidfilename))) - { - if(netname) - fprintf(stderr, _("No other tincd is running for net `%s'.\n"), netname); - else - fprintf(stderr, _("No other tincd is running.\n")); - return 1; - } +#ifndef HAVE_MINGW + pid_t pid; - errno = 0; /* No error, sometimes errno is only changed on error */ - /* ESRCH is returned when no process with that pid is found */ - if(kill(pid, signal) && errno == ESRCH) - { - if(netname) - fprintf(stderr, _("The tincd for net `%s' is no longer running. "), netname); - else - fprintf(stderr, _("The tincd is no longer running. ")); + cp(); - fprintf(stderr, _("Removing stale lock file.\n")); - remove_pid(pidfilename); - } -cp - return 0; + pid = read_pid(pidfilename); + + if(!pid) { + if(netname) + fprintf(stderr, _("No other tincd is running for net `%s'.\n"), + netname); + else + fprintf(stderr, _("No other tincd is running.\n")); + return false; + } + + errno = 0; /* No error, sometimes errno is only changed on error */ + + /* ESRCH is returned when no process with that pid is found */ + if(kill(pid, signal) && errno == ESRCH) { + if(netname) + fprintf(stderr, _("The tincd for net `%s' is no longer running. "), + netname); + else + fprintf(stderr, _("The tincd is no longer running. ")); + + fprintf(stderr, _("Removing stale lock file.\n")); + remove_pid(pidfilename); + } + + return true; +#else + return remove_service(); +#endif } /* Detach from current terminal, write pidfile, kill parent */ -int detach(void) +bool detach(void) { -cp - setup_signals(); + cp(); - /* First check if we can open a fresh new pidfile */ - - if(write_pidfile()) - return -1; + setup_signals(); - /* If we succeeded in doing that, detach */ + /* First check if we can open a fresh new pidfile */ - closelog(); +#ifndef HAVE_MINGW + if(!write_pidfile()) + return false; - if(do_detach) - { - if(daemon(0, 0) < 0) - { - fprintf(stderr, _("Couldn't detach from terminal: %s"), strerror(errno)); - return -1; - } + /* If we succeeded in doing that, detach */ - /* Now UPDATE the pid in the pidfile, because we changed it... */ - - if(!write_pid(pidfilename)) - return -1; - } - - openlog(identname, LOG_CONS | LOG_PID, LOG_DAEMON); - - if(debug_lvl > DEBUG_NOTHING) - syslog(LOG_NOTICE, _("tincd %s (%s %s) starting, debug level %d"), - VERSION, __DATE__, __TIME__, debug_lvl); - else - syslog(LOG_NOTICE, _("tincd %s starting"), VERSION); - - xalloc_fail_func = memory_full; -cp - return 0; -} - -/* - Execute the program name, with sane environment. All output will be - redirected to syslog. -*/ -void _execute_script(const char *scriptname) __attribute__ ((noreturn)); -void _execute_script(const char *scriptname) -{ - char *s; -cp -#ifdef HAVE_UNSETENV - unsetenv("NETNAME"); - unsetenv("DEVICE"); - unsetenv("INTERFACE"); + closelogger(); #endif - if(netname) - { - asprintf(&s, "NETNAME=%s", netname); - putenv(s); /* Don't free s! see man 3 putenv */ - } + if(do_detach) { +#ifndef HAVE_MINGW + if(daemon(0, 0)) { + fprintf(stderr, _("Couldn't detach from terminal: %s"), + strerror(errno)); + return false; + } - if(device) - { - asprintf(&s, "DEVICE=%s", device); - putenv(s); /* Don't free s! see man 3 putenv */ - } + /* Now UPDATE the pid in the pidfile, because we changed it... */ - if(interface) - { - asprintf(&s, "INTERFACE=%s", interface); - putenv(s); /* Don't free s! see man 3 putenv */ - } + if(!write_pid(pidfilename)) { + fprintf(stderr, _("Could not write pid file %s: %s\n"), pidfilename, strerror(errno)); + return false; + } +#else + if(!statushandle) + exit(install_service()); +#endif + } - chdir("/"); - - /* Close all file descriptors */ - closelog(); /* <- this means we cannot use syslog() here anymore! */ - fcloseall(); + openlogger(identname, use_logfile?LOGMODE_FILE:(do_detach?LOGMODE_SYSLOG:LOGMODE_STDERR)); - execl(scriptname, NULL); - /* No return on success */ - - if(errno != ENOENT) /* Ignore if the file does not exist */ - exit(1); /* Some error while trying execl(). */ - else - exit(0); + logger(LOG_NOTICE, _("tincd %s (%s %s) starting, debug level %d"), + VERSION, __DATE__, __TIME__, debug_level); + + xalloc_fail_func = memory_full; + + return true; } -/* - Fork and execute the program pointed to by name. -*/ -int execute_script(const char *name) +bool execute_script(const char *name, char **envp) { - pid_t pid; - int status; - struct stat s; - char *scriptname; -cp - asprintf(&scriptname, "%s/%s", confbase, name); +#ifdef HAVE_SYSTEM + int status, len; + struct stat s; + char *scriptname, *p; + int i; - /* First check if there is a script */ + cp(); - if(stat(scriptname, &s)) - return 0; +#ifndef HAVE_MINGW + len = asprintf(&scriptname, "\"%s/%s\"", confbase, name); +#else + len = asprintf(&scriptname, "\"%s/%s.bat\"", confbase, name); +#endif + if(len < 0) + return false; - if((pid = fork()) < 0) - { - syslog(LOG_ERR, _("System call `%s' failed: %s"), "fork", strerror(errno)); - return -1; - } + scriptname[len - 1] = '\0'; - if(pid) - { - if(debug_lvl >= DEBUG_STATUS) - syslog(LOG_INFO, _("Executing script %s"), name); + /* First check if there is a script */ - free(scriptname); + if(stat(scriptname + 1, &s)) + return true; - if(waitpid(pid, &status, 0) == pid) - { - if(WIFEXITED(status)) /* Child exited by itself */ - { - if(WEXITSTATUS(status)) - { - syslog(LOG_ERR, _("Process %d (%s) exited with non-zero status %d"), pid, name, WEXITSTATUS(status)); - return -1; - } - else - return 0; - } - else if(WIFSIGNALED(status)) /* Child was killed by a signal */ - { - syslog(LOG_ERR, _("Process %d (%s) was killed by signal %d (%s)"), - pid, name, WTERMSIG(status), strsignal(WTERMSIG(status))); - return -1; - } - else /* Something strange happened */ - { - syslog(LOG_ERR, _("Process %d (%s) terminated abnormally"), pid, name); - return -1; - } - } - else - { - syslog(LOG_ERR, _("System call `%s' failed: %s"), "waitpid", strerror(errno)); - return -1; - } - } -cp - /* Child here */ + ifdebug(STATUS) logger(LOG_INFO, _("Executing script %s"), name); - _execute_script(scriptname); +#ifdef HAVE_PUTENV + /* Set environment */ + + for(i = 0; envp[i]; i++) + putenv(envp[i]); +#endif + + scriptname[len - 1] = '\"'; + status = system(scriptname); + + free(scriptname); + + /* Unset environment */ + + for(i = 0; envp[i]; i++) { + char *e = strchr(envp[i], '='); + if(e) { + p = alloca(e - envp[i] + 1); + strncpy(p, envp[i], e - envp[i]); + p[e - envp[i]] = '\0'; + putenv(p); + } + } + +#ifdef WEXITSTATUS + if(status != -1) { + if(WIFEXITED(status)) { /* Child exited by itself */ + if(WEXITSTATUS(status)) { + logger(LOG_ERR, _("Script %s exited with non-zero status %d"), + name, WEXITSTATUS(status)); + return false; + } + } else if(WIFSIGNALED(status)) { /* Child was killed by a signal */ + logger(LOG_ERR, _("Script %s was killed by signal %d (%s)"), + name, WTERMSIG(status), strsignal(WTERMSIG(status))); + return false; + } else { /* Something strange happened */ + logger(LOG_ERR, _("Script %s terminated abnormally"), name); + return false; + } + } else { + logger(LOG_ERR, _("System call `%s' failed: %s"), "system", strerror(errno)); + return false; + } +#endif +#endif + return true; } @@ -322,186 +438,170 @@ cp Signal handlers. */ -RETSIGTYPE -sigterm_handler(int a) +#ifndef HAVE_MINGW +static RETSIGTYPE sigterm_handler(int a) { - if(debug_lvl > DEBUG_NOTHING) - syslog(LOG_NOTICE, _("Got TERM signal")); - - cleanup_and_exit(0); + logger(LOG_NOTICE, _("Got %s signal"), "TERM"); + if(running) + running = false; + else + exit(1); } -RETSIGTYPE -sigquit_handler(int a) +static RETSIGTYPE sigquit_handler(int a) { - if(debug_lvl > DEBUG_NOTHING) - syslog(LOG_NOTICE, _("Got QUIT signal")); - cleanup_and_exit(0); + logger(LOG_NOTICE, _("Got %s signal"), "QUIT"); + if(running) + running = false; + else + exit(1); } -RETSIGTYPE -fatal_signal_square(int a) +static RETSIGTYPE fatal_signal_square(int a) { - syslog(LOG_ERR, _("Got another fatal signal %d (%s): not restarting."), a, strsignal(a)); - cp_trace(); - exit(1); + logger(LOG_ERR, _("Got another fatal signal %d (%s): not restarting."), a, + strsignal(a)); + cp_trace(); + exit(1); } -RETSIGTYPE -fatal_signal_handler(int a) +static RETSIGTYPE fatal_signal_handler(int a) { - struct sigaction act; - syslog(LOG_ERR, _("Got fatal signal %d (%s)"), a, strsignal(a)); - cp_trace(); + struct sigaction act; + logger(LOG_ERR, _("Got fatal signal %d (%s)"), a, strsignal(a)); + cp_trace(); - if(do_detach) - { - syslog(LOG_NOTICE, _("Trying to re-execute in 5 seconds...")); + if(do_detach) { + logger(LOG_NOTICE, _("Trying to re-execute in 5 seconds...")); - act.sa_handler = fatal_signal_square; - act.sa_mask = emptysigset; - act.sa_flags = 0; - sigaction(SIGSEGV, &act, NULL); + act.sa_handler = fatal_signal_square; + act.sa_mask = emptysigset; + act.sa_flags = 0; + sigaction(SIGSEGV, &act, NULL); - close_network_connections(); - sleep(5); - remove_pid(pidfilename); - execvp(g_argv[0], g_argv); - } - else - { - syslog(LOG_NOTICE, _("Not restarting.")); - exit(1); - } + close_network_connections(); + sleep(5); + remove_pid(pidfilename); + execvp(g_argv[0], g_argv); + } else { + logger(LOG_NOTICE, _("Not restarting.")); + exit(1); + } } -RETSIGTYPE -sighup_handler(int a) +static RETSIGTYPE sighup_handler(int a) { - if(debug_lvl > DEBUG_NOTHING) - syslog(LOG_NOTICE, _("Got HUP signal")); - sighup = 1; + logger(LOG_NOTICE, _("Got %s signal"), "HUP"); + sighup = true; } -RETSIGTYPE -sigint_handler(int a) +static RETSIGTYPE sigint_handler(int a) { - if(saved_debug_lvl) - { - syslog(LOG_NOTICE, _("Reverting to old debug level (%d)"), - saved_debug_lvl); - debug_lvl = saved_debug_lvl; - saved_debug_lvl = 0; - } - else - { - syslog(LOG_NOTICE, _("Temporarily setting debug level to 5. Kill me with SIGINT again to go back to level %d."), - debug_lvl); - saved_debug_lvl = debug_lvl; - debug_lvl = 5; - } + logger(LOG_NOTICE, _("Got %s signal"), "INT"); + + if(saved_debug_level != -1) { + logger(LOG_NOTICE, _("Reverting to old debug level (%d)"), + saved_debug_level); + debug_level = saved_debug_level; + saved_debug_level = -1; + } else { + logger(LOG_NOTICE, + _("Temporarily setting debug level to 5. Kill me with SIGINT again to go back to level %d."), + debug_level); + saved_debug_level = debug_level; + debug_level = 5; + } } -RETSIGTYPE -sigalrm_handler(int a) +static RETSIGTYPE sigalrm_handler(int a) { - if(debug_lvl > DEBUG_NOTHING) - syslog(LOG_NOTICE, _("Got ALRM signal")); - sigalrm = 1; + logger(LOG_NOTICE, _("Got %s signal"), "ALRM"); + sigalrm = true; } -RETSIGTYPE -sigusr1_handler(int a) +static RETSIGTYPE sigusr1_handler(int a) { - dump_connections(); + dump_connections(); } -RETSIGTYPE -sigusr2_handler(int a) +static RETSIGTYPE sigusr2_handler(int a) { - dump_device_stats(); - dump_nodes(); - dump_edges(); - dump_subnets(); + dump_device_stats(); + dump_nodes(); + dump_edges(); + dump_subnets(); } -RETSIGTYPE -sigwinch_handler(int a) +static RETSIGTYPE sigwinch_handler(int a) { - extern int do_purge; - do_purge = 1; + do_purge = true; } -RETSIGTYPE -unexpected_signal_handler(int a) +static RETSIGTYPE unexpected_signal_handler(int a) { - syslog(LOG_WARNING, _("Got unexpected signal %d (%s)"), a, strsignal(a)); - cp_trace(); + logger(LOG_WARNING, _("Got unexpected signal %d (%s)"), a, strsignal(a)); + cp_trace(); } -RETSIGTYPE -ignore_signal_handler(int a) +static RETSIGTYPE ignore_signal_handler(int a) { - if(debug_lvl >= DEBUG_SCARY_THINGS) - { - syslog(LOG_DEBUG, _("Ignored signal %d (%s)"), a, strsignal(a)); - cp_trace(); - } + ifdebug(SCARY_THINGS) logger(LOG_DEBUG, _("Ignored signal %d (%s)"), a, strsignal(a)); } -struct { - int signal; - void (*handler)(int); +static struct { + int signal; + void (*handler)(int); } sighandlers[] = { - { SIGHUP, sighup_handler }, - { SIGTERM, sigterm_handler }, - { SIGQUIT, sigquit_handler }, - { SIGSEGV, fatal_signal_handler }, - { SIGBUS, fatal_signal_handler }, - { SIGILL, fatal_signal_handler }, - { SIGPIPE, ignore_signal_handler }, - { SIGINT, sigint_handler }, - { SIGUSR1, sigusr1_handler }, - { SIGUSR2, sigusr2_handler }, - { SIGCHLD, ignore_signal_handler }, - { SIGALRM, sigalrm_handler }, - { SIGWINCH, sigwinch_handler }, - { 0, NULL } + {SIGHUP, sighup_handler}, + {SIGTERM, sigterm_handler}, + {SIGQUIT, sigquit_handler}, + {SIGSEGV, fatal_signal_handler}, + {SIGBUS, fatal_signal_handler}, + {SIGILL, fatal_signal_handler}, + {SIGPIPE, ignore_signal_handler}, + {SIGINT, sigint_handler}, + {SIGUSR1, sigusr1_handler}, + {SIGUSR2, sigusr2_handler}, + {SIGCHLD, ignore_signal_handler}, + {SIGALRM, sigalrm_handler}, + {SIGWINCH, sigwinch_handler}, + {0, NULL} }; +#endif -void -setup_signals(void) +void setup_signals(void) { - int i; - struct sigaction act; +#ifndef HAVE_MINGW + int i; + struct sigaction act; - sigemptyset(&emptysigset); - act.sa_handler = NULL; - act.sa_mask = emptysigset; - act.sa_flags = 0; + sigemptyset(&emptysigset); + act.sa_handler = NULL; + act.sa_mask = emptysigset; + act.sa_flags = 0; - /* Set a default signal handler for every signal, errors will be - ignored. */ - for(i = 0; i < NSIG; i++) - { - if(!do_detach) - act.sa_handler = SIG_DFL; - else - act.sa_handler = unexpected_signal_handler; - sigaction(i, &act, NULL); - } + /* Set a default signal handler for every signal, errors will be + ignored. */ + for(i = 0; i < NSIG; i++) { + if(!do_detach) + act.sa_handler = SIG_DFL; + else + act.sa_handler = unexpected_signal_handler; + sigaction(i, &act, NULL); + } - /* If we didn't detach, allow coredumps */ - if(!do_detach) - sighandlers[3].handler = SIG_DFL; + /* If we didn't detach, allow coredumps */ + if(!do_detach) + sighandlers[3].handler = SIG_DFL; - /* Then, for each known signal that we want to catch, assign a - handler to the signal, with error checking this time. */ - for(i = 0; sighandlers[i].signal; i++) - { - act.sa_handler = sighandlers[i].handler; - if(sigaction(sighandlers[i].signal, &act, NULL) < 0) - fprintf(stderr, _("Installing signal handler for signal %d (%s) failed: %s\n"), - sighandlers[i].signal, strsignal(sighandlers[i].signal), strerror(errno)); - } + /* Then, for each known signal that we want to catch, assign a + handler to the signal, with error checking this time. */ + for(i = 0; sighandlers[i].signal; i++) { + act.sa_handler = sighandlers[i].handler; + if(sigaction(sighandlers[i].signal, &act, NULL) < 0) + fprintf(stderr, _("Installing signal handler for signal %d (%s) failed: %s\n"), + sighandlers[i].signal, strsignal(sighandlers[i].signal), + strerror(errno)); + } +#endif } diff --git a/src/process.h b/src/process.h index 1289d2d..83f73fd 100644 --- a/src/process.h +++ b/src/process.h @@ -1,7 +1,7 @@ /* process.h -- header file for process.c - Copyright (C) 1999-2002 Ivo Timmermans , - 2000-2002 Guus Sliepen + Copyright (C) 1999-2004 Ivo Timmermans , + 2000-2004 Guus Sliepen 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 @@ -17,20 +17,19 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: process.h,v 1.1.2.10 2002/02/10 21:57:54 guus Exp $ + $Id: process.h 1374 2004-03-21 14:21:22Z guus $ */ #ifndef __TINC_PROCESS_H__ #define __TINC_PROCESS_H__ -#include "config.h" - -extern int do_detach; +extern bool do_detach; +extern bool sighup; +extern bool sigalrm; extern void setup_signals(void); -extern int execute_script(const char *); -extern int detach(void); -extern int kill_other(int); -extern void cleanup_and_exit(int); +extern bool execute_script(const char *, char **); +extern bool detach(void); +extern bool kill_other(int); -#endif /* __TINC_PROCESS_H__ */ +#endif /* __TINC_PROCESS_H__ */ diff --git a/src/protocol.c b/src/protocol.c index 9b2ec91..8ccdd10 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -1,7 +1,7 @@ /* protocol.c -- handle the meta-protocol, basic functions - Copyright (C) 1999-2001 Ivo Timmermans , - 2000,2001 Guus Sliepen + Copyright (C) 1999-2004 Ivo Timmermans , + 2000-2004 Guus Sliepen 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 @@ -17,228 +17,237 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: protocol.c,v 1.28.4.128 2002/03/27 15:26:43 guus Exp $ + $Id: protocol.c 1374 2004-03-21 14:21:22Z guus $ */ -#include "config.h" - -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "conf.h" -#include "protocol.h" -#include "meta.h" -#include "connection.h" - #include "system.h" -avl_tree_t *past_request_tree; +#include "conf.h" +#include "connection.h" +#include "logger.h" +#include "meta.h" +#include "protocol.h" +#include "utils.h" +#include "xalloc.h" -int check_id(char *id) +bool tunnelserver = false; + +/* Jumptable for the request handlers */ + +static bool (*request_handlers[])(connection_t *) = { + id_h, metakey_h, challenge_h, chal_reply_h, ack_h, + status_h, error_h, termreq_h, + ping_h, pong_h, + add_subnet_h, del_subnet_h, + add_edge_h, del_edge_h, + key_changed_h, req_key_h, ans_key_h, tcppacket_h, +}; + +/* Request names */ + +static char (*request_name[]) = { + "ID", "METAKEY", "CHALLENGE", "CHAL_REPLY", "ACK", + "STATUS", "ERROR", "TERMREQ", + "PING", "PONG", + "ADD_SUBNET", "DEL_SUBNET", + "ADD_EDGE", "DEL_EDGE", "KEY_CHANGED", "REQ_KEY", "ANS_KEY", "PACKET", +}; + +static avl_tree_t *past_request_tree; + +bool check_id(const char *id) { - int i; + for(; *id; id++) + if(!isalnum(*id) && *id != '_') + return false; - for (i = 0; i < strlen(id); i++) - if(!isalnum(id[i]) && id[i] != '_') - return -1; - - return 0; + return true; } /* Generic request routines - takes care of logging and error detection as well */ -int send_request(connection_t *c, const char *format, ...) +bool send_request(connection_t *c, const char *format, ...) { - va_list args; - char buffer[MAXBUFSIZE]; - int len, request; + va_list args; + char buffer[MAXBUFSIZE]; + int len, request; -cp - /* Use vsnprintf instead of vasprintf: faster, no memory - fragmentation, cleanup is automatic, and there is a limit on the - input buffer anyway */ + cp(); - va_start(args, format); - len = vsnprintf(buffer, MAXBUFSIZE, format, args); - va_end(args); + /* Use vsnprintf instead of vasprintf: faster, no memory + fragmentation, cleanup is automatic, and there is a limit on the + input buffer anyway */ - if(len < 0 || len > MAXBUFSIZE-1) - { - syslog(LOG_ERR, _("Output buffer overflow while sending request to %s (%s)"), c->name, c->hostname); - return -1; - } + va_start(args, format); + len = vsnprintf(buffer, MAXBUFSIZE, format, args); + va_end(args); - if(debug_lvl >= DEBUG_PROTOCOL) - { - sscanf(buffer, "%d", &request); - if(debug_lvl >= DEBUG_META) - syslog(LOG_DEBUG, _("Sending %s to %s (%s): %s"), request_name[request], c->name, c->hostname, buffer); - else - syslog(LOG_DEBUG, _("Sending %s to %s (%s)"), request_name[request], c->name, c->hostname); - } - - buffer[len++] = '\n'; -cp - return send_meta(c, buffer, len); -} - -int receive_request(connection_t *c) -{ - int request; -cp - if(sscanf(c->buffer, "%d", &request) == 1) - { - if((request < 0) || (request >= LAST) || (request_handlers[request] == NULL)) - { - if(debug_lvl >= DEBUG_META) - syslog(LOG_DEBUG, _("Unknown request from %s (%s): %s"), - c->name, c->hostname, c->buffer); - else - syslog(LOG_ERR, _("Unknown request from %s (%s)"), - c->name, c->hostname); - - return -1; - } - else - { - if(debug_lvl >= DEBUG_PROTOCOL) - { - if(debug_lvl >= DEBUG_META) - syslog(LOG_DEBUG, _("Got %s from %s (%s): %s"), - request_name[request], c->name, c->hostname, c->buffer); - else - syslog(LOG_DEBUG, _("Got %s from %s (%s)"), - request_name[request], c->name, c->hostname); - } + if(len < 0 || len > MAXBUFSIZE - 1) { + logger(LOG_ERR, _("Output buffer overflow while sending request to %s (%s)"), + c->name, c->hostname); + return false; } - if((c->allow_request != ALL) && (c->allow_request != request)) - { - syslog(LOG_ERR, _("Unauthorized request from %s (%s)"), c->name, c->hostname); - return -1; - } + ifdebug(PROTOCOL) { + sscanf(buffer, "%d", &request); + ifdebug(META) + logger(LOG_DEBUG, _("Sending %s to %s (%s): %s"), + request_name[request], c->name, c->hostname, buffer); + else + logger(LOG_DEBUG, _("Sending %s to %s (%s)"), request_name[request], + c->name, c->hostname); + } - if(request_handlers[request](c)) - /* Something went wrong. Probably scriptkiddies. Terminate. */ - { - syslog(LOG_ERR, _("Error while processing %s from %s (%s)"), - request_name[request], c->name, c->hostname); - return -1; - } - } - else - { - syslog(LOG_ERR, _("Bogus data received from %s (%s)"), - c->name, c->hostname); - return -1; - } -cp - return 0; + buffer[len++] = '\n'; + + if(c == broadcast) { + broadcast_meta(NULL, buffer, len); + return true; + } else + return send_meta(c, buffer, len); } -int past_request_compare(past_request_t *a, past_request_t *b) +void forward_request(connection_t *from) { -cp - return strcmp(a->request, b->request); + int request; + + cp(); + + ifdebug(PROTOCOL) { + sscanf(from->buffer, "%d", &request); + ifdebug(META) + logger(LOG_DEBUG, _("Forwarding %s from %s (%s): %s"), + request_name[request], from->name, from->hostname, + from->buffer); + else + logger(LOG_DEBUG, _("Forwarding %s from %s (%s)"), + request_name[request], from->name, from->hostname); + } + + from->buffer[from->reqlen - 1] = '\n'; + + broadcast_meta(from, from->buffer, from->reqlen); } -void free_past_request(past_request_t *r) +bool receive_request(connection_t *c) { -cp - if(r->request) - free(r->request); - free(r); -cp + int request; + + cp(); + + if(sscanf(c->buffer, "%d", &request) == 1) { + if((request < 0) || (request >= LAST) || !request_handlers[request]) { + ifdebug(META) + logger(LOG_DEBUG, _("Unknown request from %s (%s): %s"), + c->name, c->hostname, c->buffer); + else + logger(LOG_ERR, _("Unknown request from %s (%s)"), + c->name, c->hostname); + + return false; + } else { + ifdebug(PROTOCOL) { + ifdebug(META) + logger(LOG_DEBUG, _("Got %s from %s (%s): %s"), + request_name[request], c->name, c->hostname, + c->buffer); + else + logger(LOG_DEBUG, _("Got %s from %s (%s)"), + request_name[request], c->name, c->hostname); + } + } + + if((c->allow_request != ALL) && (c->allow_request != request)) { + logger(LOG_ERR, _("Unauthorized request from %s (%s)"), c->name, + c->hostname); + return false; + } + + if(!request_handlers[request](c)) { + /* Something went wrong. Probably scriptkiddies. Terminate. */ + + logger(LOG_ERR, _("Error while processing %s from %s (%s)"), + request_name[request], c->name, c->hostname); + return false; + } + } else { + logger(LOG_ERR, _("Bogus data received from %s (%s)"), + c->name, c->hostname); + return false; + } + + return true; +} + +static int past_request_compare(const past_request_t *a, const past_request_t *b) +{ + return strcmp(a->request, b->request); +} + +static void free_past_request(past_request_t *r) +{ + cp(); + + if(r->request) + free(r->request); + + free(r); } void init_requests(void) { -cp - past_request_tree = avl_alloc_tree((avl_compare_t)past_request_compare, (avl_action_t)free_past_request); -cp + cp(); + + past_request_tree = avl_alloc_tree((avl_compare_t) past_request_compare, (avl_action_t) free_past_request); } void exit_requests(void) { -cp - avl_delete_tree(past_request_tree); -cp + cp(); + + avl_delete_tree(past_request_tree); } -int seen_request(char *request) +bool seen_request(char *request) { - past_request_t p, *new; -cp - p.request = request; + past_request_t *new, p = {0}; - if(avl_search(past_request_tree, &p)) - { - if(debug_lvl >= DEBUG_SCARY_THINGS) - syslog(LOG_DEBUG, _("Already seen request")); - return 1; - } - else - { - new = (past_request_t *)xmalloc(sizeof(*new)); - new->request = xstrdup(request); - new->firstseen = now; - avl_insert(past_request_tree, new); - return 0; - } -cp + cp(); + + p.request = request; + + if(avl_search(past_request_tree, &p)) { + ifdebug(SCARY_THINGS) logger(LOG_DEBUG, _("Already seen request")); + return true; + } else { + new = xmalloc(sizeof(*new)); + new->request = xstrdup(request); + new->firstseen = now; + avl_insert(past_request_tree, new); + return false; + } } void age_past_requests(void) { - avl_node_t *node, *next; - past_request_t *p; - int left = 0, deleted = 0; -cp - for(node = past_request_tree->head; node; node = next) - { - next = node->next; - p = (past_request_t *)node->data; - if(p->firstseen + pingtimeout < now) - avl_delete_node(past_request_tree, node), deleted++; - else - left++; - } + avl_node_t *node, *next; + past_request_t *p; + int left = 0, deleted = 0; - if(debug_lvl >= DEBUG_SCARY_THINGS && left + deleted) - syslog(LOG_DEBUG, _("Aging past requests: deleted %d, left %d\n"), deleted, left); -cp + cp(); + + for(node = past_request_tree->head; node; node = next) { + next = node->next; + p = node->data; + + if(p->firstseen + pingtimeout < now) + avl_delete_node(past_request_tree, node), deleted++; + else + left++; + } + + if(left || deleted) + ifdebug(SCARY_THINGS) logger(LOG_DEBUG, _("Aging past requests: deleted %d, left %d"), + deleted, left); } - -/* Jumptable for the request handlers */ - -int (*request_handlers[])(connection_t*) = { - id_h, metakey_h, challenge_h, chal_reply_h, ack_h, - status_h, error_h, termreq_h, - ping_h, pong_h, - add_subnet_h, del_subnet_h, - add_edge_h, del_edge_h, - key_changed_h, req_key_h, ans_key_h, - tcppacket_h, -}; - -/* Request names */ - -char (*request_name[]) = { - "ID", "METAKEY", "CHALLENGE", "CHAL_REPLY", "ACK", - "STATUS", "ERROR", "TERMREQ", - "PING", "PONG", - "ADD_SUBNET", "DEL_SUBNET", - "ADD_EDGE", "DEL_EDGE", - "KEY_CHANGED", "REQ_KEY", "ANS_KEY", - "PACKET", -}; diff --git a/src/protocol.h b/src/protocol.h index a4e480a..fcc4a5a 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -1,7 +1,7 @@ /* protocol.h -- header for protocol.c - Copyright (C) 1999-2001 Ivo Timmermans , - 2000,2001 Guus Sliepen + Copyright (C) 1999-2004 Ivo Timmermans , + 2000-2004 Guus Sliepen 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 @@ -17,104 +17,107 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: protocol.h,v 1.5.4.29 2002/03/22 11:43:48 guus Exp $ + $Id: protocol.h 1374 2004-03-21 14:21:22Z guus $ */ #ifndef __TINC_PROTOCOL_H__ #define __TINC_PROTOCOL_H__ -#include "net.h" -#include "node.h" -#include "subnet.h" - /* Protocol version. Different versions are incompatible, incompatible version have different protocols. */ -#define PROT_CURRENT 14 +#define PROT_CURRENT 17 + +/* Silly Windows */ + +#ifdef ERROR +#undef ERROR +#endif /* Request numbers */ -enum { - ALL = -1, /* Guardian for allow_request */ - ID = 0, METAKEY, CHALLENGE, CHAL_REPLY, ACK, - STATUS, ERROR, TERMREQ, - PING, PONG, -// ADD_NODE, DEL_NODE, - ADD_SUBNET, DEL_SUBNET, - ADD_EDGE, DEL_EDGE, - KEY_CHANGED, REQ_KEY, ANS_KEY, - PACKET, - LAST /* Guardian for the highest request number */ -}; +typedef enum request_t { + ALL = -1, /* Guardian for allow_request */ + ID = 0, METAKEY, CHALLENGE, CHAL_REPLY, ACK, + STATUS, ERROR, TERMREQ, + PING, PONG, + ADD_SUBNET, DEL_SUBNET, + ADD_EDGE, DEL_EDGE, + KEY_CHANGED, REQ_KEY, ANS_KEY, + PACKET, + LAST /* Guardian for the highest request number */ +} request_t; typedef struct past_request_t { - char *request; - time_t firstseen; + char *request; + time_t firstseen; } past_request_t; +extern bool tunnelserver; + /* Maximum size of strings in a request */ #define MAX_STRING_SIZE 2048 #define MAX_STRING "%2048s" +#include "edge.h" +#include "net.h" +#include "node.h" +#include "subnet.h" + /* Basic functions */ -extern int send_request(connection_t*, const char*, ...); -extern int receive_request(connection_t *); -extern int check_id(char *); +extern bool send_request(struct connection_t *, const char *, ...) __attribute__ ((__format__(printf, 2, 3))); +extern void forward_request(struct connection_t *); +extern bool receive_request(struct connection_t *); +extern bool check_id(const char *); extern void init_requests(void); extern void exit_requests(void); -extern int seen_request(char *); +extern bool seen_request(char *); extern void age_past_requests(void); /* Requests */ -extern int send_id(connection_t *); -extern int send_metakey(connection_t *); -extern int send_challenge(connection_t *); -extern int send_chal_reply(connection_t *); -extern int send_ack(connection_t *); -extern int send_status(connection_t *, int, char *); -extern int send_error(connection_t *, int, char *); -extern int send_termreq(connection_t *); -extern int send_ping(connection_t *); -extern int send_pong(connection_t *); -// extern int send_add_node(connection_t *, node_t *); -// extern int send_del_node(connection_t *, node_t *); -extern int send_add_subnet(connection_t *, subnet_t *); -extern int send_del_subnet(connection_t *, subnet_t *); -extern int send_add_edge(connection_t *, edge_t *); -extern int send_del_edge(connection_t *, edge_t *); -extern int send_key_changed(connection_t *, node_t *); -extern int send_req_key(connection_t *, node_t *, node_t *); -extern int send_ans_key(connection_t *, node_t *, node_t *); -extern int send_tcppacket(connection_t *, vpn_packet_t *); +extern bool send_id(struct connection_t *); +extern bool send_metakey(struct connection_t *); +extern bool send_challenge(struct connection_t *); +extern bool send_chal_reply(struct connection_t *); +extern bool send_ack(struct connection_t *); +extern bool send_status(struct connection_t *, int, const char *); +extern bool send_error(struct connection_t *, int,const char *); +extern bool send_termreq(struct connection_t *); +extern bool send_ping(struct connection_t *); +extern bool send_pong(struct connection_t *); +extern bool send_add_subnet(struct connection_t *, const struct subnet_t *); +extern bool send_del_subnet(struct connection_t *, const struct subnet_t *); +extern bool send_add_edge(struct connection_t *, const struct edge_t *); +extern bool send_del_edge(struct connection_t *, const struct edge_t *); +extern bool send_key_changed(struct connection_t *, const struct node_t *); +extern bool send_req_key(struct connection_t *, const struct node_t *, const struct node_t *); +extern bool send_ans_key(struct connection_t *, const struct node_t *, const struct node_t *); +extern bool send_tcppacket(struct connection_t *, struct vpn_packet_t *); /* Request handlers */ -extern int (*request_handlers[])(connection_t *); +extern bool id_h(struct connection_t *); +extern bool metakey_h(struct connection_t *); +extern bool challenge_h(struct connection_t *); +extern bool chal_reply_h(struct connection_t *); +extern bool ack_h(struct connection_t *); +extern bool status_h(struct connection_t *); +extern bool error_h(struct connection_t *); +extern bool termreq_h(struct connection_t *); +extern bool ping_h(struct connection_t *); +extern bool pong_h(struct connection_t *); +extern bool add_subnet_h(struct connection_t *); +extern bool del_subnet_h(struct connection_t *); +extern bool add_edge_h(struct connection_t *); +extern bool del_edge_h(struct connection_t *); +extern bool key_changed_h(struct connection_t *); +extern bool req_key_h(struct connection_t *); +extern bool ans_key_h(struct connection_t *); +extern bool tcppacket_h(struct connection_t *); -extern int id_h(connection_t *); -extern int metakey_h(connection_t *); -extern int challenge_h(connection_t *); -extern int chal_reply_h(connection_t *); -extern int ack_h(connection_t *); -extern int status_h(connection_t *); -extern int error_h(connection_t *); -extern int termreq_h(connection_t *); -extern int ping_h(connection_t *); -extern int pong_h(connection_t *); -// extern int add_node_h(connection_t *); -// extern int del_node_h(connection_t *); -extern int add_subnet_h(connection_t *); -extern int del_subnet_h(connection_t *); -extern int add_edge_h(connection_t *); -extern int del_edge_h(connection_t *); -extern int key_changed_h(connection_t *); -extern int req_key_h(connection_t *); -extern int ans_key_h(connection_t *); -extern int tcppacket_h(connection_t *); - -#endif /* __TINC_PROTOCOL_H__ */ +#endif /* __TINC_PROTOCOL_H__ */ diff --git a/src/protocol_auth.c b/src/protocol_auth.c index 074b7d1..a8398ad 100644 --- a/src/protocol_auth.c +++ b/src/protocol_auth.c @@ -1,7 +1,7 @@ /* protocol_auth.c -- handle the meta-protocol, authentication - Copyright (C) 1999-2002 Ivo Timmermans , - 2000-2002 Guus Sliepen + Copyright (C) 1999-2004 Ivo Timmermans , + 2000-2004 Guus Sliepen 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 @@ -17,589 +17,589 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: protocol_auth.c,v 1.1.4.8 2002/03/27 15:26:44 guus Exp $ + $Id: protocol_auth.c 1374 2004-03-21 14:21:22Z guus $ */ -#include "config.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#ifndef HAVE_RAND_PSEUDO_BYTES -#define RAND_pseudo_bytes RAND_bytes -#endif - -#include "conf.h" -#include "net.h" -#include "netutl.h" -#include "protocol.h" -#include "meta.h" -#include "connection.h" -#include "node.h" -#include "edge.h" -#include "graph.h" - #include "system.h" -int send_id(connection_t *c) +#include +#include +#include +#include + +#include "avl_tree.h" +#include "conf.h" +#include "connection.h" +#include "edge.h" +#include "graph.h" +#include "logger.h" +#include "net.h" +#include "netutl.h" +#include "node.h" +#include "protocol.h" +#include "utils.h" +#include "xalloc.h" + +bool send_id(connection_t *c) { -cp - return send_request(c, "%d %s %d", ID, myself->connection->name, myself->connection->protocol_version); + cp(); + + return send_request(c, "%d %s %d", ID, myself->connection->name, + myself->connection->protocol_version); } -int id_h(connection_t *c) +bool id_h(connection_t *c) { - char name[MAX_STRING_SIZE]; - int bla; -cp - if(sscanf(c->buffer, "%*d "MAX_STRING" %d", name, &c->protocol_version) != 2) - { - syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "ID", c->name, c->hostname); - return -1; - } + char name[MAX_STRING_SIZE]; - /* Check if identity is a valid name */ + cp(); - if(check_id(name)) - { - syslog(LOG_ERR, _("Got bad %s from %s (%s): %s"), "ID", c->name, c->hostname, "invalid name"); - return -1; - } - - /* If we set c->name in advance, make sure we are connected to the right host */ - - if(c->name) - { - if(strcmp(c->name, name)) - { - syslog(LOG_ERR, _("Peer %s is %s instead of %s"), c->hostname, name, c->name); - return -1; - } - } - else - c->name = xstrdup(name); - - /* Check if version matches */ - - if(c->protocol_version != myself->connection->protocol_version) - { - syslog(LOG_ERR, _("Peer %s (%s) uses incompatible version %d"), - c->name, c->hostname, c->protocol_version); - return -1; - } - - if(bypass_security) - { - if(!c->config_tree) - init_configuration(&c->config_tree); - c->allow_request = ACK; - return send_ack(c); - } - - if(!c->config_tree) - { - init_configuration(&c->config_tree); - - if((bla = read_connection_config(c))) - { - syslog(LOG_ERR, _("Peer %s had unknown identity (%s)"), c->hostname, c->name); - return -1; - } - } - - if(read_rsa_public_key(c)) - { - return -1; - } - - /* Check some options */ - - if((get_config_bool(lookup_config(c->config_tree, "IndirectData"), &bla) && bla) || myself->options & OPTION_INDIRECT) - c->options |= OPTION_INDIRECT; - - if((get_config_bool(lookup_config(c->config_tree, "TCPOnly"), &bla) && bla) || myself->options & OPTION_TCPONLY) - c->options |= OPTION_TCPONLY | OPTION_INDIRECT; - - c->allow_request = METAKEY; -cp - return send_metakey(c); -} - -int send_metakey(connection_t *c) -{ - char buffer[MAX_STRING_SIZE]; - int len, x; -cp - len = RSA_size(c->rsa_key); - - /* Allocate buffers for the meta key */ - - if(!c->outkey) - c->outkey = xmalloc(len); - - if(!c->outctx) - c->outctx = xmalloc(sizeof(*c->outctx)); -cp - /* Copy random data to the buffer */ - - RAND_bytes(c->outkey, len); - - /* The message we send must be smaller than the modulus of the RSA key. - By definition, for a key of k bits, the following formula holds: - - 2^(k-1) <= modulus < 2^(k) - - Where ^ means "to the power of", not "xor". - This means that to be sure, we must choose our message < 2^(k-1). - This can be done by setting the most significant bit to zero. - */ - - c->outkey[0] &= 0x7F; - - if(debug_lvl >= DEBUG_SCARY_THINGS) - { - bin2hex(c->outkey, buffer, len); - buffer[len*2] = '\0'; - syslog(LOG_DEBUG, _("Generated random meta key (unencrypted): %s"), buffer); - } - - /* Encrypt the random data - - We do not use one of the PKCS padding schemes here. - This is allowed, because we encrypt a totally random string - with a length equal to that of the modulus of the RSA key. - */ - - if(RSA_public_encrypt(len, c->outkey, buffer, c->rsa_key, RSA_NO_PADDING) != len) - { - syslog(LOG_ERR, _("Error during encryption of meta key for %s (%s)"), c->name, c->hostname); - return -1; - } -cp - /* Convert the encrypted random data to a hexadecimal formatted string */ - - bin2hex(buffer, buffer, len); - buffer[len*2] = '\0'; - - /* Send the meta key */ - - x = send_request(c, "%d %d %d %d %d %s", METAKEY, - c->outcipher?c->outcipher->nid:0, c->outdigest?c->outdigest->type:0, - c->outmaclength, c->outcompression, buffer); - - /* Further outgoing requests are encrypted with the key we just generated */ - - if(c->outcipher) - { - EVP_EncryptInit(c->outctx, c->outcipher, - c->outkey + len - c->outcipher->key_len, - c->outkey + len - c->outcipher->key_len - c->outcipher->iv_len); - - c->status.encryptout = 1; - } -cp - return x; -} - -int metakey_h(connection_t *c) -{ - char buffer[MAX_STRING_SIZE]; - int cipher, digest, maclength, compression; - int len; -cp - if(sscanf(c->buffer, "%*d %d %d %d %d "MAX_STRING, &cipher, &digest, &maclength, &compression, buffer) != 5) - { - syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "METAKEY", c->name, c->hostname); - return -1; - } -cp - len = RSA_size(myself->connection->rsa_key); - - /* Check if the length of the meta key is all right */ - - if(strlen(buffer) != len*2) - { - syslog(LOG_ERR, _("Possible intruder %s (%s): %s"), c->name, c->hostname, "wrong keylength"); - return -1; - } - - /* Allocate buffers for the meta key */ -cp - if(!c->inkey) - c->inkey = xmalloc(len); - - if(!c->inctx) - c->inctx = xmalloc(sizeof(*c->inctx)); - - /* Convert the challenge from hexadecimal back to binary */ -cp - hex2bin(buffer,buffer,len); - - /* Decrypt the meta key */ -cp - if(RSA_private_decrypt(len, buffer, c->inkey, myself->connection->rsa_key, RSA_NO_PADDING) != len) /* See challenge() */ - { - syslog(LOG_ERR, _("Error during encryption of meta key for %s (%s)"), c->name, c->hostname); - return -1; - } - - if(debug_lvl >= DEBUG_SCARY_THINGS) - { - bin2hex(c->inkey, buffer, len); - buffer[len*2] = '\0'; - syslog(LOG_DEBUG, _("Received random meta key (unencrypted): %s"), buffer); - } - - /* All incoming requests will now be encrypted. */ -cp - /* Check and lookup cipher and digest algorithms */ - - if(cipher) - { - c->incipher = EVP_get_cipherbynid(cipher); - if(!c->incipher) - { - syslog(LOG_ERR, _("%s (%s) uses unknown cipher!"), c->name, c->hostname); - return -1; + if(sscanf(c->buffer, "%*d " MAX_STRING " %d", name, &c->protocol_version) != 2) { + logger(LOG_ERR, _("Got bad %s from %s (%s)"), "ID", c->name, + c->hostname); + return false; } - EVP_DecryptInit(c->inctx, c->incipher, - c->inkey + len - c->incipher->key_len, - c->inkey + len - c->incipher->key_len - c->incipher->iv_len); + /* Check if identity is a valid name */ - c->status.decryptin = 1; - } - else - { - c->incipher = NULL; - } - - c->inmaclength = maclength; - - if(digest) - { - c->indigest = EVP_get_digestbynid(digest); - if(!c->indigest) - { - syslog(LOG_ERR, _("Node %s (%s) uses unknown digest!"), c->name, c->hostname); - return -1; + if(!check_id(name)) { + logger(LOG_ERR, _("Got bad %s from %s (%s): %s"), "ID", c->name, + c->hostname, "invalid name"); + return false; } - - if(c->inmaclength > c->indigest->md_size || c->inmaclength < 0) - { - syslog(LOG_ERR, _("%s (%s) uses bogus MAC length!"), c->name, c->hostname); - return -1; + + /* If we set c->name in advance, make sure we are connected to the right host */ + + if(c->name) { + if(strcmp(c->name, name)) { + logger(LOG_ERR, _("Peer %s is %s instead of %s"), c->hostname, name, + c->name); + return false; + } + } else + c->name = xstrdup(name); + + /* Check if version matches */ + + if(c->protocol_version != myself->connection->protocol_version) { + logger(LOG_ERR, _("Peer %s (%s) uses incompatible version %d"), + c->name, c->hostname, c->protocol_version); + return false; } - } - else - { - c->indigest = NULL; - } - c->incompression = compression; + if(bypass_security) { + if(!c->config_tree) + init_configuration(&c->config_tree); + c->allow_request = ACK; + return send_ack(c); + } - c->allow_request = CHALLENGE; -cp - return send_challenge(c); + if(!c->config_tree) { + init_configuration(&c->config_tree); + + if(!read_connection_config(c)) { + logger(LOG_ERR, _("Peer %s had unknown identity (%s)"), c->hostname, + c->name); + return false; + } + } + + if(!read_rsa_public_key(c)) { + return false; + } + + c->allow_request = METAKEY; + + return send_metakey(c); } -int send_challenge(connection_t *c) +bool send_metakey(connection_t *c) { - char buffer[MAX_STRING_SIZE]; - int len, x; -cp - /* CHECKME: what is most reasonable value for len? */ + char buffer[MAX_STRING_SIZE]; + int len; + bool x; - len = RSA_size(c->rsa_key); + cp(); - /* Allocate buffers for the challenge */ + len = RSA_size(c->rsa_key); - if(!c->hischallenge) - c->hischallenge = xmalloc(len); -cp - /* Copy random data to the buffer */ + /* Allocate buffers for the meta key */ - RAND_bytes(c->hischallenge, len); + if(!c->outkey) + c->outkey = xmalloc(len); -cp - /* Convert to hex */ + if(!c->outctx) + c->outctx = xmalloc_and_zero(sizeof(*c->outctx)); + cp(); + /* Copy random data to the buffer */ - bin2hex(c->hischallenge, buffer, len); - buffer[len*2] = '\0'; + RAND_pseudo_bytes(c->outkey, len); -cp - /* Send the challenge */ + /* The message we send must be smaller than the modulus of the RSA key. + By definition, for a key of k bits, the following formula holds: - x = send_request(c, "%d %s", CHALLENGE, buffer); -cp - return x; + 2^(k-1) <= modulus < 2^(k) + + Where ^ means "to the power of", not "xor". + This means that to be sure, we must choose our message < 2^(k-1). + This can be done by setting the most significant bit to zero. + */ + + c->outkey[0] &= 0x7F; + + ifdebug(SCARY_THINGS) { + bin2hex(c->outkey, buffer, len); + buffer[len * 2] = '\0'; + logger(LOG_DEBUG, _("Generated random meta key (unencrypted): %s"), + buffer); + } + + /* Encrypt the random data + + We do not use one of the PKCS padding schemes here. + This is allowed, because we encrypt a totally random string + with a length equal to that of the modulus of the RSA key. + */ + + if(RSA_public_encrypt(len, c->outkey, buffer, c->rsa_key, RSA_NO_PADDING) != len) { + logger(LOG_ERR, _("Error during encryption of meta key for %s (%s)"), + c->name, c->hostname); + return false; + } + + /* Convert the encrypted random data to a hexadecimal formatted string */ + + bin2hex(buffer, buffer, len); + buffer[len * 2] = '\0'; + + /* Send the meta key */ + + x = send_request(c, "%d %d %d %d %d %s", METAKEY, + c->outcipher ? c->outcipher->nid : 0, + c->outdigest ? c->outdigest->type : 0, c->outmaclength, + c->outcompression, buffer); + + /* Further outgoing requests are encrypted with the key we just generated */ + + if(c->outcipher) { + if(!EVP_EncryptInit(c->outctx, c->outcipher, + c->outkey + len - c->outcipher->key_len, + c->outkey + len - c->outcipher->key_len - + c->outcipher->iv_len)) { + logger(LOG_ERR, _("Error during initialisation of cipher for %s (%s): %s"), + c->name, c->hostname, ERR_error_string(ERR_get_error(), NULL)); + return false; + } + + c->status.encryptout = true; + } + + return x; } -int challenge_h(connection_t *c) +bool metakey_h(connection_t *c) { - char buffer[MAX_STRING_SIZE]; - int len; -cp - if(sscanf(c->buffer, "%*d "MAX_STRING, buffer) != 1) - { - syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "CHALLENGE", c->name, c->hostname); - return -1; - } + char buffer[MAX_STRING_SIZE]; + int cipher, digest, maclength, compression; + int len; - len = RSA_size(myself->connection->rsa_key); + cp(); - /* Check if the length of the challenge is all right */ + if(sscanf(c->buffer, "%*d %d %d %d %d " MAX_STRING, &cipher, &digest, &maclength, &compression, buffer) != 5) { + logger(LOG_ERR, _("Got bad %s from %s (%s)"), "METAKEY", c->name, + c->hostname); + return false; + } - if(strlen(buffer) != len*2) - { - syslog(LOG_ERR, _("Possible intruder %s (%s): %s"), c->name, c->hostname, "wrong challenge length"); - return -1; - } + len = RSA_size(myself->connection->rsa_key); - /* Allocate buffers for the challenge */ + /* Check if the length of the meta key is all right */ - if(!c->mychallenge) - c->mychallenge = xmalloc(len); + if(strlen(buffer) != len * 2) { + logger(LOG_ERR, _("Possible intruder %s (%s): %s"), c->name, c->hostname, "wrong keylength"); + return false; + } - /* Convert the challenge from hexadecimal back to binary */ + /* Allocate buffers for the meta key */ - hex2bin(buffer,c->mychallenge,len); + if(!c->inkey) + c->inkey = xmalloc(len); - c->allow_request = CHAL_REPLY; + if(!c->inctx) + c->inctx = xmalloc_and_zero(sizeof(*c->inctx)); - /* Rest is done by send_chal_reply() */ -cp - return send_chal_reply(c); + /* Convert the challenge from hexadecimal back to binary */ + + hex2bin(buffer, buffer, len); + + /* Decrypt the meta key */ + + if(RSA_private_decrypt(len, buffer, c->inkey, myself->connection->rsa_key, RSA_NO_PADDING) != len) { /* See challenge() */ + logger(LOG_ERR, _("Error during encryption of meta key for %s (%s)"), + c->name, c->hostname); + return false; + } + + ifdebug(SCARY_THINGS) { + bin2hex(c->inkey, buffer, len); + buffer[len * 2] = '\0'; + logger(LOG_DEBUG, _("Received random meta key (unencrypted): %s"), buffer); + } + + /* All incoming requests will now be encrypted. */ + + /* Check and lookup cipher and digest algorithms */ + + if(cipher) { + c->incipher = EVP_get_cipherbynid(cipher); + + if(!c->incipher) { + logger(LOG_ERR, _("%s (%s) uses unknown cipher!"), c->name, c->hostname); + return false; + } + + if(!EVP_DecryptInit(c->inctx, c->incipher, + c->inkey + len - c->incipher->key_len, + c->inkey + len - c->incipher->key_len - + c->incipher->iv_len)) { + logger(LOG_ERR, _("Error during initialisation of cipher from %s (%s): %s"), + c->name, c->hostname, ERR_error_string(ERR_get_error(), NULL)); + return false; + } + + c->status.decryptin = true; + } else { + c->incipher = NULL; + } + + c->inmaclength = maclength; + + if(digest) { + c->indigest = EVP_get_digestbynid(digest); + + if(!c->indigest) { + logger(LOG_ERR, _("Node %s (%s) uses unknown digest!"), c->name, c->hostname); + return false; + } + + if(c->inmaclength > c->indigest->md_size || c->inmaclength < 0) { + logger(LOG_ERR, _("%s (%s) uses bogus MAC length!"), c->name, c->hostname); + return false; + } + } else { + c->indigest = NULL; + } + + c->incompression = compression; + + c->allow_request = CHALLENGE; + + return send_challenge(c); } -int send_chal_reply(connection_t *c) +bool send_challenge(connection_t *c) { - char hash[EVP_MAX_MD_SIZE*2+1]; - EVP_MD_CTX ctx; -cp - /* Calculate the hash from the challenge we received */ + char buffer[MAX_STRING_SIZE]; + int len; - EVP_DigestInit(&ctx, c->indigest); - EVP_DigestUpdate(&ctx, c->mychallenge, RSA_size(myself->connection->rsa_key)); - EVP_DigestFinal(&ctx, hash, NULL); + cp(); - /* Convert the hash to a hexadecimal formatted string */ + /* CHECKME: what is most reasonable value for len? */ - bin2hex(hash,hash,c->indigest->md_size); - hash[c->indigest->md_size*2] = '\0'; + len = RSA_size(c->rsa_key); - /* Send the reply */ + /* Allocate buffers for the challenge */ -cp - return send_request(c, "%d %s", CHAL_REPLY, hash); + if(!c->hischallenge) + c->hischallenge = xmalloc(len); + + /* Copy random data to the buffer */ + + RAND_pseudo_bytes(c->hischallenge, len); + + /* Convert to hex */ + + bin2hex(c->hischallenge, buffer, len); + buffer[len * 2] = '\0'; + + /* Send the challenge */ + + return send_request(c, "%d %s", CHALLENGE, buffer); } -int chal_reply_h(connection_t *c) +bool challenge_h(connection_t *c) { - char hishash[MAX_STRING_SIZE]; - char myhash[EVP_MAX_MD_SIZE]; - EVP_MD_CTX ctx; -cp - if(sscanf(c->buffer, "%*d "MAX_STRING, hishash) != 1) - { - syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "CHAL_REPLY", c->name, c->hostname); - return -1; - } + char buffer[MAX_STRING_SIZE]; + int len; - /* Check if the length of the hash is all right */ + cp(); - if(strlen(hishash) != c->outdigest->md_size*2) - { - syslog(LOG_ERR, _("Possible intruder %s (%s): %s"), c->name, c->hostname, _("wrong challenge reply length")); - return -1; - } + if(sscanf(c->buffer, "%*d " MAX_STRING, buffer) != 1) { + logger(LOG_ERR, _("Got bad %s from %s (%s)"), "CHALLENGE", c->name, + c->hostname); + return false; + } - /* Convert the hash to binary format */ + len = RSA_size(myself->connection->rsa_key); - hex2bin(hishash, hishash, c->outdigest->md_size); + /* Check if the length of the challenge is all right */ - /* Calculate the hash from the challenge we sent */ + if(strlen(buffer) != len * 2) { + logger(LOG_ERR, _("Possible intruder %s (%s): %s"), c->name, + c->hostname, "wrong challenge length"); + return false; + } - EVP_DigestInit(&ctx, c->outdigest); - EVP_DigestUpdate(&ctx, c->hischallenge, RSA_size(c->rsa_key)); - EVP_DigestFinal(&ctx, myhash, NULL); + /* Allocate buffers for the challenge */ - /* Verify the incoming hash with the calculated hash */ + if(!c->mychallenge) + c->mychallenge = xmalloc(len); - if(memcmp(hishash, myhash, c->outdigest->md_size)) - { - syslog(LOG_ERR, _("Possible intruder %s (%s): %s"), c->name, c->hostname, _("wrong challenge reply")); - if(debug_lvl >= DEBUG_SCARY_THINGS) - { - bin2hex(myhash, hishash, SHA_DIGEST_LENGTH); - hishash[SHA_DIGEST_LENGTH*2] = '\0'; - syslog(LOG_DEBUG, _("Expected challenge reply: %s"), hishash); - } - return -1; - } + /* Convert the challenge from hexadecimal back to binary */ - /* Identity has now been positively verified. - Send an acknowledgement with the rest of the information needed. - */ + hex2bin(buffer, c->mychallenge, len); - c->allow_request = ACK; -cp - return send_ack(c); + c->allow_request = CHAL_REPLY; + + /* Rest is done by send_chal_reply() */ + + return send_chal_reply(c); } -int send_ack(connection_t *c) +bool send_chal_reply(connection_t *c) { - /* ACK message contains rest of the information the other end needs - to create node_t and edge_t structures. */ + char hash[EVP_MAX_MD_SIZE * 2 + 1]; + EVP_MD_CTX ctx; - int x; - char *address, *port; - struct timeval now; -cp - /* Estimate weight */ - - gettimeofday(&now, NULL); - c->estimated_weight = (now.tv_sec - c->start.tv_sec) * 1000 + (now.tv_usec - c->start.tv_usec) / 1000; - sockaddr2str(&c->address, &address, &port); - x = send_request(c, "%d %s %s %d %lx", ACK, myport, address, c->estimated_weight, c->options); - free(address); - free(port); -cp - return x; + cp(); + + /* Calculate the hash from the challenge we received */ + + if(!EVP_DigestInit(&ctx, c->indigest) + || !EVP_DigestUpdate(&ctx, c->mychallenge, RSA_size(myself->connection->rsa_key)) + || !EVP_DigestFinal(&ctx, hash, NULL)) { + logger(LOG_ERR, _("Error during calculation of response for %s (%s): %s"), + c->name, c->hostname, ERR_error_string(ERR_get_error(), NULL)); + return false; + } + + /* Convert the hash to a hexadecimal formatted string */ + + bin2hex(hash, hash, c->indigest->md_size); + hash[c->indigest->md_size * 2] = '\0'; + + /* Send the reply */ + + return send_request(c, "%d %s", CHAL_REPLY, hash); } -void send_everything(connection_t *c) +bool chal_reply_h(connection_t *c) { - avl_node_t *node, *node2; - node_t *n; - subnet_t *s; - edge_t *e; + char hishash[MAX_STRING_SIZE]; + char myhash[EVP_MAX_MD_SIZE]; + EVP_MD_CTX ctx; - /* Send all known subnets */ - - for(node = node_tree->head; node; node = node->next) - { - n = (node_t *)node->data; + cp(); - for(node2 = n->subnet_tree->head; node2; node2 = node2->next) - { - s = (subnet_t *)node2->data; - send_add_subnet(c, s); - } - } + if(sscanf(c->buffer, "%*d " MAX_STRING, hishash) != 1) { + logger(LOG_ERR, _("Got bad %s from %s (%s)"), "CHAL_REPLY", c->name, + c->hostname); + return false; + } - /* Send all known edges */ + /* Check if the length of the hash is all right */ - for(node = edge_tree->head; node; node = node->next) - { - e = (edge_t *)node->data; + if(strlen(hishash) != c->outdigest->md_size * 2) { + logger(LOG_ERR, _("Possible intruder %s (%s): %s"), c->name, + c->hostname, _("wrong challenge reply length")); + return false; + } - if(e == c->edge) - continue; + /* Convert the hash to binary format */ - send_add_edge(c, e); - } + hex2bin(hishash, hishash, c->outdigest->md_size); + + /* Calculate the hash from the challenge we sent */ + + if(!EVP_DigestInit(&ctx, c->outdigest) + || !EVP_DigestUpdate(&ctx, c->hischallenge, RSA_size(c->rsa_key)) + || !EVP_DigestFinal(&ctx, myhash, NULL)) { + logger(LOG_ERR, _("Error during calculation of response from %s (%s): %s"), + c->name, c->hostname, ERR_error_string(ERR_get_error(), NULL)); + return false; + } + + /* Verify the incoming hash with the calculated hash */ + + if(memcmp(hishash, myhash, c->outdigest->md_size)) { + logger(LOG_ERR, _("Possible intruder %s (%s): %s"), c->name, + c->hostname, _("wrong challenge reply")); + + ifdebug(SCARY_THINGS) { + bin2hex(myhash, hishash, SHA_DIGEST_LENGTH); + hishash[SHA_DIGEST_LENGTH * 2] = '\0'; + logger(LOG_DEBUG, _("Expected challenge reply: %s"), hishash); + } + + return false; + } + + /* Identity has now been positively verified. + Send an acknowledgement with the rest of the information needed. + */ + + c->allow_request = ACK; + + return send_ack(c); } -int ack_h(connection_t *c) +bool send_ack(connection_t *c) { - char myaddress[MAX_STRING_SIZE]; - char hisport[MAX_STRING_SIZE]; - char *hisaddress, *dummy; - int weight; - long int options; - node_t *n; - connection_t *other; - avl_node_t *node; -cp - if(sscanf(c->buffer, "%*d "MAX_STRING" "MAX_STRING" %d %lx", hisport, myaddress, &weight, &options) != 4) - { - syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "ACK", c->name, c->hostname); - return -1; - } + /* ACK message contains rest of the information the other end needs + to create node_t and edge_t structures. */ - /* Check if we already have a node_t for him */ + struct timeval now; + bool choice; - n = lookup_node(c->name); - - if(!n) - { - n = new_node(); - n->name = xstrdup(c->name); - node_add(n); - } - else - { - if(n->connection) - { - /* Oh dear, we already have a connection to this node. */ - if(debug_lvl >= DEBUG_CONNECTIONS) - syslog(LOG_DEBUG, _("Established a second connection with %s (%s), closing old connection"), n->name, n->hostname); - terminate_connection(n->connection, 0); - } - - /* FIXME: check if information in existing node matches that of the other end of this connection */ - } - - n->connection = c; - c->node = n; - c->options |= options; + cp(); - /* Create an edge_t for this connection */ + /* Estimate weight */ - c->edge = new_edge(); -cp - c->edge->from.node = myself; - c->edge->from.udpaddress = str2sockaddr(myaddress, myport); - c->edge->to.node = n; - sockaddr2str(&c->address, &hisaddress, &dummy); - c->edge->to.udpaddress = str2sockaddr(hisaddress, hisport); - free(hisaddress); - free(dummy); - c->edge->weight = (weight + c->estimated_weight) / 2; - c->edge->connection = c; - c->edge->options = c->options; -cp - edge_add(c->edge); + gettimeofday(&now, NULL); + c->estimated_weight = (now.tv_sec - c->start.tv_sec) * 1000 + (now.tv_usec - c->start.tv_usec) / 1000; - /* Activate this connection */ + /* Check some options */ - c->allow_request = ALL; - c->status.active = 1; + if((get_config_bool(lookup_config(c->config_tree, "IndirectData"), &choice) && choice) || myself->options & OPTION_INDIRECT) + c->options |= OPTION_INDIRECT; - if(debug_lvl >= DEBUG_CONNECTIONS) - syslog(LOG_NOTICE, _("Connection with %s (%s) activated"), c->name, c->hostname); + if((get_config_bool(lookup_config(c->config_tree, "TCPOnly"), &choice) && choice) || myself->options & OPTION_TCPONLY) + c->options |= OPTION_TCPONLY | OPTION_INDIRECT; -cp - /* Send him everything we know */ + if((get_config_bool(lookup_config(c->config_tree, "PMTUDiscovery"), &choice) && choice) || myself->options & OPTION_PMTU_DISCOVERY) + c->options |= OPTION_PMTU_DISCOVERY; - send_everything(c); + get_config_int(lookup_config(c->config_tree, "Weight"), &c->estimated_weight); - /* Notify others of this connection */ - - for(node = connection_tree->head; node; node = node->next) - { - other = (connection_t *)node->data; - - if(other->status.active && other != c) - send_add_edge(other, c->edge); - } - - /* Run MST and SSSP algorithms */ - - graph(); -cp - return 0; + return send_request(c, "%d %s %d %lx", ACK, myport, c->estimated_weight, c->options); +} + +static void send_everything(connection_t *c) +{ + avl_node_t *node, *node2; + node_t *n; + subnet_t *s; + edge_t *e; + + /* Send all known subnets and edges */ + + if(tunnelserver) { + for(node = myself->subnet_tree->head; node; node = node->next) { + s = node->data; + send_add_subnet(c, s); + } + + return; + } + + for(node = node_tree->head; node; node = node->next) { + n = node->data; + + for(node2 = n->subnet_tree->head; node2; node2 = node2->next) { + s = node2->data; + send_add_subnet(c, s); + } + + for(node2 = n->edge_tree->head; node2; node2 = node2->next) { + e = node2->data; + send_add_edge(c, e); + } + } +} + +bool ack_h(connection_t *c) +{ + char hisport[MAX_STRING_SIZE]; + char *hisaddress, *dummy; + int weight, mtu; + long int options; + node_t *n; + + cp(); + + if(sscanf(c->buffer, "%*d " MAX_STRING " %d %lx", hisport, &weight, &options) != 3) { + logger(LOG_ERR, _("Got bad %s from %s (%s)"), "ACK", c->name, + c->hostname); + return false; + } + + /* Check if we already have a node_t for him */ + + n = lookup_node(c->name); + + if(!n) { + n = new_node(); + n->name = xstrdup(c->name); + node_add(n); + } else { + if(n->connection) { + /* Oh dear, we already have a connection to this node. */ + ifdebug(CONNECTIONS) logger(LOG_DEBUG, _("Established a second connection with %s (%s), closing old connection"), + n->name, n->hostname); + terminate_connection(n->connection, false); + /* Run graph algorithm to purge key and make sure up/down scripts are rerun with new IP addresses and stuff */ + graph(); + } + } + + n->connection = c; + c->node = n; + c->options |= options; + + if(get_config_int(lookup_config(c->config_tree, "PMTU"), &mtu) && mtu < n->mtu) + n->mtu = mtu; + + if(get_config_int(lookup_config(myself->connection->config_tree, "PMTU"), &mtu) && mtu < n->mtu) + n->mtu = mtu; + + /* Activate this connection */ + + c->allow_request = ALL; + c->status.active = true; + + ifdebug(CONNECTIONS) logger(LOG_NOTICE, _("Connection with %s (%s) activated"), c->name, + c->hostname); + + /* Send him everything we know */ + + send_everything(c); + + /* Create an edge_t for this connection */ + + c->edge = new_edge(); + cp(); + c->edge->from = myself; + c->edge->to = n; + sockaddr2str(&c->address, &hisaddress, &dummy); + c->edge->address = str2sockaddr(hisaddress, hisport); + free(hisaddress); + free(dummy); + c->edge->weight = (weight + c->estimated_weight) / 2; + c->edge->connection = c; + c->edge->options = c->options; + + edge_add(c->edge); + + /* Notify everyone of the new edge */ + + if(tunnelserver) + send_add_edge(c, c->edge); + else + send_add_edge(broadcast, c->edge); + + /* Run MST and SSSP algorithms */ + + graph(); + + return true; } diff --git a/src/protocol_edge.c b/src/protocol_edge.c index 0d3218e..e6f4731 100644 --- a/src/protocol_edge.c +++ b/src/protocol_edge.c @@ -1,7 +1,7 @@ /* protocol_edge.c -- handle the meta-protocol, edges - Copyright (C) 1999-2002 Ivo Timmermans , - 2000-2002 Guus Sliepen + Copyright (C) 1999-2004 Ivo Timmermans , + 2000-2004 Guus Sliepen 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 @@ -17,282 +17,257 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: protocol_edge.c,v 1.1.4.7 2002/03/27 15:26:44 guus Exp $ + $Id: protocol_edge.c 1374 2004-03-21 14:21:22Z guus $ */ -#include "config.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "conf.h" -#include "net.h" -#include "netutl.h" -#include "protocol.h" -#include "meta.h" -#include "connection.h" -#include "node.h" -#include "edge.h" -#include "graph.h" - #include "system.h" -int send_add_edge(connection_t *c, edge_t *e) +#include "avl_tree.h" +#include "conf.h" +#include "connection.h" +#include "edge.h" +#include "graph.h" +#include "logger.h" +#include "meta.h" +#include "net.h" +#include "netutl.h" +#include "node.h" +#include "protocol.h" +#include "utils.h" +#include "xalloc.h" + +bool send_add_edge(connection_t *c, const edge_t *e) { - int x; - char *from_udpaddress, *from_udpport; - char *to_udpaddress, *to_udpport; -cp - sockaddr2str(&e->from.udpaddress, &from_udpaddress, &from_udpport); - sockaddr2str(&e->to.udpaddress, &to_udpaddress, &to_udpport); - x = send_request(c, "%d %lx %s %s %s %s %s %s %lx %d", ADD_EDGE, random(), - e->from.node->name, from_udpaddress, from_udpport, - e->to.node->name, to_udpaddress, to_udpport, - e->options, e->weight); - free(from_udpaddress); - free(from_udpport); - free(to_udpaddress); - free(to_udpport); -cp - return x; + bool x; + char *address, *port; + + cp(); + + sockaddr2str(&e->address, &address, &port); + + x = send_request(c, "%d %lx %s %s %s %s %lx %d", ADD_EDGE, random(), + e->from->name, e->to->name, address, port, + e->options, e->weight); + free(address); + free(port); + + return x; } -int add_edge_h(connection_t *c) +bool add_edge_h(connection_t *c) { - connection_t *other; - edge_t *e; - node_t *from, *to; - char from_name[MAX_STRING_SIZE]; - char to_name[MAX_STRING_SIZE]; - char from_address[MAX_STRING_SIZE]; - char from_udpport[MAX_STRING_SIZE]; - char to_address[MAX_STRING_SIZE]; - char to_udpport[MAX_STRING_SIZE]; - sockaddr_t from_udpaddress; - sockaddr_t to_udpaddress; - long int options; - int weight; - avl_node_t *node; -cp - if(sscanf(c->buffer, "%*d %*x "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" %lx %d", - from_name, from_address, from_udpport, - to_name, to_address, to_udpport, - &options, &weight) != 8) - { - syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "ADD_EDGE", c->name, c->hostname); - return -1; - } + edge_t *e; + node_t *from, *to; + char from_name[MAX_STRING_SIZE]; + char to_name[MAX_STRING_SIZE]; + char to_address[MAX_STRING_SIZE]; + char to_port[MAX_STRING_SIZE]; + sockaddr_t address; + long int options; + int weight; - /* Check if names are valid */ + cp(); - if(check_id(from_name)) - { - syslog(LOG_ERR, _("Got bad %s from %s (%s): %s"), "ADD_EDGE", c->name, c->hostname, _("invalid name")); - return -1; - } + if(sscanf(c->buffer, "%*d %*x "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" %lx %d", + from_name, to_name, to_address, to_port, &options, &weight) != 6) { + logger(LOG_ERR, _("Got bad %s from %s (%s)"), "ADD_EDGE", c->name, + c->hostname); + return false; + } - if(check_id(to_name)) - { - syslog(LOG_ERR, _("Got bad %s from %s (%s): %s"), "ADD_EDGE", c->name, c->hostname, _("invalid name")); - return -1; - } + /* Check if names are valid */ - if(seen_request(c->buffer)) - return 0; + if(!check_id(from_name)) { + logger(LOG_ERR, _("Got bad %s from %s (%s): %s"), "ADD_EDGE", c->name, + c->hostname, _("invalid name")); + return false; + } - /* Lookup nodes */ + if(!check_id(to_name)) { + logger(LOG_ERR, _("Got bad %s from %s (%s): %s"), "ADD_EDGE", c->name, + c->hostname, _("invalid name")); + return false; + } - from = lookup_node(from_name); - - if(!from) - { - from = new_node(); - from->name = xstrdup(from_name); - node_add(from); - } + if(seen_request(c->buffer)) + return true; - to = lookup_node(to_name); - - if(!to) - { - to = new_node(); - to->name = xstrdup(to_name); - node_add(to); - } + /* Lookup nodes */ - /* Convert addresses */ - - from_udpaddress = str2sockaddr(from_address, from_udpport); - to_udpaddress = str2sockaddr(to_address, to_udpport); + from = lookup_node(from_name); - /* Check if edge already exists */ - - e = lookup_edge(from, to); - - if(e) - { - if(e->weight != weight || e->options != options - || ((e->from.node == from) && (sockaddrcmp(&e->from.udpaddress, &from_udpaddress)|| sockaddrcmp(&e->to.udpaddress, &to_udpaddress))) - || ((e->from.node == to) && (sockaddrcmp(&e->from.udpaddress, &to_udpaddress) || sockaddrcmp(&e->to.udpaddress, &from_udpaddress))) - ) - { - if(from == myself || to == myself) - { - if(debug_lvl >= DEBUG_PROTOCOL) - syslog(LOG_WARNING, _("Got %s from %s (%s) for ourself which does not match existing entry"), "ADD_EDGE", c->name, c->hostname); - send_add_edge(c, e); - return 0; - } - else - { - if(debug_lvl >= DEBUG_PROTOCOL) - syslog(LOG_WARNING, _("Got %s from %s (%s) which does not match existing entry"), "ADD_EDGE", c->name, c->hostname); - edge_del(e); - } - } - else - return 0; - } - else if(from == myself || to == myself) - { - if(debug_lvl >= DEBUG_PROTOCOL) - syslog(LOG_WARNING, _("Got %s from %s (%s) for ourself which does not exist"), "ADD_EDGE", c->name, c->hostname); - e = new_edge(); - e->from.node = from; - e->to.node = to; - send_del_edge(c, e); - free_edge(e); - return 0; - } + if(!from) { + from = new_node(); + from->name = xstrdup(from_name); + node_add(from); + } - e = new_edge(); - e->from.node = from; - e->from.udpaddress = from_udpaddress; - e->to.node = to; - e->to.udpaddress = to_udpaddress; - e->options = options; - e->weight = weight; - edge_add(e); + to = lookup_node(to_name); - /* Tell the rest about the new edge */ + if(!to) { + to = new_node(); + to->name = xstrdup(to_name); + node_add(to); + } - for(node = connection_tree->head; node; node = node->next) - { - other = (connection_t *)node->data; - if(other->status.active && other != c) - send_request(other, "%s", c->buffer); - } + if(tunnelserver && from != myself && from != c->node && to != myself && to != c->node) + return false; - /* Run MST before or after we tell the rest? */ + /* Convert addresses */ - graph(); -cp - return 0; + address = str2sockaddr(to_address, to_port); + + /* Check if edge already exists */ + + e = lookup_edge(from, to); + + if(e) { + if(e->weight != weight || e->options != options || sockaddrcmp(&e->address, &address)) { + if(from == myself) { + ifdebug(PROTOCOL) logger(LOG_WARNING, _("Got %s from %s (%s) for ourself which does not match existing entry"), + "ADD_EDGE", c->name, c->hostname); + send_add_edge(c, e); + return true; + } else { + ifdebug(PROTOCOL) logger(LOG_WARNING, _("Got %s from %s (%s) which does not match existing entry"), + "ADD_EDGE", c->name, c->hostname); + edge_del(e); + graph(); + } + } else + return true; + } else if(from == myself) { + ifdebug(PROTOCOL) logger(LOG_WARNING, _("Got %s from %s (%s) for ourself which does not exist"), + "ADD_EDGE", c->name, c->hostname); + e = new_edge(); + e->from = from; + e->to = to; + send_del_edge(c, e); + free_edge(e); + return true; + } + + e = new_edge(); + e->from = from; + e->to = to; + e->address = address; + e->options = options; + e->weight = weight; + edge_add(e); + + /* Tell the rest about the new edge */ + + if(!tunnelserver) + forward_request(c); + + /* Run MST before or after we tell the rest? */ + + graph(); + + return true; } -int send_del_edge(connection_t *c, edge_t *e) +bool send_del_edge(connection_t *c, const edge_t *e) { -cp - return send_request(c, "%d %lx %s %s", DEL_EDGE, random(), - e->from.node->name, e->to.node->name); + cp(); + + return send_request(c, "%d %lx %s %s", DEL_EDGE, random(), + e->from->name, e->to->name); } -int del_edge_h(connection_t *c) +bool del_edge_h(connection_t *c) { - edge_t *e; - char from_name[MAX_STRING_SIZE]; - char to_name[MAX_STRING_SIZE]; - node_t *from, *to; - connection_t *other; - avl_node_t *node; -cp - if(sscanf(c->buffer, "%*d %*x "MAX_STRING" "MAX_STRING"", from_name, to_name) != 2) - { - syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "DEL_EDGE", - c->name, c->hostname); - return -1; - } + edge_t *e; + char from_name[MAX_STRING_SIZE]; + char to_name[MAX_STRING_SIZE]; + node_t *from, *to; - /* Check if names are valid */ + cp(); - if(check_id(from_name)) - { - syslog(LOG_ERR, _("Got bad %s from %s (%s): %s"), "DEL_EDGE", c->name, c->hostname, _("invalid name")); - return -1; - } + if(sscanf(c->buffer, "%*d %*x "MAX_STRING" "MAX_STRING, from_name, to_name) != 2) { + logger(LOG_ERR, _("Got bad %s from %s (%s)"), "DEL_EDGE", c->name, + c->hostname); + return false; + } - if(check_id(to_name)) - { - syslog(LOG_ERR, _("Got bad %s from %s (%s): %s"), "DEL_EDGE", c->name, c->hostname, _("invalid name")); - return -1; - } + /* Check if names are valid */ - if(seen_request(c->buffer)) - return 0; + if(!check_id(from_name)) { + logger(LOG_ERR, _("Got bad %s from %s (%s): %s"), "DEL_EDGE", c->name, + c->hostname, _("invalid name")); + return false; + } - /* Lookup nodes */ + if(!check_id(to_name)) { + logger(LOG_ERR, _("Got bad %s from %s (%s): %s"), "DEL_EDGE", c->name, + c->hostname, _("invalid name")); + return false; + } - from = lookup_node(from_name); - - if(!from) - { - if(debug_lvl >= DEBUG_PROTOCOL) - syslog(LOG_ERR, _("Got %s from %s (%s) which does not appear in the edge tree"), "DEL_EDGE", c->name, c->hostname); - return 0; - } + if(seen_request(c->buffer)) + return true; - to = lookup_node(to_name); - - if(!to) - { - if(debug_lvl >= DEBUG_PROTOCOL) - syslog(LOG_ERR, _("Got %s from %s (%s) which does not appear in the edge tree"), "DEL_EDGE", c->name, c->hostname); - return 0; - } + /* Lookup nodes */ - /* Check if edge exists */ - - e = lookup_edge(from, to); - - if(!e) - { - if(debug_lvl >= DEBUG_PROTOCOL) - syslog(LOG_WARNING, _("Got %s from %s (%s) which does not appear in the edge tree"), "DEL_EDGE", c->name, c->hostname); - return 0; - } + from = lookup_node(from_name); - if(e->from.node == myself || e->to.node == myself) - { - if(debug_lvl >= DEBUG_PROTOCOL) - syslog(LOG_WARNING, _("Got %s from %s (%s) for ourself"), "DEL_EDGE", c->name, c->hostname); - send_add_edge(c, e); /* Send back a correction */ - return 0; - } + if(!from) { + ifdebug(PROTOCOL) logger(LOG_ERR, _("Got %s from %s (%s) which does not appear in the edge tree"), + "DEL_EDGE", c->name, c->hostname); + return true; + } - /* Tell the rest about the deleted edge */ + to = lookup_node(to_name); - for(node = connection_tree->head; node; node = node->next) - { - other = (connection_t *)node->data; - if(other->status.active && other != c) - send_request(other, "%s", c->buffer); - } + if(!to) { + ifdebug(PROTOCOL) logger(LOG_ERR, _("Got %s from %s (%s) which does not appear in the edge tree"), + "DEL_EDGE", c->name, c->hostname); + return true; + } - /* Delete the edge */ - - edge_del(e); + if(tunnelserver && from != myself && from != c->node && to != myself && to != c->node) + return false; - /* Run MST before or after we tell the rest? */ + /* Check if edge exists */ - graph(); -cp - return 0; + e = lookup_edge(from, to); + + if(!e) { + ifdebug(PROTOCOL) logger(LOG_WARNING, _("Got %s from %s (%s) which does not appear in the edge tree"), + "DEL_EDGE", c->name, c->hostname); + return true; + } + + if(e->from == myself) { + ifdebug(PROTOCOL) logger(LOG_WARNING, _("Got %s from %s (%s) for ourself"), + "DEL_EDGE", c->name, c->hostname); + send_add_edge(c, e); /* Send back a correction */ + return true; + } + + /* Tell the rest about the deleted edge */ + + if(!tunnelserver) + forward_request(c); + + /* Delete the edge */ + + edge_del(e); + + /* Run MST before or after we tell the rest? */ + + graph(); + + /* If the node is not reachable anymore but we remember it had an edge to us, clean it up */ + + if(!to->status.reachable) { + e = lookup_edge(to, myself); + if(e) { + if(!tunnelserver) + send_del_edge(broadcast, e); + edge_del(e); + } + } + + return true; } diff --git a/src/protocol_key.c b/src/protocol_key.c index 016fbff..dd8341a 100644 --- a/src/protocol_key.c +++ b/src/protocol_key.c @@ -1,7 +1,7 @@ /* protocol_key.c -- handle the meta-protocol, key exchange - Copyright (C) 1999-2002 Ivo Timmermans , - 2000-2002 Guus Sliepen + Copyright (C) 1999-2004 Ivo Timmermans , + 2000-2004 Guus Sliepen 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 @@ -17,270 +17,260 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: protocol_key.c,v 1.1.4.6 2002/03/22 13:31:18 guus Exp $ + $Id: protocol_key.c 1374 2004-03-21 14:21:22Z guus $ */ -#include "config.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "conf.h" -#include "net.h" -#include "netutl.h" -#include "protocol.h" -#include "meta.h" -#include "connection.h" -#include "node.h" -#include "edge.h" - #include "system.h" -int mykeyused = 0; +#include +#include -int send_key_changed(connection_t *c, node_t *n) +#include "avl_tree.h" +#include "connection.h" +#include "logger.h" +#include "net.h" +#include "netutl.h" +#include "node.h" +#include "protocol.h" +#include "utils.h" +#include "xalloc.h" + +bool mykeyused = false; + +bool send_key_changed(connection_t *c, const node_t *n) { - connection_t *other; - avl_node_t *node; -cp - /* Only send this message if some other daemon requested our key previously. - This reduces unnecessary key_changed broadcasts. - */ + cp(); - if(n == myself && !mykeyused) - return 0; + /* Only send this message if some other daemon requested our key previously. + This reduces unnecessary key_changed broadcasts. + */ - for(node = connection_tree->head; node; node = node->next) - { - other = (connection_t *)node->data; - if(other->status.active && other != c) - send_request(other, "%d %lx %s", KEY_CHANGED, random(), n->name); - } -cp - return 0; + if(n == myself && !mykeyused) + return true; + + return send_request(c, "%d %lx %s", KEY_CHANGED, random(), n->name); } -int key_changed_h(connection_t *c) +bool key_changed_h(connection_t *c) { - char name[MAX_STRING_SIZE]; - avl_node_t *node; - connection_t *other; - node_t *n; -cp - if(sscanf(c->buffer, "%*d %*x "MAX_STRING, name) != 1) - { - syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "KEY_CHANGED", - c->name, c->hostname); - return -1; - } + char name[MAX_STRING_SIZE]; + node_t *n; - if(seen_request(c->buffer)) - return 0; + cp(); - n = lookup_node(name); - - if(!n) - { - syslog(LOG_ERR, _("Got %s from %s (%s) origin %s which does not exist"), "KEY_CHANGED", - c->name, c->hostname, name); - return -1; - } - - n->status.validkey = 0; - n->status.waitingforkey = 0; - n->sent_seqno = 0; - - /* Tell the others */ - - for(node = connection_tree->head; node; node = node->next) - { - other = (connection_t *)node->data; - if(other->status.active && other != c) - send_request(other, "%s", c->buffer); - } -cp - return 0; -} - -int send_req_key(connection_t *c, node_t *from, node_t *to) -{ -cp - return send_request(c, "%d %s %s", REQ_KEY, - from->name, to->name); -} - -int req_key_h(connection_t *c) -{ - char from_name[MAX_STRING_SIZE]; - char to_name[MAX_STRING_SIZE]; - node_t *from, *to; -cp - if(sscanf(c->buffer, "%*d "MAX_STRING" "MAX_STRING, from_name, to_name) != 2) - { - syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "REQ_KEY", - c->name, c->hostname); - return -1; - } - - from = lookup_node(from_name); - - if(!from) - { - syslog(LOG_ERR, _("Got %s from %s (%s) origin %s which does not exist in our connection list"), "REQ_KEY", - c->name, c->hostname, from_name); - return -1; - } - - to = lookup_node(to_name); - - if(!to) - { - syslog(LOG_ERR, _("Got %s from %s (%s) destination %s which does not exist in our connection list"), "REQ_KEY", - c->name, c->hostname, to_name); - return -1; - } - - /* Check if this key request is for us */ - - if(to == myself) /* Yes, send our own key back */ - { - mykeyused = 1; - from->received_seqno = 0; - send_ans_key(c, myself, from); - } - else - { -/* Proxy keys - if(to->status.validkey) - { - send_ans_key(c, to, from); - } - else -*/ - send_req_key(to->nexthop->connection, from, to); - } - -cp - return 0; -} - -int send_ans_key(connection_t *c, node_t *from, node_t *to) -{ - char key[MAX_STRING_SIZE]; -cp - bin2hex(from->key, key, from->keylength); - key[from->keylength * 2] = '\0'; -cp - return send_request(c, "%d %s %s %s %d %d %d %d", ANS_KEY, - from->name, to->name, key, from->cipher?from->cipher->nid:0, from->digest?from->digest->type:0, from->maclength, from->compression); -} - -int ans_key_h(connection_t *c) -{ - char from_name[MAX_STRING_SIZE]; - char to_name[MAX_STRING_SIZE]; - char key[MAX_STRING_SIZE]; - int cipher, digest, maclength, compression; - node_t *from, *to; -cp - if(sscanf(c->buffer, "%*d "MAX_STRING" "MAX_STRING" "MAX_STRING" %d %d %d %d", from_name, to_name, key, &cipher, &digest, &maclength, &compression) != 7) - { - syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "ANS_KEY", - c->name, c->hostname); - return -1; - } - - from = lookup_node(from_name); - - if(!from) - { - syslog(LOG_ERR, _("Got %s from %s (%s) origin %s which does not exist in our connection list"), "ANS_KEY", - c->name, c->hostname, from_name); - return -1; - } - - to = lookup_node(to_name); - - if(!to) - { - syslog(LOG_ERR, _("Got %s from %s (%s) destination %s which does not exist in our connection list"), "ANS_KEY", - c->name, c->hostname, to_name); - return -1; - } - - /* Forward it if necessary */ - - if(to != myself) - { - return send_request(to->nexthop->connection, "%s", c->buffer); - } - - /* Update our copy of the origin's packet key */ - - if(from->key) - free(from->key); - - from->key = xstrdup(key); - from->keylength = strlen(key) / 2; - hex2bin(from->key, from->key, from->keylength); - from->key[from->keylength] = '\0'; - - from->status.validkey = 1; - from->status.waitingforkey = 0; - - /* Check and lookup cipher and digest algorithms */ - - if(cipher) - { - from->cipher = EVP_get_cipherbynid(cipher); - if(!from->cipher) - { - syslog(LOG_ERR, _("Node %s (%s) uses unknown cipher!"), from->name, from->hostname); - return -1; + if(sscanf(c->buffer, "%*d %*x " MAX_STRING, name) != 1) { + logger(LOG_ERR, _("Got bad %s from %s (%s)"), "KEY_CHANGED", + c->name, c->hostname); + return false; } - if(from->keylength != from->cipher->key_len + from->cipher->iv_len) - { - syslog(LOG_ERR, _("Node %s (%s) uses wrong keylength!"), from->name, from->hostname); - return -1; - } - } - else - { - from->cipher = NULL; - } - from->maclength = maclength; + if(seen_request(c->buffer)) + return true; - if(digest) - { - from->digest = EVP_get_digestbynid(digest); - if(!from->digest) - { - syslog(LOG_ERR, _("Node %s (%s) uses unknown digest!"), from->name, from->hostname); - return -1; + n = lookup_node(name); + + if(!n) { + logger(LOG_ERR, _("Got %s from %s (%s) origin %s which does not exist"), + "KEY_CHANGED", c->name, c->hostname, name); + return false; } - if(from->maclength > from->digest->md_size || from->maclength < 0) - { - syslog(LOG_ERR, _("Node %s (%s) uses bogus MAC length!"), from->name, from->hostname); - return -1; - } - } - else - { - from->digest = NULL; - } - from->compression = compression; - - flush_queue(from); -cp - return 0; + n->status.validkey = false; + n->status.waitingforkey = false; + + /* Tell the others */ + + if(!tunnelserver) + forward_request(c); + + return true; +} + +bool send_req_key(connection_t *c, const node_t *from, const node_t *to) +{ + cp(); + + return send_request(c, "%d %s %s", REQ_KEY, from->name, to->name); +} + +bool req_key_h(connection_t *c) +{ + char from_name[MAX_STRING_SIZE]; + char to_name[MAX_STRING_SIZE]; + node_t *from, *to; + + cp(); + + if(sscanf(c->buffer, "%*d " MAX_STRING " " MAX_STRING, from_name, to_name) != 2) { + logger(LOG_ERR, _("Got bad %s from %s (%s)"), "REQ_KEY", c->name, + c->hostname); + return false; + } + + from = lookup_node(from_name); + + if(!from) { + logger(LOG_ERR, _("Got %s from %s (%s) origin %s which does not exist in our connection list"), + "REQ_KEY", c->name, c->hostname, from_name); + return false; + } + + to = lookup_node(to_name); + + if(!to) { + logger(LOG_ERR, _("Got %s from %s (%s) destination %s which does not exist in our connection list"), + "REQ_KEY", c->name, c->hostname, to_name); + return false; + } + + /* Check if this key request is for us */ + + if(to == myself) { /* Yes, send our own key back */ + mykeyused = true; + from->received_seqno = 0; + memset(from->late, 0, sizeof(from->late)); + send_ans_key(c, myself, from); + } else { + if(tunnelserver) + return false; + + send_req_key(to->nexthop->connection, from, to); + } + + return true; +} + +bool send_ans_key(connection_t *c, const node_t *from, const node_t *to) +{ + char key[MAX_STRING_SIZE]; + + cp(); + + bin2hex(from->key, key, from->keylength); + key[from->keylength * 2] = '\0'; + + return send_request(c, "%d %s %s %s %d %d %d %d", ANS_KEY, + from->name, to->name, key, + from->cipher ? from->cipher->nid : 0, + from->digest ? from->digest->type : 0, from->maclength, + from->compression); +} + +bool ans_key_h(connection_t *c) +{ + char from_name[MAX_STRING_SIZE]; + char to_name[MAX_STRING_SIZE]; + char key[MAX_STRING_SIZE]; + int cipher, digest, maclength, compression; + node_t *from, *to; + + cp(); + + if(sscanf(c->buffer, "%*d "MAX_STRING" "MAX_STRING" "MAX_STRING" %d %d %d %d", + from_name, to_name, key, &cipher, &digest, &maclength, + &compression) != 7) { + logger(LOG_ERR, _("Got bad %s from %s (%s)"), "ANS_KEY", c->name, + c->hostname); + return false; + } + + from = lookup_node(from_name); + + if(!from) { + logger(LOG_ERR, _("Got %s from %s (%s) origin %s which does not exist in our connection list"), + "ANS_KEY", c->name, c->hostname, from_name); + return false; + } + + to = lookup_node(to_name); + + if(!to) { + logger(LOG_ERR, _("Got %s from %s (%s) destination %s which does not exist in our connection list"), + "ANS_KEY", c->name, c->hostname, to_name); + return false; + } + + /* Forward it if necessary */ + + if(to != myself) { + if(tunnelserver) + return false; + + return send_request(to->nexthop->connection, "%s", c->buffer); + } + + /* Update our copy of the origin's packet key */ + + if(from->key) + free(from->key); + + from->key = xstrdup(key); + from->keylength = strlen(key) / 2; + hex2bin(from->key, from->key, from->keylength); + from->key[from->keylength] = '\0'; + + from->status.validkey = true; + from->status.waitingforkey = false; + from->sent_seqno = 0; + + /* Check and lookup cipher and digest algorithms */ + + if(cipher) { + from->cipher = EVP_get_cipherbynid(cipher); + + if(!from->cipher) { + logger(LOG_ERR, _("Node %s (%s) uses unknown cipher!"), from->name, + from->hostname); + return false; + } + + if(from->keylength != from->cipher->key_len + from->cipher->iv_len) { + logger(LOG_ERR, _("Node %s (%s) uses wrong keylength!"), from->name, + from->hostname); + return false; + } + } else { + from->cipher = NULL; + } + + from->maclength = maclength; + + if(digest) { + from->digest = EVP_get_digestbynid(digest); + + if(!from->digest) { + logger(LOG_ERR, _("Node %s (%s) uses unknown digest!"), from->name, + from->hostname); + return false; + } + + if(from->maclength > from->digest->md_size || from->maclength < 0) { + logger(LOG_ERR, _("Node %s (%s) uses bogus MAC length!"), + from->name, from->hostname); + return false; + } + } else { + from->digest = NULL; + } + + if(compression < 0 || compression > 11) { + logger(LOG_ERR, _("Node %s (%s) uses bogus compression level!"), from->name, from->hostname); + return false; + } + + from->compression = compression; + + if(from->cipher) + if(!EVP_EncryptInit_ex(&from->packet_ctx, from->cipher, NULL, from->key, from->key + from->cipher->key_len)) { + logger(LOG_ERR, _("Error during initialisation of key from %s (%s): %s"), + from->name, from->hostname, ERR_error_string(ERR_get_error(), NULL)); + return false; + } + + if(from->options & OPTION_PMTU_DISCOVERY && !from->mtuprobes) + send_mtu_probe(from); + + flush_queue(from); + + return true; } diff --git a/src/protocol_misc.c b/src/protocol_misc.c index 9f1a5fb..247c379 100644 --- a/src/protocol_misc.c +++ b/src/protocol_misc.c @@ -1,7 +1,7 @@ /* protocol_misc.c -- handle the meta-protocol, miscellaneous functions - Copyright (C) 1999-2002 Ivo Timmermans , - 2000-2002 Guus Sliepen + Copyright (C) 1999-2004 Ivo Timmermans , + 2000-2004 Guus Sliepen 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 @@ -17,182 +17,165 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: protocol_misc.c,v 1.1.4.3 2002/03/23 20:21:10 guus Exp $ + $Id: protocol_misc.c 1374 2004-03-21 14:21:22Z guus $ */ -#include "config.h" - -#include -#include -#include -#include -#include -#include - -#include - -#include "conf.h" -#include "net.h" -#include "netutl.h" -#include "protocol.h" -#include "meta.h" -#include "connection.h" - #include "system.h" +#include "conf.h" +#include "connection.h" +#include "logger.h" +#include "meta.h" +#include "net.h" +#include "netutl.h" +#include "protocol.h" +#include "utils.h" + /* Status and error notification routines */ -int send_status(connection_t *c, int statusno, char *statusstring) +bool send_status(connection_t *c, int statusno, const char *statusstring) { -cp - if(!statusstring) - statusstring = status_text[statusno]; -cp - return send_request(c, "%d %d %s", STATUS, statusno, statusstring); + cp(); + + if(!statusstring) + statusstring = "Status"; + + return send_request(c, "%d %d %s", STATUS, statusno, statusstring); } -int status_h(connection_t *c) +bool status_h(connection_t *c) { - int statusno; - char statusstring[MAX_STRING_SIZE]; -cp - if(sscanf(c->buffer, "%*d %d "MAX_STRING, &statusno, statusstring) != 2) - { - syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "STATUS", - c->name, c->hostname); - return -1; - } + int statusno; + char statusstring[MAX_STRING_SIZE]; - if(debug_lvl >= DEBUG_STATUS) - { - syslog(LOG_NOTICE, _("Status message from %s (%s): %s: %s"), - c->name, c->hostname, status_text[statusno], statusstring); - } + cp(); -cp - return 0; + if(sscanf(c->buffer, "%*d %d " MAX_STRING, &statusno, statusstring) != 2) { + logger(LOG_ERR, _("Got bad %s from %s (%s)"), "STATUS", + c->name, c->hostname); + return false; + } + + ifdebug(STATUS) logger(LOG_NOTICE, _("Status message from %s (%s): %d: %s"), + c->name, c->hostname, statusno, statusstring); + + return true; } -int send_error(connection_t *c, int err, char *errstring) +bool send_error(connection_t *c, int err, const char *errstring) { -cp - if(!errstring) - errstring = strerror(err); - return send_request(c, "%d %d %s", ERROR, err, errstring); + cp(); + + if(!errstring) + errstring = "Error"; + + return send_request(c, "%d %d %s", ERROR, err, errstring); } -int error_h(connection_t *c) +bool error_h(connection_t *c) { - int err; - char errorstring[MAX_STRING_SIZE]; -cp - if(sscanf(c->buffer, "%*d %d "MAX_STRING, &err, errorstring) != 2) - { - syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "ERROR", - c->name, c->hostname); - return -1; - } + int err; + char errorstring[MAX_STRING_SIZE]; - if(debug_lvl >= DEBUG_ERROR) - { - syslog(LOG_NOTICE, _("Error message from %s (%s): %s: %s"), - c->name, c->hostname, strerror(err), errorstring); - } + cp(); - terminate_connection(c, c->status.active); -cp - return 0; + if(sscanf(c->buffer, "%*d %d " MAX_STRING, &err, errorstring) != 2) { + logger(LOG_ERR, _("Got bad %s from %s (%s)"), "ERROR", + c->name, c->hostname); + return false; + } + + ifdebug(ERROR) logger(LOG_NOTICE, _("Error message from %s (%s): %d: %s"), + c->name, c->hostname, err, errorstring); + + terminate_connection(c, c->status.active); + + return true; } -int send_termreq(connection_t *c) +bool send_termreq(connection_t *c) { -cp - return send_request(c, "%d", TERMREQ); + cp(); + + return send_request(c, "%d", TERMREQ); } -int termreq_h(connection_t *c) +bool termreq_h(connection_t *c) { -cp - terminate_connection(c, c->status.active); -cp - return 0; + cp(); + + terminate_connection(c, c->status.active); + + return true; } -int send_ping(connection_t *c) +bool send_ping(connection_t *c) { -cp - c->status.pinged = 1; - c->last_ping_time = now; -cp - return send_request(c, "%d", PING); + cp(); + + c->status.pinged = true; + c->last_ping_time = now; + + return send_request(c, "%d", PING); } -int ping_h(connection_t *c) +bool ping_h(connection_t *c) { -cp - return send_pong(c); + cp(); + + return send_pong(c); } -int send_pong(connection_t *c) +bool send_pong(connection_t *c) { -cp - return send_request(c, "%d", PONG); + cp(); + + return send_request(c, "%d", PONG); } -int pong_h(connection_t *c) +bool pong_h(connection_t *c) { -cp - c->status.pinged = 0; + cp(); - /* Succesful connection, reset timeout if this is an outgoing connection. */ - - if(c->outgoing) - c->outgoing->timeout = 0; -cp - return 0; + c->status.pinged = false; + + /* Succesful connection, reset timeout if this is an outgoing connection. */ + + if(c->outgoing) + c->outgoing->timeout = 0; + + return true; } /* Sending and receiving packets via TCP */ -int send_tcppacket(connection_t *c, vpn_packet_t *packet) +bool send_tcppacket(connection_t *c, vpn_packet_t *packet) { - int x; -cp - /* Evil hack. */ + cp(); - x = send_request(c, "%d %hd", PACKET, packet->len); + /* Evil hack. */ - if(x) - return x; -cp - return send_meta(c, packet->data, packet->len); + if(!send_request(c, "%d %hd", PACKET, packet->len)) + return false; + + return send_meta(c, packet->data, packet->len); } -int tcppacket_h(connection_t *c) +bool tcppacket_h(connection_t *c) { - short int len; -cp - if(sscanf(c->buffer, "%*d %hd", &len) != 1) - { - syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "PACKET", c->name, c->hostname); - return -1; - } + short int len; - /* Set reqlen to len, this will tell receive_meta() that a tcppacket is coming. */ + cp(); - c->tcplen = len; -cp - return 0; + if(sscanf(c->buffer, "%*d %hd", &len) != 1) { + logger(LOG_ERR, _("Got bad %s from %s (%s)"), "PACKET", c->name, + c->hostname); + return false; + } + + /* Set reqlen to len, this will tell receive_meta() that a tcppacket is coming. */ + + c->tcplen = len; + + return true; } - -/* Status strings */ - -char (*status_text[]) = { - "Warning", -}; - -/* Error strings */ - -char (*error_text[]) = { - "Error", -}; diff --git a/src/protocol_subnet.c b/src/protocol_subnet.c index 7f6cfc1..2fe66db 100644 --- a/src/protocol_subnet.c +++ b/src/protocol_subnet.c @@ -1,7 +1,7 @@ /* protocol_subnet.c -- handle the meta-protocol, subnets - Copyright (C) 1999-2002 Ivo Timmermans , - 2000-2002 Guus Sliepen + Copyright (C) 1999-2004 Ivo Timmermans , + 2000-2004 Guus Sliepen 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 @@ -17,221 +17,219 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: protocol_subnet.c,v 1.1.4.3 2002/03/22 13:31:18 guus Exp $ + $Id: protocol_subnet.c 1374 2004-03-21 14:21:22Z guus $ */ -#include "config.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "conf.h" -#include "net.h" -#include "netutl.h" -#include "protocol.h" -#include "meta.h" -#include "connection.h" -#include "node.h" -#include "edge.h" -#include "graph.h" - #include "system.h" -int send_add_subnet(connection_t *c, subnet_t *subnet) +#include "conf.h" +#include "connection.h" +#include "logger.h" +#include "net.h" +#include "netutl.h" +#include "node.h" +#include "protocol.h" +#include "subnet.h" +#include "utils.h" +#include "xalloc.h" + +bool send_add_subnet(connection_t *c, const subnet_t *subnet) { - int x; - char *netstr; -cp - x = send_request(c, "%d %lx %s %s", ADD_SUBNET, random(), - subnet->owner->name, netstr = net2str(subnet)); - free(netstr); -cp - return x; + char netstr[MAXNETSTR]; + + cp(); + + if(!net2str(netstr, sizeof netstr, subnet)) + return false; + + return send_request(c, "%d %lx %s %s", ADD_SUBNET, random(), subnet->owner->name, netstr); } -int add_subnet_h(connection_t *c) +bool add_subnet_h(connection_t *c) { - char subnetstr[MAX_STRING_SIZE]; - char name[MAX_STRING_SIZE]; - node_t *owner; - connection_t *other; - subnet_t *s; - avl_node_t *node; -cp - if(sscanf(c->buffer, "%*d %*x "MAX_STRING" "MAX_STRING, name, subnetstr) != 2) - { - syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "ADD_SUBNET", c->name, c->hostname); - return -1; - } + char subnetstr[MAX_STRING_SIZE]; + char name[MAX_STRING_SIZE]; + node_t *owner; + subnet_t s = {0}, *new; - /* Check if owner name is a valid */ + cp(); - if(check_id(name)) - { - syslog(LOG_ERR, _("Got bad %s from %s (%s): %s"), "ADD_SUBNET", c->name, c->hostname, _("invalid name")); - return -1; - } + if(sscanf(c->buffer, "%*d %*x " MAX_STRING " " MAX_STRING, name, subnetstr) != 2) { + logger(LOG_ERR, _("Got bad %s from %s (%s)"), "ADD_SUBNET", c->name, + c->hostname); + return false; + } - /* Check if subnet string is valid */ + /* Check if owner name is a valid */ - if(!(s = str2net(subnetstr))) - { - syslog(LOG_ERR, _("Got bad %s from %s (%s): %s"), "ADD_SUBNET", c->name, c->hostname, _("invalid subnet string")); - return -1; - } + if(!check_id(name)) { + logger(LOG_ERR, _("Got bad %s from %s (%s): %s"), "ADD_SUBNET", c->name, + c->hostname, _("invalid name")); + return false; + } - if(seen_request(c->buffer)) - return 0; - - /* Check if the owner of the new subnet is in the connection list */ + /* Check if subnet string is valid */ - owner = lookup_node(name); + if(!str2net(&s, subnetstr)) { + logger(LOG_ERR, _("Got bad %s from %s (%s): %s"), "ADD_SUBNET", c->name, + c->hostname, _("invalid subnet string")); + return false; + } - if(!owner) - { - owner = new_node(); - owner->name = xstrdup(name); - node_add(owner); - } + if(seen_request(c->buffer)) + return true; - /* Check if we already know this subnet */ - - if(lookup_subnet(owner, s)) - { - free_subnet(s); - return 0; - } + /* Check if the owner of the new subnet is in the connection list */ - /* If we don't know this subnet, but we are the owner, retaliate with a DEL_SUBNET */ + owner = lookup_node(name); - if(owner == myself) - { - if(debug_lvl >= DEBUG_PROTOCOL) - syslog(LOG_WARNING, _("Got %s from %s (%s) for ourself"), "ADD_SUBNET", c->name, c->hostname); - s->owner = myself; - send_del_subnet(c, s); - return 0; - } + if(!owner) { + owner = new_node(); + owner->name = xstrdup(name); + node_add(owner); + } - /* If everything is correct, add the subnet to the list of the owner */ + if(tunnelserver && owner != myself && owner != c->node) + return false; - subnet_add(owner, s); + /* Check if we already know this subnet */ - /* Tell the rest */ - - for(node = connection_tree->head; node; node = node->next) - { - other = (connection_t *)node->data; - if(other->status.active && other != c) - send_request(other, "%s", c->buffer); - } -cp - return 0; + if(lookup_subnet(owner, &s)) + return true; + + /* If we don't know this subnet, but we are the owner, retaliate with a DEL_SUBNET */ + + if(owner == myself) { + ifdebug(PROTOCOL) logger(LOG_WARNING, _("Got %s from %s (%s) for ourself"), + "ADD_SUBNET", c->name, c->hostname); + s.owner = myself; + send_del_subnet(c, &s); + return true; + } + + /* In tunnel server mode, check if the subnet matches one in the config file of this node */ + + if(tunnelserver) { + config_t *cfg; + subnet_t *allowed; + + for(cfg = lookup_config(c->config_tree, "Subnet"); cfg; cfg = lookup_config_next(c->config_tree, cfg)) { + if(!get_config_subnet(cfg, &allowed)) + return false; + + if(!subnet_compare(&s, allowed)) + break; + + free_subnet(allowed); + } + + if(!cfg) + return false; + + free_subnet(allowed); + } + + /* If everything is correct, add the subnet to the list of the owner */ + + *(new = new_subnet()) = s; + subnet_add(owner, new); + + /* Tell the rest */ + + if(!tunnelserver) + forward_request(c); + + return true; } -int send_del_subnet(connection_t *c, subnet_t *s) +bool send_del_subnet(connection_t *c, const subnet_t *s) { - int x; - char *netstr; -cp - netstr = net2str(s); - x = send_request(c, "%d %lx %s %s", DEL_SUBNET, random(), s->owner->name, netstr); - free(netstr); -cp - return x; + char netstr[MAXNETSTR]; + + cp(); + + if(!net2str(netstr, sizeof netstr, s)) + return false; + + return send_request(c, "%d %lx %s %s", DEL_SUBNET, random(), s->owner->name, netstr); } -int del_subnet_h(connection_t *c) +bool del_subnet_h(connection_t *c) { - char subnetstr[MAX_STRING_SIZE]; - char name[MAX_STRING_SIZE]; - node_t *owner; - connection_t *other; - subnet_t *s, *find; - avl_node_t *node; -cp - if(sscanf(c->buffer, "%*d %*x "MAX_STRING" "MAX_STRING, name, subnetstr) != 2) - { - syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "DEL_SUBNET", c->name, c->hostname); - return -1; - } + char subnetstr[MAX_STRING_SIZE]; + char name[MAX_STRING_SIZE]; + node_t *owner; + subnet_t s = {0}, *find; - /* Check if owner name is a valid */ + cp(); - if(check_id(name)) - { - syslog(LOG_ERR, _("Got bad %s from %s (%s): %s"), "DEL_SUBNET", c->name, c->hostname, _("invalid name")); - return -1; - } + if(sscanf(c->buffer, "%*d %*x " MAX_STRING " " MAX_STRING, name, subnetstr) != 2) { + logger(LOG_ERR, _("Got bad %s from %s (%s)"), "DEL_SUBNET", c->name, + c->hostname); + return false; + } - /* Check if the owner of the new subnet is in the connection list */ + /* Check if owner name is a valid */ - if(!(owner = lookup_node(name))) - { - if(debug_lvl >= DEBUG_PROTOCOL) - syslog(LOG_WARNING, _("Got %s from %s (%s) for %s which is not in our node tree"), - "DEL_SUBNET", c->name, c->hostname, name); - return 0; - } + if(!check_id(name)) { + logger(LOG_ERR, _("Got bad %s from %s (%s): %s"), "DEL_SUBNET", c->name, + c->hostname, _("invalid name")); + return false; + } - /* Check if subnet string is valid */ + /* Check if the owner of the new subnet is in the connection list */ - if(!(s = str2net(subnetstr))) - { - syslog(LOG_ERR, _("Got bad %s from %s (%s): %s"), "DEL_SUBNET", c->name, c->hostname, _("invalid subnet string")); - return -1; - } + owner = lookup_node(name); - if(seen_request(c->buffer)) - return 0; + if(!owner) { + ifdebug(PROTOCOL) logger(LOG_WARNING, _("Got %s from %s (%s) for %s which is not in our node tree"), + "DEL_SUBNET", c->name, c->hostname, name); + return true; + } - /* If everything is correct, delete the subnet from the list of the owner */ + if(tunnelserver && owner != myself && owner != c->node) + return false; - s->owner = owner; + /* Check if subnet string is valid */ - find = lookup_subnet(owner, s); - - free_subnet(s); + if(!str2net(&s, subnetstr)) { + logger(LOG_ERR, _("Got bad %s from %s (%s): %s"), "DEL_SUBNET", c->name, + c->hostname, _("invalid subnet string")); + return false; + } - if(!find) - { - if(debug_lvl >= DEBUG_PROTOCOL) - syslog(LOG_WARNING, _("Got %s from %s (%s) for %s which does not appear in his subnet tree"), - "DEL_SUBNET", c->name, c->hostname, name); - return 0; - } - - /* If we are the owner of this subnet, retaliate with an ADD_SUBNET */ - - if(owner == myself) - { - if(debug_lvl >= DEBUG_PROTOCOL) - syslog(LOG_WARNING, _("Got %s from %s (%s) for ourself"), "DEL_SUBNET", c->name, c->hostname); - send_add_subnet(c, find); - return 0; - } + if(seen_request(c->buffer)) + return true; - /* Tell the rest */ - - for(node = connection_tree->head; node; node = node->next) - { - other = (connection_t *)node->data; - if(other->status.active && other != c) - send_request(other, "%s", c->buffer); - } + /* If everything is correct, delete the subnet from the list of the owner */ - /* Finally, delete it. */ + s.owner = owner; - subnet_del(owner, find); + find = lookup_subnet(owner, &s); -cp - return 0; + if(!find) { + ifdebug(PROTOCOL) logger(LOG_WARNING, _("Got %s from %s (%s) for %s which does not appear in his subnet tree"), + "DEL_SUBNET", c->name, c->hostname, name); + return true; + } + + /* If we are the owner of this subnet, retaliate with an ADD_SUBNET */ + + if(owner == myself) { + ifdebug(PROTOCOL) logger(LOG_WARNING, _("Got %s from %s (%s) for ourself"), + "DEL_SUBNET", c->name, c->hostname); + send_add_subnet(c, find); + return true; + } + + /* Tell the rest */ + + if(!tunnelserver) + forward_request(c); + + /* Finally, delete it. */ + + subnet_del(owner, find); + + return true; } diff --git a/src/raw_socket/device.c b/src/raw_socket/device.c new file mode 100644 index 0000000..82d70ad --- /dev/null +++ b/src/raw_socket/device.c @@ -0,0 +1,142 @@ +/* + device.c -- raw socket + Copyright (C) 2002-2004 Ivo Timmermans , + 2002-2004 Guus Sliepen + + 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., 675 Mass Ave, Cambridge, MA 02139, USA. + + $Id: device.c 1405 2004-11-08 22:11:33Z guus $ +*/ + +#include "system.h" + +#include + +#include "conf.h" +#include "net.h" +#include "logger.h" +#include "utils.h" +#include "route.h" + +int device_fd = -1; +char *device; +char *iface; +char ifrname[IFNAMSIZ]; +char *device_info; + +static int device_total_in = 0; +static int device_total_out = 0; + +bool setup_device(void) +{ + struct ifreq ifr; + struct sockaddr_ll sa; + + cp(); + + if(!get_config_string + (lookup_config(config_tree, "Interface"), &iface)) + iface = "eth0"; + + if(!get_config_string(lookup_config(config_tree, "Device"), &device)) + device = iface; + + device_info = _("raw socket"); + + if((device_fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL))) < 0) { + logger(LOG_ERR, _("Could not open %s: %s"), device_info, + strerror(errno)); + return false; + } + + memset(&ifr, 0, sizeof(ifr)); + strncpy(ifr.ifr_ifrn.ifrn_name, iface, IFNAMSIZ); + if(ioctl(device_fd, SIOCGIFINDEX, &ifr)) { + close(device_fd); + logger(LOG_ERR, _("Can't find interface %s: %s"), iface, + strerror(errno)); + return false; + } + + memset(&sa, '0', sizeof(sa)); + sa.sll_family = AF_PACKET; + sa.sll_protocol = htons(ETH_P_ALL); + sa.sll_ifindex = ifr.ifr_ifindex; + + if(bind(device_fd, (struct sockaddr *) &sa, (socklen_t) sizeof(sa))) { + logger(LOG_ERR, _("Could not bind %s to %s: %s"), device, iface, strerror(errno)); + return false; + } + + logger(LOG_INFO, _("%s is a %s"), device, device_info); + + return true; +} + +void close_device(void) +{ + cp(); + + close(device_fd); +} + +bool read_packet(vpn_packet_t *packet) +{ + int lenin; + + cp(); + + if((lenin = read(device_fd, packet->data, MTU)) <= 0) { + logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, + device, strerror(errno)); + return false; + } + + packet->len = lenin; + + device_total_in += packet->len; + + ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Read packet of %d bytes from %s"), packet->len, + device_info); + + return true; +} + +bool write_packet(vpn_packet_t *packet) +{ + cp(); + + ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Writing packet of %d bytes to %s"), + packet->len, device_info); + + if(write(device_fd, packet->data, packet->len) < 0) { + logger(LOG_ERR, _("Can't write to %s %s: %s"), device_info, device, + strerror(errno)); + return false; + } + + device_total_out += packet->len; + + return true; +} + +void dump_device_stats(void) +{ + cp(); + + logger(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device); + logger(LOG_DEBUG, _(" total bytes in: %10d"), device_total_in); + logger(LOG_DEBUG, _(" total bytes out: %10d"), device_total_out); +} diff --git a/src/route.c b/src/route.c index dcf43e4..0ee5e45 100644 --- a/src/route.c +++ b/src/route.c @@ -1,7 +1,7 @@ /* route.c -- routing - Copyright (C) 2000-2002 Ivo Timmermans , - 2000-2002 Guus Sliepen + Copyright (C) 2000-2004 Ivo Timmermans , + 2000-2004 Guus Sliepen 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 @@ -17,477 +17,735 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: route.c,v 1.1.2.37 2002/03/19 00:08:23 guus Exp $ + $Id: route.c 1411 2004-11-10 19:36:02Z guus $ */ -#include "config.h" - -#if defined(HAVE_FREEBSD) || defined(HAVE_OPENBSD) - #include -#endif -#include -#include -#if defined(HAVE_SOLARIS) || defined(HAVE_OPENBSD) - #include - #define ETHER_ADDR_LEN 6 -#else - #include -#endif -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "net.h" -#include "connection.h" -#include "subnet.h" -#include "route.h" -#include "protocol.h" -#include "device.h" - #include "system.h" -int routing_mode = RMODE_ROUTER; -int priorityinheritance = 0; +#include "avl_tree.h" +#include "connection.h" +#include "ethernet.h" +#include "ipv4.h" +#include "ipv6.h" +#include "logger.h" +#include "net.h" +#include "protocol.h" +#include "route.h" +#include "subnet.h" +#include "utils.h" + +rmode_t routing_mode = RMODE_ROUTER; +bool priorityinheritance = false; int macexpire = 600; -subnet_t mymac; +bool overwrite_mac = false; +mac_t mymac = {{0xFE, 0xFD, 0, 0, 0, 0}}; -void learn_mac(mac_t *address) +/* Sizes of various headers */ + +static const size_t ether_size = sizeof(struct ether_header); +static const size_t arp_size = sizeof(struct ether_arp); +static const size_t ip_size = sizeof(struct ip); +static const size_t icmp_size = sizeof(struct icmp) - sizeof(struct ip); +static const size_t ip6_size = sizeof(struct ip6_hdr); +static const size_t icmp6_size = sizeof(struct icmp6_hdr); +static const size_t ns_size = sizeof(struct nd_neighbor_solicit); +static const size_t opt_size = sizeof(struct nd_opt_hdr); + +/* RFC 1071 */ + +static uint16_t inet_checksum(void *data, int len, uint16_t prevsum) { - subnet_t *subnet; - avl_node_t *node; - connection_t *c; -cp - subnet = lookup_subnet_mac(address); + uint16_t *p = data; + uint32_t checksum = prevsum ^ 0xFFFF; - /* If we don't know this MAC address yet, store it */ - - if(!subnet || subnet->owner!=myself) - { - if(debug_lvl >= DEBUG_TRAFFIC) - syslog(LOG_INFO, _("Learned new MAC address %hx:%hx:%hx:%hx:%hx:%hx"), - address->x[0], address->x[1], address->x[2], address->x[3], address->x[4], address->x[5]); - - subnet = new_subnet(); - subnet->type = SUBNET_MAC; - memcpy(&subnet->net.mac.address, address, sizeof(mac_t)); - subnet_add(myself, subnet); - - /* And tell all other tinc daemons it's our MAC */ - - for(node = connection_tree->head; node; node = node->next) - { - c = (connection_t *)node->data; - if(c->status.active) - send_add_subnet(c, subnet); - } - } - - subnet->net.mac.lastseen = now; -} - -void age_mac(void) -{ - subnet_t *s; - connection_t *c; - avl_node_t *node, *next, *node2; -cp - for(node = myself->subnet_tree->head; node; node = next) - { - next = node->next; - s = (subnet_t *)node->data; - if(s->type == SUBNET_MAC && s->net.mac.lastseen && s->net.mac.lastseen + macexpire < now) - { - if(debug_lvl >= DEBUG_TRAFFIC) - syslog(LOG_INFO, _("MAC address %hx:%hx:%hx:%hx:%hx:%hx expired"), - s->net.mac.address.x[0], s->net.mac.address.x[1], s->net.mac.address.x[2], s->net.mac.address.x[3], s->net.mac.address.x[4], s->net.mac.address.x[5]); - for(node2 = connection_tree->head; node2; node2 = node2->next) - { - c = (connection_t *)node2->data; - if(c->status.active) - send_del_subnet(c, s); - } - subnet_del(myself, s); + while(len >= 2) { + checksum += *p++; + len -= 2; } - } -cp + + if(len) + checksum += *(uint8_t *)p; + + while(checksum >> 16) + checksum = (checksum & 0xFFFF) + (checksum >> 16); + + return ~checksum; } -node_t *route_mac(vpn_packet_t *packet) -{ - subnet_t *subnet; -cp - /* Learn source address */ +static bool ratelimit(int frequency) { + static time_t lasttime = 0; + static int count = 0; + + if(lasttime == now) { + if(++count > frequency) + return true; + } else { + lasttime = now; + count = 0; + } - learn_mac((mac_t *)(&packet->data[6])); - - /* Lookup destination address */ - - subnet = lookup_subnet_mac((mac_t *)(&packet->data[0])); - - if(subnet) - return subnet->owner; - else - return NULL; + return false; } -node_t *route_ipv4(vpn_packet_t *packet) -{ - subnet_t *subnet; -cp - if(priorityinheritance) - packet->priority = packet->data[15]; - - subnet = lookup_subnet_ipv4((ipv4_t *)&packet->data[30]); -cp - if(!subnet) - { - if(debug_lvl >= DEBUG_TRAFFIC) - { - syslog(LOG_WARNING, _("Cannot route packet: unknown IPv4 destination address %d.%d.%d.%d"), - packet->data[30], packet->data[31], packet->data[32], packet->data[33]); - } - - return NULL; - } -cp - return subnet->owner; +static bool checklength(node_t *source, vpn_packet_t *packet, length_t length) { + if(packet->len < length) { + ifdebug(TRAFFIC) logger(LOG_WARNING, _("Got too short packet from %s (%s)"), source->name, source->hostname); + return false; + } else + return true; } - -node_t *route_ipv6(vpn_packet_t *packet) + +static void learn_mac(mac_t *address) { - subnet_t *subnet; -cp - subnet = lookup_subnet_ipv6((ipv6_t *)&packet->data[38]); -cp - if(!subnet) - { - if(debug_lvl >= DEBUG_TRAFFIC) - { - syslog(LOG_WARNING, _("Cannot route packet: unknown IPv6 destination address %hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx"), - ntohs(*(short unsigned int *)&packet->data[38]), - ntohs(*(short unsigned int *)&packet->data[40]), - ntohs(*(short unsigned int *)&packet->data[42]), - ntohs(*(short unsigned int *)&packet->data[44]), - ntohs(*(short unsigned int *)&packet->data[46]), - ntohs(*(short unsigned int *)&packet->data[48]), - ntohs(*(short unsigned int *)&packet->data[50]), - ntohs(*(short unsigned int *)&packet->data[52])); - } + subnet_t *subnet; + avl_node_t *node; + connection_t *c; - return NULL; - } -cp - return subnet->owner; -} + cp(); -unsigned short int inet_checksum(unsigned short int *data, int len, unsigned short int prevsum) -{ - unsigned long int checksum = prevsum ^ 0xFFFF; + subnet = lookup_subnet_mac(address); - while(len--) - checksum += ntohs(*data++); + /* If we don't know this MAC address yet, store it */ - while(checksum >> 16) - checksum = (checksum & 0xFFFF) + (checksum >> 16); + if(!subnet) { + ifdebug(TRAFFIC) logger(LOG_INFO, _("Learned new MAC address %hx:%hx:%hx:%hx:%hx:%hx"), + address->x[0], address->x[1], address->x[2], address->x[3], + address->x[4], address->x[5]); - return checksum ^ 0xFFFF; -} + subnet = new_subnet(); + subnet->type = SUBNET_MAC; + subnet->expires = now + macexpire; + subnet->net.mac.address = *address; + subnet_add(myself, subnet); -void route_neighborsol(vpn_packet_t *packet) -{ - struct ip6_hdr *hdr; - struct nd_neighbor_solicit *ns; - struct nd_opt_hdr *opt; - subnet_t *subnet; - short unsigned int checksum; - - struct { - struct in6_addr ip6_src; /* source address */ - struct in6_addr ip6_dst; /* destination address */ - uint32_t length; - uint8_t junk[4]; - } pseudo; + /* And tell all other tinc daemons it's our MAC */ -cp - hdr = (struct ip6_hdr *)(packet->data + 14); - ns = (struct nd_neighbor_solicit *)(packet->data + 14 + sizeof(*hdr)); - opt = (struct nd_opt_hdr *)(packet->data + 14 + sizeof(*hdr) + sizeof(*ns)); - - /* First, snatch the source address from the neighbor solicitation packet */ - - memcpy(mymac.net.mac.address.x, packet->data + 6, 6); - - /* Check if this is a valid neighbor solicitation request */ - - if(ns->nd_ns_hdr.icmp6_type != ND_NEIGHBOR_SOLICIT || - opt->nd_opt_type != ND_OPT_SOURCE_LINKADDR) - { - if(debug_lvl > DEBUG_TRAFFIC) - { - syslog(LOG_WARNING, _("Cannot route packet: received unknown type neighbor solicitation request")); - } - return; - } - - /* Create pseudo header */ - - memcpy(&pseudo.ip6_src, &hdr->ip6_src, 16); - memcpy(&pseudo.ip6_dst, &hdr->ip6_dst, 16); - pseudo.length = htonl(sizeof(*ns) + sizeof(*opt) + 6); - pseudo.junk[0] = pseudo.junk[1] = pseudo.junk[2] = 0; - pseudo.junk[3] = IPPROTO_ICMPV6; - - /* Generate checksum */ - - checksum = inet_checksum((unsigned short int *)&pseudo, sizeof(pseudo)/2, ~0); - checksum = inet_checksum((unsigned short int *)ns, sizeof(*ns)/2 + 4, checksum); - - if(checksum) - { - if(debug_lvl >= DEBUG_TRAFFIC) - syslog(LOG_WARNING, _("Cannot route packet: checksum error for neighbor solicitation request")); - return; - } - - /* Check if the IPv6 address exists on the VPN */ - - subnet = lookup_subnet_ipv6((ipv6_t *)&ns->nd_ns_target); - - if(!subnet) - { - if(debug_lvl >= DEBUG_TRAFFIC) - { - syslog(LOG_WARNING, _("Cannot route packet: neighbor solicitation request for unknown address %hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx"), - ntohs(((uint16_t *)&ns->nd_ns_target)[0]), ntohs(((uint16_t *)&ns->nd_ns_target)[1]), ntohs(((uint16_t *)&ns->nd_ns_target)[2]), ntohs(((uint16_t *)&ns->nd_ns_target)[3]), - ntohs(((uint16_t *)&ns->nd_ns_target)[4]), ntohs(((uint16_t *)&ns->nd_ns_target)[5]), ntohs(((uint16_t *)&ns->nd_ns_target)[6]), ntohs(((uint16_t *)&ns->nd_ns_target)[7])); - } - - return; - } - - /* Check if it is for our own subnet */ - - if(subnet->owner == myself) - return; /* silently ignore */ - - /* Create neighbor advertation reply */ - - memcpy(packet->data, packet->data + ETHER_ADDR_LEN, ETHER_ADDR_LEN); /* copy destination address */ - packet->data[ETHER_ADDR_LEN*2 - 1] ^= 0xFF; /* mangle source address so it looks like it's not from us */ - - memcpy(&hdr->ip6_dst, &hdr->ip6_src, 16); /* swap destination and source protocol address */ - memcpy(&hdr->ip6_src, &ns->nd_ns_target, 16); /* ... */ - - memcpy((char *)opt + sizeof(*opt), packet->data + ETHER_ADDR_LEN, 6); /* add fake source hard addr */ - - ns->nd_ns_hdr.icmp6_cksum = 0; - ns->nd_ns_hdr.icmp6_type = ND_NEIGHBOR_ADVERT; - ns->nd_ns_hdr.icmp6_dataun.icmp6_un_data8[0] = 0x40; /* Set solicited flag */ - ns->nd_ns_hdr.icmp6_dataun.icmp6_un_data8[1] = ns->nd_ns_hdr.icmp6_dataun.icmp6_un_data8[2] = ns->nd_ns_hdr.icmp6_dataun.icmp6_un_data8[3] = 0; - opt->nd_opt_type = ND_OPT_TARGET_LINKADDR; - - /* Create pseudo header */ - - memcpy(&pseudo.ip6_src, &hdr->ip6_src, 16); - memcpy(&pseudo.ip6_dst, &hdr->ip6_dst, 16); - pseudo.length = htonl(sizeof(*ns) + sizeof(*opt) + 6); - pseudo.junk[0] = pseudo.junk[1] = pseudo.junk[2] = 0; - pseudo.junk[3] = IPPROTO_ICMPV6; - - /* Generate checksum */ - - checksum = inet_checksum((unsigned short int *)&pseudo, sizeof(pseudo)/2, ~0); - checksum = inet_checksum((unsigned short int *)ns, sizeof(*ns)/2 + 4, checksum); - - ns->nd_ns_hdr.icmp6_cksum = htons(checksum); - - write_packet(packet); -cp -} - -void route_arp(vpn_packet_t *packet) -{ - struct ether_arp *arp; - subnet_t *subnet; - unsigned char ipbuf[4]; -cp - /* First, snatch the source address from the ARP packet */ - - memcpy(mymac.net.mac.address.x, packet->data + 6, 6); - - /* This routine generates replies to ARP requests. - You don't need to set NOARP flag on the interface anymore (which is broken on FreeBSD). - Most of the code here is taken from choparp.c by Takamichi Tateoka (tree@mma.club.uec.ac.jp) - */ - - arp = (struct ether_arp *)(packet->data + 14); - - /* Check if this is a valid ARP request */ - - if(ntohs(arp->arp_hrd) != ARPHRD_ETHER || - ntohs(arp->arp_pro) != ETHERTYPE_IP || - (int) (arp->arp_hln) != ETHER_ADDR_LEN || - (int) (arp->arp_pln) != 4 || - ntohs(arp->arp_op) != ARPOP_REQUEST ) - { - if(debug_lvl > DEBUG_TRAFFIC) - { - syslog(LOG_WARNING, _("Cannot route packet: received unknown type ARP request")); - } - return; - } - - /* Check if the IPv4 address exists on the VPN */ - - subnet = lookup_subnet_ipv4((ipv4_t *)arp->arp_tpa); - - if(!subnet) - { - if(debug_lvl >= DEBUG_TRAFFIC) - { - syslog(LOG_WARNING, _("Cannot route packet: ARP request for unknown address %d.%d.%d.%d"), - arp->arp_tpa[0], arp->arp_tpa[1], arp->arp_tpa[2], arp->arp_tpa[3]); - } - - return; - } - - /* Check if it is for our own subnet */ - - if(subnet->owner == myself) - return; /* silently ignore */ - - memcpy(packet->data, packet->data + ETHER_ADDR_LEN, ETHER_ADDR_LEN); /* copy destination address */ - packet->data[ETHER_ADDR_LEN*2 - 1] ^= 0xFF; /* mangle source address so it looks like it's not from us */ - - memcpy(ipbuf, arp->arp_tpa, 4); /* save protocol addr */ - memcpy(arp->arp_tpa, arp->arp_spa, 4); /* swap destination and source protocol address */ - memcpy(arp->arp_spa, ipbuf, 4); /* ... */ - - memcpy(arp->arp_tha, arp->arp_sha, 10); /* set target hard/proto addr */ - memcpy(arp->arp_sha, packet->data + ETHER_ADDR_LEN, ETHER_ADDR_LEN); /* add fake source hard addr */ - arp->arp_op = htons(ARPOP_REPLY); - - write_packet(packet); -cp -} - -void route_outgoing(vpn_packet_t *packet) -{ - unsigned short int type; - node_t *n = NULL; -cp - /* FIXME: multicast? */ - - switch(routing_mode) - { - case RMODE_ROUTER: - type = ntohs(*((unsigned short*)(&packet->data[12]))); - switch(type) - { - case 0x0800: - n = route_ipv4(packet); - break; - case 0x86DD: - if(packet->data[20] == IPPROTO_ICMPV6 && packet->data[54] == ND_NEIGHBOR_SOLICIT) - { - route_neighborsol(packet); - return; + for(node = connection_tree->head; node; node = node->next) { + c = node->data; + if(c->status.active) + send_add_subnet(c, subnet); } - n = route_ipv6(packet); - break; - case 0x0806: - route_arp(packet); - return; - default: - if(debug_lvl >= DEBUG_TRAFFIC) - { - syslog(LOG_WARNING, _("Cannot route packet: unknown type %hx"), type); - } - return; - } - if(n) - send_packet(n, packet); - break; - - case RMODE_SWITCH: - n = route_mac(packet); - if(n) - send_packet(n, packet); - else - broadcast_packet(myself, packet); - break; - - case RMODE_HUB: - broadcast_packet(myself, packet); - break; - } + } + + if(subnet->expires) + subnet->expires = now + macexpire; } -void route_incoming(node_t *source, vpn_packet_t *packet) +void age_subnets(void) { - switch(routing_mode) - { - case RMODE_ROUTER: - { - node_t *n = NULL; - unsigned short int type; + subnet_t *s; + connection_t *c; + avl_node_t *node, *next, *node2; - type = ntohs(*((unsigned short*)(&packet->data[12]))); - switch(type) - { - case 0x0800: - n = route_ipv4(packet); - break; - case 0x86DD: - n = route_ipv6(packet); - break; - default: - n = myself; - break; - } + cp(); - if(n) - { - if(n == myself) - { - memcpy(packet->data, mymac.net.mac.address.x, 6); - write_packet(packet); + for(node = myself->subnet_tree->head; node; node = next) { + next = node->next; + s = node->data; + if(s->expires && s->expires < now) { + ifdebug(TRAFFIC) { + char netstr[MAXNETSTR]; + if(net2str(netstr, sizeof netstr, s)) + logger(LOG_INFO, _("Subnet %s expired"), netstr); + } + + for(node2 = connection_tree->head; node2; node2 = node2->next) { + c = node2->data; + if(c->status.active) + send_del_subnet(c, s); + } + + subnet_del(myself, s); } - else - send_packet(n, packet); - } - } - break; - case RMODE_SWITCH: - { - subnet_t *subnet; - - subnet = lookup_subnet_mac((mac_t *)(&packet->data[0])); - - if(subnet) - { - if(subnet->owner == myself) - write_packet(packet); - else - send_packet(subnet->owner, packet); - } - else - { - broadcast_packet(source, packet); - write_packet(packet); - } - } - break; - case RMODE_HUB: - broadcast_packet(source, packet); /* Spread it on */ - write_packet(packet); - break; - } + } +} + +static void route_mac(node_t *source, vpn_packet_t *packet) +{ + subnet_t *subnet; + + cp(); + + /* Learn source address */ + + if(source == myself) + learn_mac((mac_t *)(&packet->data[6])); + + /* Lookup destination address */ + + subnet = lookup_subnet_mac((mac_t *)(&packet->data[0])); + + if(!subnet) { + broadcast_packet(source, packet); + return; + } + + if(subnet->owner == source) { + ifdebug(TRAFFIC) logger(LOG_WARNING, _("Packet looping back to %s (%s)!"), source->name, source->hostname); + return; + } + + send_packet(subnet->owner, packet); +} + +/* RFC 792 */ + +static void route_ipv4_unreachable(node_t *source, vpn_packet_t *packet, uint8_t type, uint8_t code) +{ + struct ip ip = {0}; + struct icmp icmp = {0}; + + struct in_addr ip_src; + struct in_addr ip_dst; + uint32_t oldlen; + + if(ratelimit(3)) + return; + + cp(); + + /* Copy headers from packet into properly aligned structs on the stack */ + + memcpy(&ip, packet->data + ether_size, ip_size); + + /* Remember original source and destination */ + + ip_src = ip.ip_src; + ip_dst = ip.ip_dst; + + oldlen = packet->len - ether_size; + + if(type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) + icmp.icmp_nextmtu = htons(packet->len - ether_size); + + if(oldlen >= IP_MSS - ip_size - icmp_size) + oldlen = IP_MSS - ip_size - icmp_size; + + /* Copy first part of original contents to ICMP message */ + + memmove(packet->data + ether_size + ip_size + icmp_size, packet->data + ether_size, oldlen); + + /* Fill in IPv4 header */ + + ip.ip_v = 4; + ip.ip_hl = ip_size / 4; + ip.ip_tos = 0; + ip.ip_len = htons(ip_size + icmp_size + oldlen); + ip.ip_id = 0; + ip.ip_off = 0; + ip.ip_ttl = 255; + ip.ip_p = IPPROTO_ICMP; + ip.ip_sum = 0; + ip.ip_src = ip_dst; + ip.ip_dst = ip_src; + + ip.ip_sum = inet_checksum(&ip, ip_size, ~0); + + /* Fill in ICMP header */ + + icmp.icmp_type = type; + icmp.icmp_code = code; + icmp.icmp_cksum = 0; + + icmp.icmp_cksum = inet_checksum(&icmp, icmp_size, ~0); + icmp.icmp_cksum = inet_checksum(packet->data + ether_size + ip_size + icmp_size, oldlen, icmp.icmp_cksum); + + /* Copy structs on stack back to packet */ + + memcpy(packet->data + ether_size, &ip, ip_size); + memcpy(packet->data + ether_size + ip_size, &icmp, icmp_size); + + packet->len = ether_size + ip_size + icmp_size + oldlen; + + send_packet(source, packet); +} + +/* RFC 791 */ + +static void fragment_ipv4_packet(node_t *dest, vpn_packet_t *packet) { + struct ip ip; + vpn_packet_t fragment; + int len, maxlen, todo; + uint8_t *offset; + uint16_t ip_off, origf; + + cp(); + + memcpy(&ip, packet->data + ether_size, ip_size); + fragment.priority = packet->priority; + + if(ip.ip_hl != ip_size / 4) + return; + + todo = ntohs(ip.ip_len) - ip_size; + + if(ether_size + ip_size + todo != packet->len) { + ifdebug(TRAFFIC) logger(LOG_WARNING, _("Length of packet (%d) doesn't match length in IPv4 header (%d)"), packet->len, ether_size + ip_size + todo); + return; + } + + ifdebug(TRAFFIC) logger(LOG_INFO, _("Fragmenting packet of %d bytes to %s (%s)"), packet->len, dest->name, dest->hostname); + + offset = packet->data + ether_size + ip_size; + maxlen = (dest->mtu - ether_size - ip_size) & ~0x7; + ip_off = ntohs(ip.ip_off); + origf = ip_off & ~IP_OFFMASK; + ip_off &= IP_OFFMASK; + + while(todo) { + len = todo > maxlen ? maxlen : todo; + memcpy(fragment.data + ether_size + ip_size, offset, len); + todo -= len; + offset += len; + + ip.ip_len = htons(ip_size + len); + ip.ip_off = htons(ip_off | origf | (todo ? IP_MF : 0)); + ip.ip_sum = 0; + ip.ip_sum = inet_checksum(&ip, ip_size, ~0); + memcpy(fragment.data, packet->data, ether_size); + memcpy(fragment.data + ether_size, &ip, ip_size); + fragment.len = ether_size + ip_size + len; + + send_packet(dest, &fragment); + + ip_off += len / 8; + } +} + +static void route_ipv4_unicast(node_t *source, vpn_packet_t *packet) +{ + subnet_t *subnet; + node_t *via; + + cp(); + + subnet = lookup_subnet_ipv4((ipv4_t *) &packet->data[30]); + + if(!subnet) { + ifdebug(TRAFFIC) logger(LOG_WARNING, _("Cannot route packet from %s (%s): unknown IPv4 destination address %d.%d.%d.%d"), + source->name, source->hostname, + packet->data[30], + packet->data[31], + packet->data[32], + packet->data[33]); + + route_ipv4_unreachable(source, packet, ICMP_DEST_UNREACH, ICMP_NET_UNKNOWN); + return; + } + + if(subnet->owner == source) { + ifdebug(TRAFFIC) logger(LOG_WARNING, _("Packet looping back to %s (%s)!"), source->name, source->hostname); + return; + } + + if(!subnet->owner->status.reachable) + route_ipv4_unreachable(source, packet, ICMP_DEST_UNREACH, ICMP_NET_UNREACH); + + if(priorityinheritance) + packet->priority = packet->data[15]; + + via = (subnet->owner->via == myself) ? subnet->owner->nexthop : subnet->owner->via; + + if(via && packet->len > via->mtu && via != myself) { + ifdebug(TRAFFIC) logger(LOG_INFO, _("Packet for %s (%s) length %d larger than MTU %d"), subnet->owner->name, subnet->owner->hostname, packet->len, via->mtu); + if(packet->data[20] & 0x40) { + packet->len = via->mtu; + route_ipv4_unreachable(source, packet, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED); + } else { + fragment_ipv4_packet(via, packet); + } + + return; + } + + send_packet(subnet->owner, packet); +} + +static void route_ipv4(node_t *source, vpn_packet_t *packet) +{ + cp(); + + if(!checklength(source, packet, ether_size + ip_size)) + return; + + route_ipv4_unicast(source, packet); +} + +/* RFC 2463 */ + +static void route_ipv6_unreachable(node_t *source, vpn_packet_t *packet, uint8_t type, uint8_t code) +{ + struct ip6_hdr ip6; + struct icmp6_hdr icmp6 = {0}; + uint16_t checksum; + + struct { + struct in6_addr ip6_src; /* source address */ + struct in6_addr ip6_dst; /* destination address */ + uint32_t length; + uint32_t next; + } pseudo; + + if(ratelimit(3)) + return; + + cp(); + + /* Copy headers from packet to structs on the stack */ + + memcpy(&ip6, packet->data + ether_size, ip6_size); + + /* Remember original source and destination */ + + pseudo.ip6_src = ip6.ip6_dst; + pseudo.ip6_dst = ip6.ip6_src; + + pseudo.length = packet->len - ether_size; + + if(type == ICMP6_PACKET_TOO_BIG) + icmp6.icmp6_mtu = htonl(pseudo.length); + + if(pseudo.length >= IP_MSS - ip6_size - icmp6_size) + pseudo.length = IP_MSS - ip6_size - icmp6_size; + + /* Copy first part of original contents to ICMP message */ + + memmove(packet->data + ether_size + ip6_size + icmp6_size, packet->data + ether_size, pseudo.length); + + /* Fill in IPv6 header */ + + ip6.ip6_flow = htonl(0x60000000UL); + ip6.ip6_plen = htons(icmp6_size + pseudo.length); + ip6.ip6_nxt = IPPROTO_ICMPV6; + ip6.ip6_hlim = 255; + ip6.ip6_src = pseudo.ip6_src; + ip6.ip6_dst = pseudo.ip6_dst; + + /* Fill in ICMP header */ + + icmp6.icmp6_type = type; + icmp6.icmp6_code = code; + icmp6.icmp6_cksum = 0; + + /* Create pseudo header */ + + pseudo.length = htonl(icmp6_size + pseudo.length); + pseudo.next = htonl(IPPROTO_ICMPV6); + + /* Generate checksum */ + + checksum = inet_checksum(&pseudo, sizeof(pseudo), ~0); + checksum = inet_checksum(&icmp6, icmp6_size, checksum); + checksum = inet_checksum(packet->data + ether_size + ip6_size + icmp6_size, ntohl(pseudo.length) - icmp6_size, checksum); + + icmp6.icmp6_cksum = checksum; + + /* Copy structs on stack back to packet */ + + memcpy(packet->data + ether_size, &ip6, ip6_size); + memcpy(packet->data + ether_size + ip6_size, &icmp6, icmp6_size); + + packet->len = ether_size + ip6_size + ntohl(pseudo.length); + + send_packet(source, packet); +} + +static void route_ipv6_unicast(node_t *source, vpn_packet_t *packet) +{ + subnet_t *subnet; + node_t *via; + + cp(); + + subnet = lookup_subnet_ipv6((ipv6_t *) &packet->data[38]); + + if(!subnet) { + ifdebug(TRAFFIC) logger(LOG_WARNING, _("Cannot route packet from %s (%s): unknown IPv6 destination address %hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx"), + source->name, source->hostname, + ntohs(*(uint16_t *) &packet->data[38]), + ntohs(*(uint16_t *) &packet->data[40]), + ntohs(*(uint16_t *) &packet->data[42]), + ntohs(*(uint16_t *) &packet->data[44]), + ntohs(*(uint16_t *) &packet->data[46]), + ntohs(*(uint16_t *) &packet->data[48]), + ntohs(*(uint16_t *) &packet->data[50]), + ntohs(*(uint16_t *) &packet->data[52])); + + route_ipv6_unreachable(source, packet, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_ADDR); + return; + } + + if(subnet->owner == source) { + ifdebug(TRAFFIC) logger(LOG_WARNING, _("Packet looping back to %s (%s)!"), source->name, source->hostname); + return; + } + + if(!subnet->owner->status.reachable) + route_ipv6_unreachable(source, packet, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_NOROUTE); + + via = (subnet->owner->via == myself) ? subnet->owner->nexthop : subnet->owner->via; + + if(via && packet->len > via->mtu && via != myself) { + ifdebug(TRAFFIC) logger(LOG_INFO, _("Packet for %s (%s) length %d larger than MTU %d"), subnet->owner->name, subnet->owner->hostname, packet->len, via->mtu); + packet->len = via->mtu; + route_ipv6_unreachable(source, packet, ICMP6_PACKET_TOO_BIG, 0); + return; + } + + send_packet(subnet->owner, packet); +} + +/* RFC 2461 */ + +static void route_neighborsol(node_t *source, vpn_packet_t *packet) +{ + struct ip6_hdr ip6; + struct nd_neighbor_solicit ns; + struct nd_opt_hdr opt; + subnet_t *subnet; + uint16_t checksum; + + struct { + struct in6_addr ip6_src; /* source address */ + struct in6_addr ip6_dst; /* destination address */ + uint32_t length; + uint32_t next; + } pseudo; + + cp(); + + if(!checklength(source, packet, ether_size + ip6_size + ns_size + opt_size + ETH_ALEN)) + return; + + if(source != myself) { + ifdebug(TRAFFIC) logger(LOG_WARNING, _("Got neighbor solicitation request from %s (%s) while in router mode!"), source->name, source->hostname); + return; + } + + /* Copy headers from packet to structs on the stack */ + + memcpy(&ip6, packet->data + ether_size, ip6_size); + memcpy(&ns, packet->data + ether_size + ip6_size, ns_size); + memcpy(&opt, packet->data + ether_size + ip6_size + ns_size, opt_size); + + /* First, snatch the source address from the neighbor solicitation packet */ + + if(overwrite_mac) + memcpy(mymac.x, packet->data + ETH_ALEN, ETH_ALEN); + + /* Check if this is a valid neighbor solicitation request */ + + if(ns.nd_ns_hdr.icmp6_type != ND_NEIGHBOR_SOLICIT || + opt.nd_opt_type != ND_OPT_SOURCE_LINKADDR) { + ifdebug(TRAFFIC) logger(LOG_WARNING, _("Cannot route packet: received unknown type neighbor solicitation request")); + return; + } + + /* Create pseudo header */ + + pseudo.ip6_src = ip6.ip6_src; + pseudo.ip6_dst = ip6.ip6_dst; + pseudo.length = htonl(ns_size + opt_size + ETH_ALEN); + pseudo.next = htonl(IPPROTO_ICMPV6); + + /* Generate checksum */ + + checksum = inet_checksum(&pseudo, sizeof(pseudo), ~0); + checksum = inet_checksum(&ns, ns_size, checksum); + checksum = inet_checksum(&opt, opt_size, checksum); + checksum = inet_checksum(packet->data + ether_size + ip6_size + ns_size + opt_size, ETH_ALEN, checksum); + + if(checksum) { + ifdebug(TRAFFIC) logger(LOG_WARNING, _("Cannot route packet: checksum error for neighbor solicitation request")); + return; + } + + /* Check if the IPv6 address exists on the VPN */ + + subnet = lookup_subnet_ipv6((ipv6_t *) &ns.nd_ns_target); + + if(!subnet) { + ifdebug(TRAFFIC) logger(LOG_WARNING, _("Cannot route packet: neighbor solicitation request for unknown address %hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx"), + ntohs(((uint16_t *) &ns.nd_ns_target)[0]), + ntohs(((uint16_t *) &ns.nd_ns_target)[1]), + ntohs(((uint16_t *) &ns.nd_ns_target)[2]), + ntohs(((uint16_t *) &ns.nd_ns_target)[3]), + ntohs(((uint16_t *) &ns.nd_ns_target)[4]), + ntohs(((uint16_t *) &ns.nd_ns_target)[5]), + ntohs(((uint16_t *) &ns.nd_ns_target)[6]), + ntohs(((uint16_t *) &ns.nd_ns_target)[7])); + + return; + } + + /* Check if it is for our own subnet */ + + if(subnet->owner == myself) + return; /* silently ignore */ + + /* Create neighbor advertation reply */ + + memcpy(packet->data, packet->data + ETH_ALEN, ETH_ALEN); /* copy destination address */ + packet->data[ETH_ALEN * 2 - 1] ^= 0xFF; /* mangle source address so it looks like it's not from us */ + + ip6.ip6_dst = ip6.ip6_src; /* swap destination and source protocoll address */ + ip6.ip6_src = ns.nd_ns_target; + + memcpy(packet->data + ether_size + ip6_size + ns_size + opt_size, packet->data + ETH_ALEN, ETH_ALEN); /* add fake source hard addr */ + + ns.nd_ns_cksum = 0; + ns.nd_ns_type = ND_NEIGHBOR_ADVERT; + ns.nd_ns_reserved = htonl(0x40000000UL); /* Set solicited flag */ + opt.nd_opt_type = ND_OPT_TARGET_LINKADDR; + + /* Create pseudo header */ + + pseudo.ip6_src = ip6.ip6_src; + pseudo.ip6_dst = ip6.ip6_dst; + pseudo.length = htonl(ns_size + opt_size + ETH_ALEN); + pseudo.next = htonl(IPPROTO_ICMPV6); + + /* Generate checksum */ + + checksum = inet_checksum(&pseudo, sizeof(pseudo), ~0); + checksum = inet_checksum(&ns, ns_size, checksum); + checksum = inet_checksum(&opt, opt_size, checksum); + checksum = inet_checksum(packet->data + ether_size + ip6_size + ns_size + opt_size, ETH_ALEN, checksum); + + ns.nd_ns_hdr.icmp6_cksum = checksum; + + /* Copy structs on stack back to packet */ + + memcpy(packet->data + ether_size, &ip6, ip6_size); + memcpy(packet->data + ether_size + ip6_size, &ns, ns_size); + memcpy(packet->data + ether_size + ip6_size + ns_size, &opt, opt_size); + + send_packet(source, packet); +} + +static void route_ipv6(node_t *source, vpn_packet_t *packet) +{ + cp(); + + if(!checklength(source, packet, ether_size + ip6_size)) + return; + + if(packet->data[20] == IPPROTO_ICMPV6 && checklength(source, packet, ether_size + ip6_size + icmp6_size) && packet->data[54] == ND_NEIGHBOR_SOLICIT) { + route_neighborsol(source, packet); + return; + } + + route_ipv6_unicast(source, packet); +} + +/* RFC 826 */ + +static void route_arp(node_t *source, vpn_packet_t *packet) +{ + struct ether_arp arp; + subnet_t *subnet; + struct in_addr addr; + + cp(); + + if(!checklength(source, packet, ether_size + arp_size)) + return; + + if(source != myself) { + ifdebug(TRAFFIC) logger(LOG_WARNING, _("Got ARP request from %s (%s) while in router mode!"), source->name, source->hostname); + return; + } + + /* First, snatch the source address from the ARP packet */ + + if(overwrite_mac) + memcpy(mymac.x, packet->data + ETH_ALEN, ETH_ALEN); + + /* Copy headers from packet to structs on the stack */ + + memcpy(&arp, packet->data + ether_size, arp_size); + + /* Check if this is a valid ARP request */ + + if(ntohs(arp.arp_hrd) != ARPHRD_ETHER || ntohs(arp.arp_pro) != ETH_P_IP || + arp.arp_hln != ETH_ALEN || arp.arp_pln != sizeof(addr) || ntohs(arp.arp_op) != ARPOP_REQUEST) { + ifdebug(TRAFFIC) logger(LOG_WARNING, _("Cannot route packet: received unknown type ARP request")); + return; + } + + /* Check if the IPv4 address exists on the VPN */ + + subnet = lookup_subnet_ipv4((ipv4_t *) &arp.arp_tpa); + + if(!subnet) { + ifdebug(TRAFFIC) logger(LOG_WARNING, _("Cannot route packet: ARP request for unknown address %d.%d.%d.%d"), + arp.arp_tpa[0], arp.arp_tpa[1], arp.arp_tpa[2], + arp.arp_tpa[3]); + return; + } + + /* Check if it is for our own subnet */ + + if(subnet->owner == myself) + return; /* silently ignore */ + + memcpy(packet->data, packet->data + ETH_ALEN, ETH_ALEN); /* copy destination address */ + packet->data[ETH_ALEN * 2 - 1] ^= 0xFF; /* mangle source address so it looks like it's not from us */ + + memcpy(&addr, arp.arp_tpa, sizeof(addr)); /* save protocol addr */ + memcpy(arp.arp_tpa, arp.arp_spa, sizeof(addr)); /* swap destination and source protocol address */ + memcpy(arp.arp_spa, &addr, sizeof(addr)); /* ... */ + + memcpy(arp.arp_tha, arp.arp_sha, ETH_ALEN); /* set target hard/proto addr */ + memcpy(arp.arp_sha, packet->data + ETH_ALEN, ETH_ALEN); /* add fake source hard addr */ + arp.arp_op = htons(ARPOP_REPLY); + + /* Copy structs on stack back to packet */ + + memcpy(packet->data + ether_size, &arp, arp_size); + + send_packet(source, packet); +} + +void route(node_t *source, vpn_packet_t *packet) +{ + cp(); + + if(!checklength(source, packet, ether_size)) + return; + + switch (routing_mode) { + case RMODE_ROUTER: + { + uint16_t type; + + type = ntohs(*((uint16_t *)(&packet->data[12]))); + switch (type) { + case ETH_P_ARP: + route_arp(source, packet); + break; + + case ETH_P_IP: + route_ipv4(source, packet); + break; + + case ETH_P_IPV6: + route_ipv6(source, packet); + break; + + default: + ifdebug(TRAFFIC) logger(LOG_WARNING, _("Cannot route packet from %s (%s): unknown type %hx"), source->name, source->hostname, type); + break; + } + } + break; + + case RMODE_SWITCH: + route_mac(source, packet); + break; + + case RMODE_HUB: + broadcast_packet(source, packet); + break; + } } diff --git a/src/route.h b/src/route.h index d188af2..51bb93e 100644 --- a/src/route.h +++ b/src/route.h @@ -1,7 +1,7 @@ /* route.h -- header file for route.c - Copyright (C) 2000-2002 Ivo Timmermans - 2000-2002 Guus Sliepen + Copyright (C) 2000-2004 Ivo Timmermans + 2000-2004 Guus Sliepen 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 @@ -17,25 +17,29 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: route.h,v 1.1.2.7 2002/03/01 14:09:31 guus Exp $ + $Id: route.h 1374 2004-03-21 14:21:22Z guus $ */ #ifndef __TINC_ROUTE_H__ #define __TINC_ROUTE_H__ -enum -{ - RMODE_HUB = 0, - RMODE_SWITCH, - RMODE_ROUTER, -}; +#include "net.h" +#include "node.h" -extern int routing_mode; -extern int priorityinheritance; +typedef enum rmode_t { + RMODE_HUB = 0, + RMODE_SWITCH, + RMODE_ROUTER, +} rmode_t; + +extern rmode_t routing_mode; +extern bool overwrite_mac; +extern bool priorityinheritance; extern int macexpire; -extern void age_mac(void); -extern void route_incoming(node_t *, vpn_packet_t *); -extern void route_outgoing(vpn_packet_t *); +extern mac_t mymac; -#endif /* __TINC_ROUTE_H__ */ +extern void age_subnets(void); +extern void route(struct node_t *, struct vpn_packet_t *); + +#endif /* __TINC_ROUTE_H__ */ diff --git a/src/solaris/device.c b/src/solaris/device.c index 758068d..e286fd3 100644 --- a/src/solaris/device.c +++ b/src/solaris/device.c @@ -1,7 +1,7 @@ /* device.c -- Interaction with Solaris tun device - Copyright (C) 2001-2002 Ivo Timmermans , - 2001-2002 Guus Sliepen + Copyright (C) 2001-2004 Ivo Timmermans , + 2001-2004 Guus Sliepen 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 @@ -17,180 +17,165 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: device.c,v 1.1.2.7 2002/02/18 16:25:19 guus Exp $ + $Id: device.c 1412 2004-11-10 21:14:08Z guus $ */ -#include "config.h" +#include "system.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include +#include "conf.h" +#include "logger.h" +#include "net.h" +#include "utils.h" + #define DEFAULT_DEVICE "/dev/tun" -#include -#include "conf.h" -#include "net.h" -#include "subnet.h" - -#include "system.h" - int device_fd = -1; -int device_type; char *device = NULL; -char *interface = NULL; -char ifrname[IFNAMSIZ]; +char *iface = NULL; char *device_info = NULL; -int device_total_in = 0; -int device_total_out = 0; +static int device_total_in = 0; +static int device_total_out = 0; -subnet_t mymac; - -int setup_device(void) +bool setup_device(void) { - int ip_fd = -1, if_fd = -1; - int ppa; - char *ptr; + int ip_fd = -1, if_fd = -1; + int ppa; + char *ptr; -cp - if(!get_config_string(lookup_config(config_tree, "Device"), &device)) - device = DEFAULT_DEVICE; + cp(); -cp - if((device_fd = open(device, O_RDWR | O_NONBLOCK)) < 0) - { - syslog(LOG_ERR, _("Could not open %s: %s"), device, strerror(errno)); - return -1; - } -cp - ppa = 0; + if(!get_config_string(lookup_config(config_tree, "Device"), &device)) + device = DEFAULT_DEVICE; - ptr = device; - while(*ptr && !isdigit((int)*ptr)) ptr++; - ppa = atoi(ptr); + if((device_fd = open(device, O_RDWR | O_NONBLOCK)) < 0) { + logger(LOG_ERR, _("Could not open %s: %s"), device, strerror(errno)); + return false; + } - if( (ip_fd = open("/dev/ip", O_RDWR, 0)) < 0){ - syslog(LOG_ERR, _("Could not open /dev/ip: %s"), strerror(errno)); - return -1; - } + ppa = 0; - /* Assign a new PPA and get its unit number. */ - if( (ppa = ioctl(device_fd, TUNNEWPPA, ppa)) < 0){ - syslog(LOG_ERR, _("Can't assign new interface: %s"), strerror(errno)); - return -1; - } + ptr = device; + while(*ptr && !isdigit((int) *ptr)) + ptr++; + ppa = atoi(ptr); - if( (if_fd = open(device, O_RDWR, 0)) < 0){ - syslog(LOG_ERR, _("Could not open %s twice: %s"), device, strerror(errno)); - return -1; - } + if((ip_fd = open("/dev/ip", O_RDWR, 0)) < 0) { + logger(LOG_ERR, _("Could not open /dev/ip: %s"), strerror(errno)); + return false; + } - if(ioctl(if_fd, I_PUSH, "ip") < 0){ - syslog(LOG_ERR, _("Can't push IP module: %s"), strerror(errno)); - return -1; - } + /* Assign a new PPA and get its unit number. */ + if((ppa = ioctl(device_fd, TUNNEWPPA, ppa)) < 0) { + logger(LOG_ERR, _("Can't assign new interface: %s"), strerror(errno)); + return false; + } - /* Assign ppa according to the unit number returned by tun device */ - if(ioctl(if_fd, IF_UNITSEL, (char *)&ppa) < 0){ - syslog(LOG_ERR, _("Can't set PPA %d: %s"), ppa, strerror(errno)); - return -1; - } + if((if_fd = open(device, O_RDWR, 0)) < 0) { + logger(LOG_ERR, _("Could not open %s twice: %s"), device, + strerror(errno)); + return false; + } - if(ioctl(ip_fd, I_LINK, if_fd) < 0){ - syslog(LOG_ERR, _("Can't link TUN device to IP: %s"), strerror(errno)); - return -1; - } + if(ioctl(if_fd, I_PUSH, "ip") < 0) { + logger(LOG_ERR, _("Can't push IP module: %s"), strerror(errno)); + return false; + } - if(!get_config_string(lookup_config(config_tree, "Interface"), &interface)) - asprintf(&interface, "tun%d", ppa); + /* Assign ppa according to the unit number returned by tun device */ + if(ioctl(if_fd, IF_UNITSEL, (char *) &ppa) < 0) { + logger(LOG_ERR, _("Can't set PPA %d: %s"), ppa, strerror(errno)); + return false; + } - device_info = _("Solaris tun device"); + if(ioctl(ip_fd, I_LINK, if_fd) < 0) { + logger(LOG_ERR, _("Can't link TUN device to IP: %s"), strerror(errno)); + return false; + } - /* Set default MAC address for ethertap devices */ + if(!get_config_string(lookup_config(config_tree, "Interface"), &iface)) + asprintf(&iface, "tun%d", ppa); - mymac.type = SUBNET_MAC; - mymac.net.mac.address.x[0] = 0xfe; - mymac.net.mac.address.x[1] = 0xfd; - mymac.net.mac.address.x[2] = 0x00; - mymac.net.mac.address.x[3] = 0x00; - mymac.net.mac.address.x[4] = 0x00; - mymac.net.mac.address.x[5] = 0x00; + device_info = _("Solaris tun device"); - syslog(LOG_INFO, _("%s is a %s"), device, device_info); -cp - return 0; + logger(LOG_INFO, _("%s is a %s"), device, device_info); + + return true; } void close_device(void) { -cp - close(device_fd); + cp(); + + close(device_fd); } -int read_packet(vpn_packet_t *packet) +bool read_packet(vpn_packet_t *packet) { - int lenin; -cp - if((lenin = read(device_fd, packet->data + 14, MTU - 14)) <= 0) - { - syslog(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, device, strerror(errno)); - return -1; - } + int lenin; - memcpy(packet->data, mymac.net.mac.address.x, 6); - memcpy(packet->data + 6, mymac.net.mac.address.x, 6); - packet->data[12] = 0x08; - packet->data[13] = 0x00; + cp(); - packet->len = lenin + 14; + if((lenin = read(device_fd, packet->data + 14, MTU - 14)) <= 0) { + logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, + device, strerror(errno)); + return false; + } - device_total_in += packet->len; + switch(packet->data[14] >> 4) { + case 4: + packet->data[12] = 0x08; + packet->data[13] = 0x00; + break; + case 6: + packet->data[12] = 0x86; + packet->data[13] = 0xDD; + break; + default: + ifdebug(TRAFFIC) logger(LOG_ERR, + _ ("Unknown IP version %d while reading packet from %s %s"), + packet->data[14] >> 4, device_info, device); + return false; + } - if(debug_lvl >= DEBUG_TRAFFIC) - { - syslog(LOG_DEBUG, _("Read packet of %d bytes from %s"), packet->len, device_info); - } + packet->len = lenin + 14; - return 0; -cp + device_total_in += packet->len; + + ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Read packet of %d bytes from %s"), packet->len, + device_info); + + return true; } -int write_packet(vpn_packet_t *packet) +bool write_packet(vpn_packet_t *packet) { -cp - if(debug_lvl >= DEBUG_TRAFFIC) - syslog(LOG_DEBUG, _("Writing packet of %d bytes to %s"), - packet->len, device_info); + cp(); - if(write(device_fd, packet->data + 14, packet->len - 14) < 0) - { - syslog(LOG_ERR, _("Can't write to %s %s: %s"), device_info, packet->len, strerror(errno)); - return -1; - } + ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Writing packet of %d bytes to %s"), + packet->len, device_info); - device_total_out += packet->len; -cp - return 0; + if(write(device_fd, packet->data + 14, packet->len - 14) < 0) { + logger(LOG_ERR, _("Can't write to %s %s: %s"), device_info, + device, strerror(errno)); + return false; + } + + device_total_out += packet->len; + + return true; } void dump_device_stats(void) { -cp - syslog(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device); - syslog(LOG_DEBUG, _(" total bytes in: %10d"), device_total_in); - syslog(LOG_DEBUG, _(" total bytes out: %10d"), device_total_out); -cp + cp(); + + logger(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device); + logger(LOG_DEBUG, _(" total bytes in: %10d"), device_total_in); + logger(LOG_DEBUG, _(" total bytes out: %10d"), device_total_out); } diff --git a/src/subnet.c b/src/subnet.c index 0320957..ccdada1 100644 --- a/src/subnet.c +++ b/src/subnet.c @@ -1,7 +1,7 @@ /* subnet.c -- handle subnet lookups and lists - Copyright (C) 2000-2002 Guus Sliepen , - 2000-2002 Ivo Timmermans + Copyright (C) 2000-2004 Guus Sliepen , + 2000-2004 Ivo Timmermans 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 @@ -17,30 +17,19 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: subnet.c,v 1.1.2.34 2002/04/09 11:42:48 guus Exp $ + $Id: subnet.c 1396 2004-11-01 15:16:12Z guus $ */ -#include "config.h" +#include "system.h" -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "conf.h" +#include "avl_tree.h" +#include "logger.h" #include "net.h" +#include "netutl.h" #include "node.h" #include "subnet.h" -#include "netutl.h" - -#include "system.h" +#include "utils.h" +#include "xalloc.h" /* lists type of subnet */ @@ -48,347 +37,370 @@ avl_tree_t *subnet_tree; /* Subnet comparison */ -int subnet_compare_mac(subnet_t *a, subnet_t *b) +static int subnet_compare_mac(const subnet_t *a, const subnet_t *b) { -cp - return memcmp(&a->net.mac.address, &b->net.mac.address, sizeof(mac_t)); + int result; + + result = memcmp(&a->net.mac.address, &b->net.mac.address, sizeof(mac_t)); + + if(result || !a->owner || !b->owner) + return result; + + return strcmp(a->owner->name, b->owner->name); } -int subnet_compare_ipv4(subnet_t *a, subnet_t *b) +static int subnet_compare_ipv4(const subnet_t *a, const subnet_t *b) { - int result; -cp - result = memcmp(&a->net.ipv4.address, &b->net.ipv4.address, sizeof(ipv4_t)); - - if(result) - return result; + int result; - return a->net.ipv4.prefixlength - b->net.ipv4.prefixlength; + result = memcmp(&a->net.ipv4.address, &b->net.ipv4.address, sizeof(ipv4_t)); + + if(result) + return result; + + result = a->net.ipv4.prefixlength - b->net.ipv4.prefixlength; + + if(result || !a->owner || !b->owner) + return result; + + return strcmp(a->owner->name, b->owner->name); } -int subnet_compare_ipv6(subnet_t *a, subnet_t *b) +static int subnet_compare_ipv6(const subnet_t *a, const subnet_t *b) { - int result; -cp - result = memcmp(&a->net.ipv6.address, &b->net.ipv6.address, sizeof(ipv6_t)); - - if(result) - return result; + int result; - return a->net.ipv6.prefixlength - b->net.ipv6.prefixlength; + result = memcmp(&a->net.ipv6.address, &b->net.ipv6.address, sizeof(ipv6_t)); + + if(result) + return result; + + result = a->net.ipv6.prefixlength - b->net.ipv6.prefixlength; + + if(result || !a->owner || !b->owner) + return result; + + return strcmp(a->owner->name, b->owner->name); } -int subnet_compare(subnet_t *a, subnet_t *b) +int subnet_compare(const subnet_t *a, const subnet_t *b) { - int result; -cp - result = a->type - b->type; - - if(result) - return result; - - switch(a->type) - { - case SUBNET_MAC: - return subnet_compare_mac(a, b); - case SUBNET_IPV4: - return subnet_compare_ipv4(a, b); - case SUBNET_IPV6: - return subnet_compare_ipv6(a, b); - default: - syslog(LOG_ERR, _("subnet_compare() was called with unknown subnet type %d, exitting!"), a->type); - cp_trace(); - exit(0); - } + int result; - return 0; + result = a->type - b->type; + + if(result) + return result; + + switch (a->type) { + case SUBNET_MAC: + return subnet_compare_mac(a, b); + case SUBNET_IPV4: + return subnet_compare_ipv4(a, b); + case SUBNET_IPV6: + return subnet_compare_ipv6(a, b); + default: + logger(LOG_ERR, _("subnet_compare() was called with unknown subnet type %d, exitting!"), + a->type); + cp_trace(); + exit(0); + } + + return 0; } /* Initialising trees */ void init_subnets(void) { -cp - subnet_tree = avl_alloc_tree((avl_compare_t)subnet_compare, (avl_action_t)free_subnet); -cp + cp(); + + subnet_tree = avl_alloc_tree((avl_compare_t) subnet_compare, (avl_action_t) free_subnet); } void exit_subnets(void) { -cp - avl_delete_tree(subnet_tree); -cp + cp(); + + avl_delete_tree(subnet_tree); } avl_tree_t *new_subnet_tree(void) { -cp - return avl_alloc_tree((avl_compare_t)subnet_compare, NULL); -cp + cp(); + + return avl_alloc_tree((avl_compare_t) subnet_compare, NULL); } void free_subnet_tree(avl_tree_t *subnet_tree) { -cp - avl_delete_tree(subnet_tree); -cp + cp(); + + avl_delete_tree(subnet_tree); } /* Allocating and freeing space for subnets */ subnet_t *new_subnet(void) { -cp - return (subnet_t *)xmalloc(sizeof(subnet_t)); + cp(); + + return xmalloc_and_zero(sizeof(subnet_t)); } void free_subnet(subnet_t *subnet) { -cp - free(subnet); + cp(); + + free(subnet); } /* Adding and removing subnets */ void subnet_add(node_t *n, subnet_t *subnet) { -cp - subnet->owner = n; + cp(); - avl_insert(subnet_tree, subnet); -cp - avl_insert(n->subnet_tree, subnet); -cp + subnet->owner = n; + + avl_insert(subnet_tree, subnet); + avl_insert(n->subnet_tree, subnet); } void subnet_del(node_t *n, subnet_t *subnet) { -cp - avl_delete(n->subnet_tree, subnet); -cp - avl_delete(subnet_tree, subnet); -cp + cp(); + + avl_delete(n->subnet_tree, subnet); + avl_delete(subnet_tree, subnet); } /* Ascii representation of subnets */ -subnet_t *str2net(char *subnetstr) +bool str2net(subnet_t *subnet, const char *subnetstr) { - int i, l; - subnet_t *subnet; - unsigned short int x[8]; -cp - subnet = new_subnet(); -cp - if(sscanf(subnetstr, "%hu.%hu.%hu.%hu/%d", - &x[0], &x[1], &x[2], &x[3], - &l) == 5) - { - subnet->type = SUBNET_IPV4; - subnet->net.ipv4.prefixlength = l; - for(i = 0; i < 4; i++) - subnet->net.ipv4.address.x[i] = x[i]; - return subnet; - } - - if(sscanf(subnetstr, "%hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx/%d", - &x[0], &x[1], &x[2], &x[3], &x[4], &x[5], &x[6], &x[7], - &l) == 9) - { - subnet->type = SUBNET_IPV6; - subnet->net.ipv6.prefixlength = l; - for(i = 0; i < 8; i++) - subnet->net.ipv6.address.x[i] = htons(x[i]); - return subnet; - } + int i, l; + uint16_t x[8]; - if(sscanf(subnetstr, "%hu.%hu.%hu.%hu", - &x[0], &x[1], &x[2], &x[3]) == 4) - { - subnet->type = SUBNET_IPV4; - subnet->net.ipv4.prefixlength = 32; - for(i = 0; i < 4; i++) - subnet->net.ipv4.address.x[i] = x[i]; - return subnet; - } - - if(sscanf(subnetstr, "%hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx", - &x[0], &x[1], &x[2], &x[3], &x[4], &x[5], &x[6], &x[7]) == 8) - { - subnet->type = SUBNET_IPV6; - subnet->net.ipv6.prefixlength = 128; - for(i = 0; i < 8; i++) - subnet->net.ipv6.address.x[i] = htons(x[i]); - return subnet; - } + cp(); - if(sscanf(subnetstr, "%hx:%hx:%hx:%hx:%hx:%hx", - &x[0], &x[1], &x[2], &x[3], &x[4], &x[5]) == 6) - { - subnet->type = SUBNET_MAC; - for(i = 0; i < 6; i++) - subnet->net.mac.address.x[i] = x[i]; - return subnet; - } + if(sscanf(subnetstr, "%hu.%hu.%hu.%hu/%d", + &x[0], &x[1], &x[2], &x[3], &l) == 5) { + subnet->type = SUBNET_IPV4; + subnet->net.ipv4.prefixlength = l; - free(subnet); - return NULL; + for(i = 0; i < 4; i++) + subnet->net.ipv4.address.x[i] = x[i]; + + return true; + } + + if(sscanf(subnetstr, "%hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx/%d", + &x[0], &x[1], &x[2], &x[3], &x[4], &x[5], &x[6], &x[7], + &l) == 9) { + subnet->type = SUBNET_IPV6; + subnet->net.ipv6.prefixlength = l; + + for(i = 0; i < 8; i++) + subnet->net.ipv6.address.x[i] = htons(x[i]); + + return true; + } + + if(sscanf(subnetstr, "%hu.%hu.%hu.%hu", &x[0], &x[1], &x[2], &x[3]) == 4) { + subnet->type = SUBNET_IPV4; + subnet->net.ipv4.prefixlength = 32; + + for(i = 0; i < 4; i++) + subnet->net.ipv4.address.x[i] = x[i]; + + return true; + } + + if(sscanf(subnetstr, "%hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx", + &x[0], &x[1], &x[2], &x[3], &x[4], &x[5], &x[6], &x[7]) == 8) { + subnet->type = SUBNET_IPV6; + subnet->net.ipv6.prefixlength = 128; + + for(i = 0; i < 8; i++) + subnet->net.ipv6.address.x[i] = htons(x[i]); + + return true; + } + + if(sscanf(subnetstr, "%hx:%hx:%hx:%hx:%hx:%hx", + &x[0], &x[1], &x[2], &x[3], &x[4], &x[5]) == 6) { + subnet->type = SUBNET_MAC; + + for(i = 0; i < 6; i++) + subnet->net.mac.address.x[i] = x[i]; + + return true; + } + + return false; } -char *net2str(subnet_t *subnet) +bool net2str(char *netstr, int len, const subnet_t *subnet) { - char *netstr; -cp - switch(subnet->type) - { - case SUBNET_MAC: - asprintf(&netstr, "%hx:%hx:%hx:%hx:%hx:%hx", - subnet->net.mac.address.x[0], - subnet->net.mac.address.x[1], - subnet->net.mac.address.x[2], - subnet->net.mac.address.x[3], - subnet->net.mac.address.x[4], - subnet->net.mac.address.x[5]); - break; - case SUBNET_IPV4: - asprintf(&netstr, "%hu.%hu.%hu.%hu/%d", - subnet->net.ipv4.address.x[0], - subnet->net.ipv4.address.x[1], - subnet->net.ipv4.address.x[2], - subnet->net.ipv4.address.x[3], - subnet->net.ipv4.prefixlength); - break; - case SUBNET_IPV6: - asprintf(&netstr, "%hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx/%d", - ntohs(subnet->net.ipv6.address.x[0]), - ntohs(subnet->net.ipv6.address.x[1]), - ntohs(subnet->net.ipv6.address.x[2]), - ntohs(subnet->net.ipv6.address.x[3]), - ntohs(subnet->net.ipv6.address.x[4]), - ntohs(subnet->net.ipv6.address.x[5]), - ntohs(subnet->net.ipv6.address.x[6]), - ntohs(subnet->net.ipv6.address.x[7]), - subnet->net.ipv6.prefixlength); - break; - default: - syslog(LOG_ERR, _("net2str() was called with unknown subnet type %d, exitting!"), subnet->type); - cp_trace(); - exit(0); - } -cp - return netstr; + cp(); + + switch (subnet->type) { + case SUBNET_MAC: + snprintf(netstr, len, "%hx:%hx:%hx:%hx:%hx:%hx", + subnet->net.mac.address.x[0], + subnet->net.mac.address.x[1], + subnet->net.mac.address.x[2], + subnet->net.mac.address.x[3], + subnet->net.mac.address.x[4], subnet->net.mac.address.x[5]); + break; + + case SUBNET_IPV4: + snprintf(netstr, len, "%hu.%hu.%hu.%hu/%d", + subnet->net.ipv4.address.x[0], + subnet->net.ipv4.address.x[1], + subnet->net.ipv4.address.x[2], + subnet->net.ipv4.address.x[3], subnet->net.ipv4.prefixlength); + break; + + case SUBNET_IPV6: + snprintf(netstr, len, "%hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx/%d", + ntohs(subnet->net.ipv6.address.x[0]), + ntohs(subnet->net.ipv6.address.x[1]), + ntohs(subnet->net.ipv6.address.x[2]), + ntohs(subnet->net.ipv6.address.x[3]), + ntohs(subnet->net.ipv6.address.x[4]), + ntohs(subnet->net.ipv6.address.x[5]), + ntohs(subnet->net.ipv6.address.x[6]), + ntohs(subnet->net.ipv6.address.x[7]), + subnet->net.ipv6.prefixlength); + break; + + default: + logger(LOG_ERR, + _("net2str() was called with unknown subnet type %d, exiting!"), + subnet->type); + cp_trace(); + exit(0); + } + + return true; } /* Subnet lookup routines */ -subnet_t *lookup_subnet(node_t *owner, subnet_t *subnet) +subnet_t *lookup_subnet(const node_t *owner, const subnet_t *subnet) { -cp - return avl_search(owner->subnet_tree, subnet); + cp(); + + return avl_search(owner->subnet_tree, subnet); } -subnet_t *lookup_subnet_mac(mac_t *address) +subnet_t *lookup_subnet_mac(const mac_t *address) { - subnet_t subnet, *p; -cp - subnet.type = SUBNET_MAC; - memcpy(&subnet.net.mac.address, address, sizeof(mac_t)); + subnet_t *p, subnet = {0}; - p = (subnet_t *)avl_search(subnet_tree, &subnet); -cp - return p; + cp(); + + subnet.type = SUBNET_MAC; + subnet.net.mac.address = *address; + subnet.owner = NULL; + + p = avl_search(subnet_tree, &subnet); + + return p; } -subnet_t *lookup_subnet_ipv4(ipv4_t *address) +subnet_t *lookup_subnet_ipv4(const ipv4_t *address) { - subnet_t subnet, *p; -cp - subnet.type = SUBNET_IPV4; - memcpy(&subnet.net.ipv4.address, address, sizeof(ipv4_t)); - subnet.net.ipv4.prefixlength = 32; + subnet_t *p, subnet = {0}; - do - { - /* Go find subnet */ - - p = (subnet_t *)avl_search_closest_smaller(subnet_tree, &subnet); + cp(); - /* Check if the found subnet REALLY matches */ -cp - if(p) - { - if(p->type != SUBNET_IPV4) - { - p = NULL; - break; - } + subnet.type = SUBNET_IPV4; + subnet.net.ipv4.address = *address; + subnet.net.ipv4.prefixlength = 32; + subnet.owner = NULL; - if (!maskcmp((char *)address, (char *)&p->net.ipv4.address, p->net.ipv4.prefixlength, sizeof(ipv4_t))) - break; - else - { - /* Otherwise, see if there is a bigger enclosing subnet */ + do { + /* Go find subnet */ - subnet.net.ipv4.prefixlength = p->net.ipv4.prefixlength - 1; - maskcpy((char *)&subnet.net.ipv4.address, (char *)&p->net.ipv4.address, subnet.net.ipv4.prefixlength, sizeof(ipv4_t)); - } - } - } while (p); -cp - return p; + p = avl_search_closest_smaller(subnet_tree, &subnet); + + /* Check if the found subnet REALLY matches */ + + if(p) { + if(p->type != SUBNET_IPV4) { + p = NULL; + break; + } + + if(!maskcmp(address, &p->net.ipv4.address, p->net.ipv4.prefixlength, sizeof(ipv4_t))) + break; + else { + /* Otherwise, see if there is a bigger enclosing subnet */ + + subnet.net.ipv4.prefixlength = p->net.ipv4.prefixlength - 1; + maskcpy(&subnet.net.ipv4.address, &p->net.ipv4.address, subnet.net.ipv4.prefixlength, sizeof(ipv4_t)); + } + } + } while(p); + + return p; } -subnet_t *lookup_subnet_ipv6(ipv6_t *address) +subnet_t *lookup_subnet_ipv6(const ipv6_t *address) { - subnet_t subnet, *p; -cp - subnet.type = SUBNET_IPV6; - memcpy(&subnet.net.ipv6.address, address, sizeof(ipv6_t)); - subnet.net.ipv6.prefixlength = 128; - - do - { - /* Go find subnet */ - - p = (subnet_t *)avl_search_closest_smaller(subnet_tree, &subnet); + subnet_t *p, subnet = {0}; - /* Check if the found subnet REALLY matches */ + cp(); -cp - if(p) - { - if(p->type != SUBNET_IPV6) - return NULL; + subnet.type = SUBNET_IPV6; + subnet.net.ipv6.address = *address; + subnet.net.ipv6.prefixlength = 128; + subnet.owner = NULL; - if (!maskcmp((char *)address, (char *)&p->net.ipv6.address, p->net.ipv6.prefixlength, sizeof(ipv6_t))) - break; - else - { - /* Otherwise, see if there is a bigger enclosing subnet */ + do { + /* Go find subnet */ - subnet.net.ipv6.prefixlength = p->net.ipv6.prefixlength - 1; - maskcpy((char *)&subnet.net.ipv6.address, (char *)&p->net.ipv6.address, subnet.net.ipv6.prefixlength, sizeof(ipv6_t)); - } - } - } while (p); -cp - return p; + p = avl_search_closest_smaller(subnet_tree, &subnet); + + /* Check if the found subnet REALLY matches */ + + if(p) { + if(p->type != SUBNET_IPV6) + return NULL; + + if(!maskcmp(address, &p->net.ipv6.address, p->net.ipv6.prefixlength, sizeof(ipv6_t))) + break; + else { + /* Otherwise, see if there is a bigger enclosing subnet */ + + subnet.net.ipv6.prefixlength = p->net.ipv6.prefixlength - 1; + maskcpy(&subnet.net.ipv6.address, &p->net.ipv6.address, subnet.net.ipv6.prefixlength, sizeof(ipv6_t)); + } + } + } while(p); + + return p; } void dump_subnets(void) { - char *netstr; - subnet_t *subnet; - avl_node_t *node; -cp - syslog(LOG_DEBUG, _("Subnet list:")); - for(node = subnet_tree->head; node; node = node->next) - { - subnet = (subnet_t *)node->data; - netstr = net2str(subnet); - syslog(LOG_DEBUG, _(" %s owner %s"), netstr, subnet->owner->name); - free(netstr); - } - syslog(LOG_DEBUG, _("End of subnet list.")); -cp + char netstr[MAXNETSTR]; + subnet_t *subnet; + avl_node_t *node; + + cp(); + + logger(LOG_DEBUG, _("Subnet list:")); + + for(node = subnet_tree->head; node; node = node->next) { + subnet = node->data; + if(!net2str(netstr, sizeof netstr, subnet)) + continue; + logger(LOG_DEBUG, _(" %s owner %s"), netstr, subnet->owner->name); + } + + logger(LOG_DEBUG, _("End of subnet list.")); } diff --git a/src/subnet.h b/src/subnet.h index be20315..b535af3 100644 --- a/src/subnet.h +++ b/src/subnet.h @@ -1,7 +1,7 @@ /* subnet.h -- header for subnet.c - Copyright (C) 2000,2001 Guus Sliepen , - 2000,2001 Ivo Timmermans + Copyright (C) 2000-2004 Guus Sliepen , + 2000-2004 Ivo Timmermans 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 @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: subnet.h,v 1.1.2.18 2002/04/09 11:42:48 guus Exp $ + $Id: subnet.h 1374 2004-03-21 14:21:22Z guus $ */ #ifndef __TINC_SUBNET_H__ @@ -25,64 +25,61 @@ #include "net.h" -enum -{ - SUBNET_MAC = 0, - SUBNET_IPV4, - SUBNET_IPV6, - SUBNET_TYPES /* Guardian */ -}; +typedef enum subnet_type_t { + SUBNET_MAC = 0, + SUBNET_IPV4, + SUBNET_IPV6, + SUBNET_TYPES /* Guardian */ +} subnet_type_t; -typedef struct subnet_mac_t -{ - mac_t address; - time_t lastseen; +typedef struct subnet_mac_t { + mac_t address; } subnet_mac_t; -typedef struct subnet_ipv4_t -{ - ipv4_t address; - int prefixlength; +typedef struct subnet_ipv4_t { + ipv4_t address; + int prefixlength; } subnet_ipv4_t; -typedef struct subnet_ipv6_t -{ - ipv6_t address; - int prefixlength; +typedef struct subnet_ipv6_t { + ipv6_t address; + int prefixlength; } subnet_ipv6_t; #include "node.h" typedef struct subnet_t { - struct node_t *owner; /* the owner of this subnet */ - struct node_t *uplink; /* the uplink which we should send packets to for this subnet */ + struct node_t *owner; /* the owner of this subnet */ - int type; /* subnet type (IPv4? IPv6? MAC? something even weirder?) */ + subnet_type_t type; /* subnet type (IPv4? IPv6? MAC? something even weirder?) */ + time_t expires; /* expiry time */ - /* And now for the actual subnet: */ + /* And now for the actual subnet: */ - union net - { - subnet_mac_t mac; - subnet_ipv4_t ipv4; - subnet_ipv6_t ipv6; - } net; + union net { + subnet_mac_t mac; + subnet_ipv4_t ipv4; + subnet_ipv6_t ipv6; + } net; } subnet_t; -extern subnet_t *new_subnet(void); +#define MAXNETSTR 64 + +extern int subnet_compare(const struct subnet_t *, const struct subnet_t *); +extern subnet_t *new_subnet(void) __attribute__ ((__malloc__)); extern void free_subnet(subnet_t *); extern void init_subnets(void); extern void exit_subnets(void); -extern avl_tree_t *new_subnet_tree(void); +extern avl_tree_t *new_subnet_tree(void) __attribute__ ((__malloc__)); extern void free_subnet_tree(avl_tree_t *); extern void subnet_add(struct node_t *, subnet_t *); extern void subnet_del(struct node_t *, subnet_t *); -extern char *net2str(subnet_t *); -extern subnet_t *str2net(char *); -extern subnet_t *lookup_subnet(struct node_t *, subnet_t *); -extern subnet_t *lookup_subnet_mac(mac_t *); -extern subnet_t *lookup_subnet_ipv4(ipv4_t *); -extern subnet_t *lookup_subnet_ipv6(ipv6_t *); +extern bool net2str(char *, int, const subnet_t *); +extern bool str2net(subnet_t *, const char *); +extern subnet_t *lookup_subnet(const struct node_t *, const subnet_t *); +extern subnet_t *lookup_subnet_mac(const mac_t *); +extern subnet_t *lookup_subnet_ipv4(const ipv4_t *); +extern subnet_t *lookup_subnet_ipv6(const ipv6_t *); extern void dump_subnets(void); -#endif /* __TINC_SUBNET_H__ */ +#endif /* __TINC_SUBNET_H__ */ diff --git a/src/tincd.c b/src/tincd.c index b8b2959..312d78c 100644 --- a/src/tincd.c +++ b/src/tincd.c @@ -1,7 +1,7 @@ /* tincd.c -- the main file for tincd - Copyright (C) 1998-2002 Ivo Timmermans - 2000-2002 Guus Sliepen + Copyright (C) 1998-2004 Ivo Timmermans + 2000-2004 Guus Sliepen 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 @@ -17,25 +17,18 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: tincd.c,v 1.10.4.58 2002/03/11 11:23:04 guus Exp $ + $Id: tincd.c 1393 2004-10-01 18:23:08Z guus $ */ -#include "config.h" +#include "system.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +/* Darwin (MacOS/X) needs the following definition... */ +#ifndef _P1003_1B_VISIBLE +#define _P1003_1B_VISIBLE +#endif -#ifdef HAVE_SYS_IOCTL_H -# include +#ifdef HAVE_SYS_MMAN_H +#include #endif #include @@ -43,26 +36,29 @@ #include #include -#include -#include +#include + +#include +#include "pidfile.h" #include "conf.h" +#include "device.h" +#include "logger.h" #include "net.h" #include "netutl.h" #include "process.h" #include "protocol.h" -#include "subnet.h" - -#include "system.h" +#include "utils.h" +#include "xalloc.h" /* The name this program was run with. */ -char *program_name; +char *program_name = NULL; /* If nonzero, display usage information and exit. */ -int show_help; +bool show_help = false; /* If nonzero, print the version on standard output and exit. */ -int show_version; +bool show_version = false; /* If nonzero, it will attempt to kill a running tincd and exit. */ int kill_tincd = 0; @@ -71,330 +67,444 @@ int kill_tincd = 0; int generate_keys = 0; /* If nonzero, use null ciphers and skip all key exchanges. */ -int bypass_security = 0; +bool bypass_security = false; -char *identname; /* program name for syslog */ -char *pidfilename; /* pid file location */ -char **g_argv; /* a copy of the cmdline arguments */ -char **environment; /* A pointer to the environment on - startup */ +/* If nonzero, disable swapping for this process. */ +bool do_mlock = false; -static struct option const long_options[] = -{ - { "config", required_argument, NULL, 'c' }, - { "kill", optional_argument, NULL, 'k' }, - { "net", required_argument, NULL, 'n' }, - { "help", no_argument, &show_help, 1 }, - { "version", no_argument, &show_version, 1 }, - { "no-detach", no_argument, &do_detach, 0 }, - { "generate-keys", optional_argument, NULL, 'K'}, - { "debug", optional_argument, NULL, 'd'}, - { "bypass-security", no_argument, &bypass_security, 1 }, - { NULL, 0, NULL, 0 } +/* If nonzero, write log entries to a separate file. */ +bool use_logfile = false; + +char *identname = NULL; /* program name for syslog */ +char *pidfilename = NULL; /* pid file location */ +char *logfilename = NULL; /* log file location */ +char **g_argv; /* a copy of the cmdline arguments */ + +static int status; + +static struct option const long_options[] = { + {"config", required_argument, NULL, 'c'}, + {"kill", optional_argument, NULL, 'k'}, + {"net", required_argument, NULL, 'n'}, + {"help", no_argument, NULL, 1}, + {"version", no_argument, NULL, 2}, + {"no-detach", no_argument, NULL, 'D'}, + {"generate-keys", optional_argument, NULL, 'K'}, + {"debug", optional_argument, NULL, 'd'}, + {"bypass-security", no_argument, NULL, 3}, + {"mlock", no_argument, NULL, 'L'}, + {"logfile", optional_argument, NULL, 4}, + {"pidfile", required_argument, NULL, 5}, + {NULL, 0, NULL, 0} }; -static void -usage(int status) +#ifdef HAVE_MINGW +static struct WSAData wsa_state; +#endif + +static void usage(bool status) { - if(status != 0) - fprintf(stderr, _("Try `%s --help\' for more information.\n"), program_name); - else - { - printf(_("Usage: %s [option]...\n\n"), program_name); - printf(_(" -c, --config=DIR Read configuration options from DIR.\n" - " -D, --no-detach Don't fork and detach.\n" - " -d, --debug[=LEVEL] Increase debug level or set it to LEVEL.\n" - " -k, --kill[=SIGNAL] Attempt to kill a running tincd and exit.\n" - " -n, --net=NETNAME Connect to net NETNAME.\n")); - printf(_(" -K, --generate-keys[=BITS] Generate public/private RSA keypair.\n" - " --help Display this help and exit.\n" - " --version Output version information and exit.\n\n")); - printf(_("Report bugs to tinc@nl.linux.org.\n")); - } - exit(status); + if(status) + fprintf(stderr, _("Try `%s --help\' for more information.\n"), + program_name); + else { + printf(_("Usage: %s [option]...\n\n"), program_name); + printf(_(" -c, --config=DIR Read configuration options from DIR.\n" + " -D, --no-detach Don't fork and detach.\n" + " -d, --debug[=LEVEL] Increase debug level or set it to LEVEL.\n" + " -k, --kill[=SIGNAL] Attempt to kill a running tincd and exit.\n" + " -n, --net=NETNAME Connect to net NETNAME.\n" + " -K, --generate-keys[=BITS] Generate public/private RSA keypair.\n" + " -L, --mlock Lock tinc into main memory.\n" + " --logfile[=FILENAME] Write log entries to a logfile.\n" + " --pidfile=FILENAME Write PID to FILENAME.\n" + " --help Display this help and exit.\n" + " --version Output version information and exit.\n\n")); + printf(_("Report bugs to tinc@tinc-vpn.org.\n")); + } } -void -parse_options(int argc, char **argv, char **envp) +static bool parse_options(int argc, char **argv) { - int r; - int option_index = 0; + int r; + int option_index = 0; - while((r = getopt_long(argc, argv, "c:Dd::k::n:K::", long_options, &option_index)) != EOF) - { - switch(r) - { - case 0: /* long option */ - break; - case 'c': /* config file */ - confbase = xmalloc(strlen(optarg)+1); - strcpy(confbase, optarg); - break; - case 'D': /* no detach */ - do_detach = 0; - break; - case 'd': /* inc debug level */ - if(optarg) - debug_lvl = atoi(optarg); - else - debug_lvl++; - break; - case 'k': /* kill old tincds */ - if(optarg) - { - if(!strcasecmp(optarg, "HUP")) - kill_tincd = SIGHUP; - else if(!strcasecmp(optarg, "TERM")) - kill_tincd = SIGTERM; - else if(!strcasecmp(optarg, "KILL")) - kill_tincd = SIGKILL; - else if(!strcasecmp(optarg, "USR1")) - kill_tincd = SIGUSR1; - else if(!strcasecmp(optarg, "USR2")) - kill_tincd = SIGUSR2; - else if(!strcasecmp(optarg, "WINCH")) - kill_tincd = SIGWINCH; - else if(!strcasecmp(optarg, "INT")) - kill_tincd = SIGINT; - else if(!strcasecmp(optarg, "ALRM")) - kill_tincd = SIGALRM; - else - { - kill_tincd = atoi(optarg); - if(!kill_tincd) - { - fprintf(stderr, _("Invalid argument `%s'; SIGNAL must be a number or one of HUP, TERM, KILL, USR1, USR2, WINCH, INT or ALRM.\n"), optarg); - usage(1); - } - } - } - else - kill_tincd = SIGTERM; - break; - case 'n': /* net name given */ - netname = xmalloc(strlen(optarg)+1); - strcpy(netname, optarg); - break; - case 'K': /* generate public/private keypair */ - if(optarg) - { - generate_keys = atoi(optarg); - if(generate_keys < 512) - { - fprintf(stderr, _("Invalid argument `%s'; BITS must be a number equal to or greater than 512.\n"), - optarg); - usage(1); - } - generate_keys &= ~7; /* Round it to bytes */ - } - else - generate_keys = 1024; - break; - case '?': - usage(1); - default: - break; - } - } + while((r = getopt_long(argc, argv, "c:DLd::k::n:K::", long_options, &option_index)) != EOF) { + switch (r) { + case 0: /* long option */ + break; + + case 'c': /* config file */ + confbase = xstrdup(optarg); + break; + + case 'D': /* no detach */ + do_detach = false; + break; + + case 'L': /* no detach */ + do_mlock = true; + break; + + case 'd': /* inc debug level */ + if(optarg) + debug_level = atoi(optarg); + else + debug_level++; + break; + + case 'k': /* kill old tincds */ +#ifndef HAVE_MINGW + if(optarg) { + if(!strcasecmp(optarg, "HUP")) + kill_tincd = SIGHUP; + else if(!strcasecmp(optarg, "TERM")) + kill_tincd = SIGTERM; + else if(!strcasecmp(optarg, "KILL")) + kill_tincd = SIGKILL; + else if(!strcasecmp(optarg, "USR1")) + kill_tincd = SIGUSR1; + else if(!strcasecmp(optarg, "USR2")) + kill_tincd = SIGUSR2; + else if(!strcasecmp(optarg, "WINCH")) + kill_tincd = SIGWINCH; + else if(!strcasecmp(optarg, "INT")) + kill_tincd = SIGINT; + else if(!strcasecmp(optarg, "ALRM")) + kill_tincd = SIGALRM; + else { + kill_tincd = atoi(optarg); + + if(!kill_tincd) { + fprintf(stderr, _("Invalid argument `%s'; SIGNAL must be a number or one of HUP, TERM, KILL, USR1, USR2, WINCH, INT or ALRM.\n"), + optarg); + usage(true); + return false; + } + } + } else + kill_tincd = SIGTERM; +#else + kill_tincd = 1; +#endif + break; + + case 'n': /* net name given */ + netname = xstrdup(optarg); + break; + + case 'K': /* generate public/private keypair */ + if(optarg) { + generate_keys = atoi(optarg); + + if(generate_keys < 512) { + fprintf(stderr, _("Invalid argument `%s'; BITS must be a number equal to or greater than 512.\n"), + optarg); + usage(true); + return false; + } + + generate_keys &= ~7; /* Round it to bytes */ + } else + generate_keys = 1024; + break; + + case 1: /* show help */ + show_help = true; + break; + + case 2: /* show version */ + show_version = true; + break; + + case 3: /* bypass security */ + bypass_security = true; + break; + + case 4: /* write log entries to a file */ + use_logfile = true; + if(optarg) + logfilename = xstrdup(optarg); + break; + + case 5: /* write PID to a file */ + pidfilename = xstrdup(optarg); + break; + + case '?': + usage(true); + return false; + + default: + break; + } + } + + return true; } /* This function prettyprints the key generation process */ -void indicator(int a, int b, void *p) +static void indicator(int a, int b, void *p) { - switch(a) - { - case 0: - fprintf(stderr, "."); - break; - case 1: - fprintf(stderr, "+"); - break; - case 2: - fprintf(stderr, "-"); - break; - case 3: - switch(b) - { - case 0: - fprintf(stderr, " p\n"); - break; - case 1: - fprintf(stderr, " q\n"); - break; - default: - fprintf(stderr, "?"); - } - break; - default: - fprintf(stderr, "?"); - } + switch (a) { + case 0: + fprintf(stderr, "."); + break; + + case 1: + fprintf(stderr, "+"); + break; + + case 2: + fprintf(stderr, "-"); + break; + + case 3: + switch (b) { + case 0: + fprintf(stderr, " p\n"); + break; + + case 1: + fprintf(stderr, " q\n"); + break; + + default: + fprintf(stderr, "?"); + } + break; + + default: + fprintf(stderr, "?"); + } } /* Generate a public/private RSA keypair, and ask for a file to store them in. */ -int keygen(int bits) +static bool keygen(int bits) { - RSA *rsa_key; - FILE *f; - char *name = NULL; - char *filename; + RSA *rsa_key; + FILE *f; + char *name = NULL; + char *filename; - fprintf(stderr, _("Generating %d bits keys:\n"), bits); - rsa_key = RSA_generate_key(bits, 0xFFFF, indicator, NULL); + fprintf(stderr, _("Generating %d bits keys:\n"), bits); + rsa_key = RSA_generate_key(bits, 0x10001, indicator, NULL); - if(!rsa_key) - { - fprintf(stderr, _("Error during key generation!\n")); - return -1; - } - else - fprintf(stderr, _("Done.\n")); + if(!rsa_key) { + fprintf(stderr, _("Error during key generation!\n")); + return false; + } else + fprintf(stderr, _("Done.\n")); - get_config_string(lookup_config(config_tree, "Name"), &name); + asprintf(&filename, "%s/rsa_key.priv", confbase); + f = ask_and_open(filename, _("private RSA key"), "a"); - if(name) - asprintf(&filename, "%s/hosts/%s", confbase, name); - else - asprintf(&filename, "%s/rsa_key.pub", confbase); + if(!f) + return false; + +#ifdef HAVE_FCHMOD + /* Make it unreadable for others. */ + fchmod(fileno(f), 0600); +#endif + + if(ftell(f)) + fprintf(stderr, _("Appending key to existing contents.\nMake sure only one key is stored in the file.\n")); - if((f = ask_and_safe_open(filename, _("public RSA key"), "a")) == NULL) - return -1; + PEM_write_RSAPrivateKey(f, rsa_key, NULL, NULL, 0, NULL, NULL); + fclose(f); + free(filename); - if(ftell(f)) - fprintf(stderr, _("Appending key to existing contents.\nMake sure only one key is stored in the file.\n")); + get_config_string(lookup_config(config_tree, "Name"), &name); - PEM_write_RSAPublicKey(f, rsa_key); - fclose(f); - free(filename); + if(name) + asprintf(&filename, "%s/hosts/%s", confbase, name); + else + asprintf(&filename, "%s/rsa_key.pub", confbase); - asprintf(&filename, "%s/rsa_key.priv", confbase); - if((f = ask_and_safe_open(filename, _("private RSA key"), "a")) == NULL) - return -1; + f = ask_and_open(filename, _("public RSA key"), "a"); - if(ftell(f)) - fprintf(stderr, _("Appending key to existing contents.\nMake sure only one key is stored in the file.\n")); + if(!f) + return false; - PEM_write_RSAPrivateKey(f, rsa_key, NULL, NULL, 0, NULL, NULL); - fclose(f); - free(filename); + if(ftell(f)) + fprintf(stderr, _("Appending key to existing contents.\nMake sure only one key is stored in the file.\n")); - return 0; + PEM_write_RSAPublicKey(f, rsa_key); + fclose(f); + free(filename); + + return true; } /* Set all files and paths according to netname */ -void make_names(void) +static void make_names(void) { - if(netname) - { - if(!pidfilename) - asprintf(&pidfilename, LOCALSTATEDIR "/run/tinc.%s.pid", netname); - if(!confbase) - asprintf(&confbase, "%s/tinc/%s", CONFDIR, netname); - else - syslog(LOG_INFO, _("Both netname and configuration directory given, using the latter...")); - if(!identname) - asprintf(&identname, "tinc.%s", netname); - } - else - { - if(!pidfilename) - pidfilename = LOCALSTATEDIR "/run/tinc.pid"; - if(!confbase) - asprintf(&confbase, "%s/tinc", CONFDIR); - if(!identname) - identname = "tinc"; - } -} - -int -main(int argc, char **argv, char **envp) -{ - program_name = argv[0]; - - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEDIR); - textdomain (PACKAGE); - - environment = envp; - parse_options(argc, argv, envp); - - if(show_version) - { - printf(_("%s version %s (built %s %s, protocol %d)\n"), PACKAGE, VERSION, __DATE__, __TIME__, PROT_CURRENT); - printf(_("Copyright (C) 1998-2002 Ivo Timmermans, Guus Sliepen and others.\n" - "See the AUTHORS file for a complete list.\n\n" - "tinc comes with ABSOLUTELY NO WARRANTY. This is free software,\n" - "and you are welcome to redistribute it under certain conditions;\n" - "see the file COPYING for details.\n")); - - return 0; - } - - if(show_help) - usage(0); - -#ifdef HAVE_SOLARIS - openlog("tinc", LOG_CONS, LOG_DAEMON); /* Catch all syslog() calls issued before detaching */ -#else - openlog("tinc", LOG_PERROR, LOG_DAEMON); /* Catch all syslog() calls issued before detaching */ +#ifdef HAVE_MINGW + HKEY key; + char installdir[1024] = ""; + long len = sizeof(installdir); #endif - g_argv = argv; + if(netname) + asprintf(&identname, "tinc.%s", netname); + else + identname = xstrdup("tinc"); - make_names(); - init_configuration(&config_tree); - - /* Slllluuuuuuurrrrp! */ -cp - RAND_load_file("/dev/urandom", 1024); - -#ifdef HAVE_SSLEAY_ADD_ALL_ALGORITHMS - SSLeay_add_all_algorithms(); -#else - OpenSSL_add_all_algorithms(); +#ifdef HAVE_MINGW + if(!RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\tinc", 0, KEY_READ, &key)) { + if(!RegQueryValueEx(key, NULL, 0, 0, installdir, &len)) { + if(!logfilename) + asprintf(&logfilename, "%s/log/%s.log", identname); + if(!confbase) { + if(netname) + asprintf(&confbase, "%s/%s", installdir, netname); + else + asprintf(&confbase, "%s", installdir); + } + } + RegCloseKey(key); + if(*installdir) + return; + } #endif -cp - if(generate_keys) - { - read_server_config(); - exit(keygen(generate_keys)); - } + if(!pidfilename) + asprintf(&pidfilename, LOCALSTATEDIR "/run/%s.pid", identname); - if(kill_tincd) - exit(kill_other(kill_tincd)); + if(!logfilename) + asprintf(&logfilename, LOCALSTATEDIR "/log/%s.log", identname); - if(read_server_config()) - exit(1); -cp - if(detach()) - exit(0); -cp - for(;;) - { - if(!setup_network_connections()) - { - main_loop(); - cleanup_and_exit(1); - } - - syslog(LOG_ERR, _("Unrecoverable error")); - cp_trace(); - - if(do_detach) - { - syslog(LOG_NOTICE, _("Restarting in %d seconds!"), maxtimeout); - sleep(maxtimeout); - } - else - { - syslog(LOG_ERR, _("Not restarting.")); - exit(1); - } - } + if(netname) { + if(!confbase) + asprintf(&confbase, CONFDIR "/tinc/%s", netname); + else + logger(LOG_INFO, _("Both netname and configuration directory given, using the latter...")); + } else { + if(!confbase) + asprintf(&confbase, CONFDIR "/tinc"); + } +} + +int main(int argc, char **argv) +{ + program_name = argv[0]; + + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + + if(!parse_options(argc, argv)) + return 1; + + make_names(); + + if(show_version) { + printf(_("%s version %s (built %s %s, protocol %d)\n"), PACKAGE, + VERSION, __DATE__, __TIME__, PROT_CURRENT); + printf(_("Copyright (C) 1998-2004 Ivo Timmermans, Guus Sliepen and others.\n" + "See the AUTHORS file for a complete list.\n\n" + "tinc comes with ABSOLUTELY NO WARRANTY. This is free software,\n" + "and you are welcome to redistribute it under certain conditions;\n" + "see the file COPYING for details.\n")); + + return 0; + } + + if(show_help) { + usage(false); + return 0; + } + + if(kill_tincd) + return !kill_other(kill_tincd); + + openlogger("tinc", use_logfile?LOGMODE_FILE:LOGMODE_STDERR); + + /* Lock all pages into memory if requested */ + + if(do_mlock) +#ifdef HAVE_MLOCKALL + if(mlockall(MCL_CURRENT | MCL_FUTURE)) { + logger(LOG_ERR, _("System call `%s' failed: %s"), "mlockall", + strerror(errno)); +#else + { + logger(LOG_ERR, _("mlockall() not supported on this platform!")); +#endif + return -1; + } + + g_argv = argv; + + init_configuration(&config_tree); + + /* Slllluuuuuuurrrrp! */ + + RAND_load_file("/dev/urandom", 1024); + + OpenSSL_add_all_algorithms(); + + if(generate_keys) { + read_server_config(); + return !keygen(generate_keys); + } + + if(!read_server_config()) + return 1; + + if(lzo_init() != LZO_E_OK) { + logger(LOG_ERR, _("Error initializing LZO compressor!")); + return 1; + } + +#ifdef HAVE_MINGW + if(WSAStartup(MAKEWORD(2, 2), &wsa_state)) { + logger(LOG_ERR, _("System call `%s' failed: %s"), "WSAStartup", winerror(GetLastError())); + return 1; + } + + if(!do_detach || !init_service()) + return main2(argc, argv); + else + return 1; +} + +int main2(int argc, char **argv) +{ +#endif + + if(!detach()) + return 1; + + + /* Setup sockets and open device. */ + + if(!setup_network_connections()) + goto end; + + /* Start main loop. It only exits when tinc is killed. */ + + status = main_loop(); + + /* Shutdown properly. */ + + close_network_connections(); + + ifdebug(CONNECTIONS) + dump_device_stats(); + +end: + logger(LOG_NOTICE, _("Terminating")); + +#ifndef HAVE_MINGW + remove_pid(pidfilename); +#endif + + return status; } diff --git a/src/uml_socket/device.c b/src/uml_socket/device.c new file mode 100644 index 0000000..9d8bb49 --- /dev/null +++ b/src/uml_socket/device.c @@ -0,0 +1,291 @@ +/* + device.c -- UML network socket + Copyright (C) 2002-2004 Ivo Timmermans , + 2002-2004 Guus Sliepen + + 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., 675 Mass Ave, Cambridge, MA 02139, USA. + + $Id: device.c 1374 2004-03-21 14:21:22Z guus $ +*/ + +#include "system.h" + +#include + +#include "conf.h" +#include "net.h" +#include "logger.h" +#include "utils.h" +#include "route.h" + +int device_fd = -1; +static int listen_fd = -1; +static int request_fd = -1; +static int data_fd = -1; +static int write_fd = -1; +static int state = 0; +char *device; +char *iface = NULL; +char *device_info; + +extern char *identname; +extern bool running; + +static int device_total_in = 0; +static int device_total_out = 0; + +enum request_type { REQ_NEW_CONTROL }; + +static struct request { + uint32_t magic; + uint32_t version; + enum request_type type; + struct sockaddr_un sock; +} request; + +static struct sockaddr_un data_sun; + +bool setup_device(void) +{ + struct sockaddr_un listen_sun; + static const int one = 1; + struct { + char zero; + int pid; + int usecs; + } name; + struct timeval tv; + + cp(); + + if(!get_config_string(lookup_config(config_tree, "Device"), &device)) + asprintf(&device, LOCALSTATEDIR "/run/%s.umlsocket", identname); + + get_config_string(lookup_config(config_tree, "Interface"), &iface); + + device_info = _("UML network socket"); + + if((write_fd = socket(PF_UNIX, SOCK_DGRAM, 0)) < 0) { + logger(LOG_ERR, _("Could not open write %s: %s"), device_info, strerror(errno)); + running = false; + return false; + } + + setsockopt(write_fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof one); + + if(fcntl(write_fd, F_SETFL, O_NONBLOCK) < 0) { + logger(LOG_ERR, _("System call `%s' failed: %s"), "fcntl", strerror(errno)); + running = false; + return false; + } + + if((data_fd = socket(PF_UNIX, SOCK_DGRAM, 0)) < 0) { + logger(LOG_ERR, _("Could not open data %s: %s"), device_info, strerror(errno)); + running = false; + return false; + } + + setsockopt(data_fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof one); + + if(fcntl(data_fd, F_SETFL, O_NONBLOCK) < 0) { + logger(LOG_ERR, _("System call `%s' failed: %s"), "fcntl", strerror(errno)); + running = false; + return false; + } + + name.zero = 0; + name.pid = getpid(); + gettimeofday(&tv, NULL); + name.usecs = tv.tv_usec; + data_sun.sun_family = AF_UNIX; + memcpy(&data_sun.sun_path, &name, sizeof name); + + if(bind(data_fd, (struct sockaddr *)&data_sun, sizeof data_sun) < 0) { + logger(LOG_ERR, _("Could not bind data %s: %s"), device_info, strerror(errno)); + running = false; + return false; + } + + if((listen_fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) { + logger(LOG_ERR, _("Could not open %s: %s"), device_info, + strerror(errno)); + return false; + } + + setsockopt(listen_fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof one); + + if(fcntl(listen_fd, F_SETFL, O_NONBLOCK) < 0) { + logger(LOG_ERR, _("System call `%s' failed: %s"), "fcntl", strerror(errno)); + return false; + } + + listen_sun.sun_family = AF_UNIX; + strncpy(listen_sun.sun_path, device, sizeof listen_sun.sun_path); + if(bind(listen_fd, (struct sockaddr *)&listen_sun, sizeof listen_sun) < 0) { + logger(LOG_ERR, _("Could not bind %s to %s: %s"), device_info, device, strerror(errno)); + return false; + } + + if(listen(listen_fd, 1) < 0) { + logger(LOG_ERR, _("Could not listen on %s %s: %s"), device_info, device, strerror(errno)); + return false; + } + + device_fd = listen_fd; + state = 0; + + logger(LOG_INFO, _("%s is a %s"), device, device_info); + + if(routing_mode == RMODE_ROUTER) + overwrite_mac = true; + + return true; +} + +void close_device(void) +{ + cp(); + + if(listen_fd >= 0) + close(listen_fd); + + if(request_fd >= 0) + close(request_fd); + + if(data_fd >= 0) + close(data_fd); + + if(write_fd >= 0) + close(write_fd); + + unlink(device); +} + +bool read_packet(vpn_packet_t *packet) +{ + int lenin; + + cp(); + + switch(state) { + case 0: { + struct sockaddr sa; + int salen = sizeof sa; + + request_fd = accept(listen_fd, &sa, &salen); + if(request_fd < 0) { + logger(LOG_ERR, _("Could not accept connection to %s %s: %s"), device_info, device, strerror(errno)); + return false; + } + + if(fcntl(listen_fd, F_SETFL, O_NONBLOCK) < 0) { + logger(LOG_ERR, _("System call `%s' failed: %s"), "fcntl", strerror(errno)); + running = false; + return false; + } + + close(listen_fd); + listen_fd = -1; + device_fd = request_fd; + state = 1; + + return false; + } + + case 1: { + if((lenin = read(request_fd, &request, sizeof request)) != sizeof request) { + logger(LOG_ERR, _("Error while reading request from %s %s: %s"), device_info, + device, strerror(errno)); + running = false; + return false; + } + + if(request.magic != 0xfeedface || request.version != 3 || request.type != REQ_NEW_CONTROL) { + logger(LOG_ERR, _("Unknown magic %x, version %d, request type %d from %s %s"), + request.magic, request.version, request.type, device_info, device); + running = false; + return false; + } + + if(connect(write_fd, &request.sock, sizeof request.sock) < 0) { + logger(LOG_ERR, _("Could not bind write %s: %s"), device_info, strerror(errno)); + running = false; + return false; + } + + write(request_fd, &data_sun, sizeof data_sun); + device_fd = data_fd; + + logger(LOG_INFO, _("Connection with UML established")); + + state = 2; + return false; + } + + case 2: { + if((lenin = read(data_fd, packet->data, MTU)) <= 0) { + logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, + device, strerror(errno)); + running = false; + return false; + } + + packet->len = lenin; + + device_total_in += packet->len; + + ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Read packet of %d bytes from %s"), packet->len, + device_info); + + return true; + } + } +} + +bool write_packet(vpn_packet_t *packet) +{ + cp(); + + if(state != 2) { + ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Dropping packet of %d bytes to %s: not connected to UML yet"), + packet->len, device_info); + return false; + } + + ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Writing packet of %d bytes to %s"), + packet->len, device_info); + + if(write(write_fd, packet->data, packet->len) < 0) { + if(errno != EINTR && errno != EAGAIN) { + logger(LOG_ERR, _("Can't write to %s %s: %s"), device_info, device, strerror(errno)); + running = false; + } + + return false; + } + + device_total_out += packet->len; + + return true; +} + +void dump_device_stats(void) +{ + cp(); + + logger(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device); + logger(LOG_DEBUG, _(" total bytes in: %10d"), device_total_in); + logger(LOG_DEBUG, _(" total bytes out: %10d"), device_total_out); +} diff --git a/stamp-h.in b/stamp-h.in deleted file mode 100644 index e69de29..0000000 diff --git a/system.h b/system.h index 51adca0..02fc2ee 100644 --- a/system.h +++ b/system.h @@ -1,6 +1,7 @@ /* - system.h -- header for locale settings - Copyright (C) 1998,99,2000 Ivo Timmermans + system.h -- system headers + Copyright (C) 1998-2004 Ivo Timmermans + 2003-2004 Guus Sliepen 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 @@ -20,33 +21,30 @@ #ifndef __TINC_SYSTEM_H__ #define __TINC_SYSTEM_H__ -/* Take care of NLS matters. -- from fileutils 4.0 */ +#include "config.h" -#if HAVE_LOCALE_H -# include -#endif -#if !HAVE_SETLOCALE -# define setlocale(Category, Locale) /* empty */ +#include "have.h" + +#ifndef HAVE_STDBOOL_H +typedef int bool; +#define true 1 +#define false 0 #endif -#if ENABLE_NLS -# include -# define _(Text) gettext (Text) -#else -# undef bindtextdomain -# define bindtextdomain(Domain, Directory) /* empty */ -# undef textdomain -# define textdomain(Domain) /* empty */ -# define _(Text) Text -#endif -#define N_(Text) Text +/* Include localisation support */ + +#include "gettext.h" #ifndef HAVE_STRSIGNAL # define strsignal(p) "" #endif /* Other functions */ -#include + +#include "dropin.h" + +#ifndef HAVE_SOCKLEN_T +typedef int socklen_t; +#endif #endif /* __TINC_SYSTEM_H__ */ -