diff options
Diffstat (limited to 'sntp')
96 files changed, 29458 insertions, 27224 deletions
diff --git a/sntp/COPYRIGHT b/sntp/COPYRIGHT index c4f6f5d..a4a8dbc 100644 --- a/sntp/COPYRIGHT +++ b/sntp/COPYRIGHT @@ -1,80 +1,189 @@ - General Public Licence for the software known as MSNTP - ------------------------------------------------------ - - (c) Copyright, N.M. Maclaren, 1996, 1997, 2000 - (c) Copyright, University of Cambridge, 1996, 1997, 2000 - - - -Free use of MSNTP in source and binary forms is permitted, provided that this -entire licence is duplicated in all copies, and that any documentation, -announcements, and other materials related to use acknowledge that the software -was developed by N.M. Maclaren (hereafter refered to as the Author) at the -University of Cambridge. Neither the name of the Author nor the University of -Cambridge may be used to endorse or promote products derived from this material -without specific prior written permission. - -The Author and the University of Cambridge retain the copyright and all other -legal rights to the software and make it available non-exclusively. All users -must ensure that the software in all its derivations carries a copyright notice -in the form: - (c) Copyright N.M. Maclaren, - (c) Copyright University of Cambridge. - - - - NO WARRANTY - -Because the MSNTP software is licensed free of charge, the Author and the -University of Cambridge provide absolutely no warranty, either expressed or -implied, including, but not limited to, the implied warranties of -merchantability and fitness for a particular purpose. The entire risk as to -the quality and performance of the MSNTP software is with you. Should MSNTP -prove defective, you assume the cost of all necessary servicing or repair. - -In no event, unless required by law, will the Author or the University of -Cambridge, or any other party who may modify and redistribute this software as -permitted in accordance with the provisions below, be liable for damages for -any losses whatsoever, including but not limited to lost profits, lost monies, -lost or corrupted data, or other special, incidental or consequential losses -that may arise out of the use or inability to use the MSNTP software. - - - - COPYING POLICY - -Permission is hereby granted for copying and distribution of copies of the -MSNTP source and binary files, and of any part thereof, subject to the -following licence conditions: - -1. You may distribute MSNTP or components of MSNTP, with or without additions -developed by you or by others. No charge, other than an "at-cost" distribution -fee, may be charged for copies, derivations, or distributions of this material -without the express written consent of the copyright holders. - -2. You may also distribute MSNTP along with any other product for sale, -provided that the cost of the bundled package is the same regardless of whether -MSNTP is included or not, and provided that those interested only in MSNTP must -be notified that it is a product freely available from the University of -Cambridge. - -3. If you distribute MSNTP software or parts of MSNTP, with or without -additions developed by you or others, then you must either make available the -source to all portions of the MSNTP system (exclusive of any additions made by -you or by others) upon request, or instead you may notify anyone requesting -source that it is freely available from the University of Cambridge. - -4. You may not omit any of the copyright notices on either the source files, -the executable files, or the documentation. - -5. You may not omit transmission of this License agreement with whatever -portions of MSNTP that are distributed. - -6. Any users of this software must be notified that it is without warranty or -guarantee of any nature, express or implied, nor is there any fitness for use -represented. - - -October 1996 -April 1997 -October 2000 +This file is automatically generated from html/copyright.html + + Copyright Notice + + jpg "Clone me," says Dolly sheepishly. + + Last update: 1-Jan-2011 08:34 UTC + _________________________________________________________________ + + The following copyright notice applies to all files collectively + called the Network Time Protocol Version 4 Distribution. Unless + specifically declared otherwise in an individual file, this notice + applies as if the text was explicitly included in the file. +*********************************************************************** +* * +* Copyright (c) University of Delaware 1992-2011 * +* * +* Permission to use, copy, modify, and distribute this software and * +* its documentation for any purpose with or without fee is hereby * +* granted, provided that the above copyright notice appears in all * +* copies and that both the copyright notice and this permission * +* notice appear in supporting documentation, and that the name * +* University of Delaware not be used in advertising or publicity * +* pertaining to distribution of the software without specific, * +* written prior permission. The University of Delaware makes no * +* representations about the suitability this software for any * +* purpose. It is provided "as is" without express or implied * +* warranty. * +* * +*********************************************************************** + + The following individuals contributed in part to the Network Time + Protocol Distribution Version 4 and are acknowledged as authors of + this work. + 1. [1]Takao Abe <takao_abe@xurb.jp> Clock driver for JJY receivers + 2. [2]Mark Andrews <mark_andrews@isc.org> Leitch atomic clock + controller + 3. [3]Bernd Altmeier <altmeier@atlsoft.de> hopf Elektronik serial + line and PCI-bus devices + 4. [4]Viraj Bais <vbais@mailman1.intel.com> and [5]Clayton Kirkwood + <kirkwood@striderfm.intel.com> port to WindowsNT 3.5 + 5. [6]Michael Barone <michael,barone@lmco.com> GPSVME fixes + 6. [7]Karl Berry <karl@owl.HQ.ileaf.com> syslog to file option + 7. [8]Greg Brackley <greg.brackley@bigfoot.com> Major rework of WINNT + port. Clean up recvbuf and iosignal code into separate modules. + 8. [9]Marc Brett <Marc.Brett@westgeo.com> Magnavox GPS clock driver + 9. [10]Piete Brooks <Piete.Brooks@cl.cam.ac.uk> MSF clock driver, + Trimble PARSE support + 10. [11]Nelson B Bolyard <nelson@bolyard.me> update and complete + broadcast and crypto features in sntp + 11. [12]Jean-Francois Boudreault + <Jean-Francois.Boudreault@viagenie.qc.ca> IPv6 support + 12. [13]Reg Clemens <reg@dwf.com> Oncore driver (Current maintainer) + 13. [14]Steve Clift <clift@ml.csiro.au> OMEGA clock driver + 14. [15]Casey Crellin <casey@csc.co.za> vxWorks (Tornado) port and + help with target configuration + 15. [16]Sven Dietrich <sven_dietrich@trimble.com> Palisade reference + clock driver, NT adj. residuals, integrated Greg's Winnt port. + 16. [17]John A. Dundas III <dundas@salt.jpl.nasa.gov> Apple A/UX port + 17. [18]Torsten Duwe <duwe@immd4.informatik.uni-erlangen.de> Linux + port + 18. [19]Dennis Ferguson <dennis@mrbill.canet.ca> foundation code for + NTP Version 2 as specified in RFC-1119 + 19. [20]John Hay <jhay@icomtek.csir.co.za> IPv6 support and testing + 20. [21]Dave Hart <davehart@davehart.com> General maintenance, Windows + port interpolation rewrite + 21. [22]Claas Hilbrecht <neoclock4x@linum.com> NeoClock4X clock driver + 22. [23]Glenn Hollinger <glenn@herald.usask.ca> GOES clock driver + 23. [24]Mike Iglesias <iglesias@uci.edu> DEC Alpha port + 24. [25]Jim Jagielski <jim@jagubox.gsfc.nasa.gov> A/UX port + 25. [26]Jeff Johnson <jbj@chatham.usdesign.com> massive prototyping + overhaul + 26. [27]Hans Lambermont <Hans.Lambermont@nl.origin-it.com> or + [28]<H.Lambermont@chello.nl> ntpsweep + 27. [29]Poul-Henning Kamp <phk@FreeBSD.ORG> Oncore driver (Original + author) + 28. [30]Frank Kardel [31]<kardel (at) ntp (dot) org> PARSE <GENERIC> + driver (>14 reference clocks), STREAMS modules for PARSE, support + scripts, syslog cleanup, dynamic interface handling + 29. [32]William L. Jones <jones@hermes.chpc.utexas.edu> RS/6000 AIX + modifications, HPUX modifications + 30. [33]Dave Katz <dkatz@cisco.com> RS/6000 AIX port + 31. [34]Craig Leres <leres@ee.lbl.gov> 4.4BSD port, ppsclock, Magnavox + GPS clock driver + 32. [35]George Lindholm <lindholm@ucs.ubc.ca> SunOS 5.1 port + 33. [36]Louis A. Mamakos <louie@ni.umd.edu> MD5-based authentication + 34. [37]Lars H. Mathiesen <thorinn@diku.dk> adaptation of foundation + code for Version 3 as specified in RFC-1305 + 35. [38]Danny Mayer <mayer@ntp.org>Network I/O, Windows Port, Code + Maintenance + 36. [39]David L. Mills <mills@udel.edu> Version 4 foundation: clock + discipline, authentication, precision kernel; clock drivers: + Spectracom, Austron, Arbiter, Heath, ATOM, ACTS, KSI/Odetics; + audio clock drivers: CHU, WWV/H, IRIG + 37. [40]Wolfgang Moeller <moeller@gwdgv1.dnet.gwdg.de> VMS port + 38. [41]Jeffrey Mogul <mogul@pa.dec.com> ntptrace utility + 39. [42]Tom Moore <tmoore@fievel.daytonoh.ncr.com> i386 svr4 port + 40. [43]Kamal A Mostafa <kamal@whence.com> SCO OpenServer port + 41. [44]Derek Mulcahy <derek@toybox.demon.co.uk> and [45]Damon + Hart-Davis <d@hd.org> ARCRON MSF clock driver + 42. [46]Rob Neal <neal@ntp.org> Bancomm refclock and config/parse code + maintenance + 43. [47]Rainer Pruy <Rainer.Pruy@informatik.uni-erlangen.de> + monitoring/trap scripts, statistics file handling + 44. [48]Dirce Richards <dirce@zk3.dec.com> Digital UNIX V4.0 port + 45. [49]Wilfredo Sánchez <wsanchez@apple.com> added support for + NetInfo + 46. [50]Nick Sayer <mrapple@quack.kfu.com> SunOS streams modules + 47. [51]Jack Sasportas <jack@innovativeinternet.com> Saved a Lot of + space on the stuff in the html/pic/ subdirectory + 48. [52]Ray Schnitzler <schnitz@unipress.com> Unixware1 port + 49. [53]Michael Shields <shields@tembel.org> USNO clock driver + 50. [54]Jeff Steinman <jss@pebbles.jpl.nasa.gov> Datum PTS clock + driver + 51. [55]Harlan Stenn <harlan@pfcs.com> GNU automake/autoconfigure + makeover, various other bits (see the ChangeLog) + 52. [56]Kenneth Stone <ken@sdd.hp.com> HP-UX port + 53. [57]Ajit Thyagarajan <ajit@ee.udel.edu>IP multicast/anycast + support + 54. [58]Tomoaki TSURUOKA <tsuruoka@nc.fukuoka-u.ac.jp>TRAK clock + driver + 55. [59]Paul A Vixie <vixie@vix.com> TrueTime GPS driver, generic + TrueTime clock driver + 56. [60]Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de> corrected and + validated HTML documents according to the HTML DTD + _________________________________________________________________ + +References + + 1. mailto:%20takao_abe@xurb.jp + 2. mailto:%20mark_andrews@isc.org + 3. mailto:%20altmeier@atlsoft.de + 4. mailto:%20vbais@mailman1.intel.co + 5. mailto:%20kirkwood@striderfm.intel.com + 6. mailto:%20michael.barone@lmco.com + 7. mailto:%20karl@owl.HQ.ileaf.com + 8. mailto:%20greg.brackley@bigfoot.com + 9. mailto:%20Marc.Brett@westgeo.com + 10. mailto:%20Piete.Brooks@cl.cam.ac.uk + 11. mailto:%20nelson@bolyard.me + 12. mailto:%20Jean-Francois.Boudreault@viagenie.qc.ca + 13. mailto:%20reg@dwf.com + 14. mailto:%20clift@ml.csiro.au + 15. mailto:casey@csc.co.za + 16. mailto:%20Sven_Dietrich@trimble.COM + 17. mailto:%20dundas@salt.jpl.nasa.gov + 18. mailto:%20duwe@immd4.informatik.uni-erlangen.de + 19. mailto:%20dennis@mrbill.canet.ca + 20. mailto:%20jhay@icomtek.csir.co.za + 21. mailto:%20davehart@davehart.com + 22. mailto:%20neoclock4x@linum.com + 23. mailto:%20glenn@herald.usask.ca + 24. mailto:%20iglesias@uci.edu + 25. mailto:%20jagubox.gsfc.nasa.gov + 26. mailto:%20jbj@chatham.usdesign.com + 27. mailto:Hans.Lambermont@nl.origin-it.com + 28. mailto:H.Lambermont@chello.nl + 29. mailto:%20phk@FreeBSD.ORG + 30. http://www4.informatik.uni-erlangen.de/%7ekardel + 31. mailto:%20kardel(at)ntp(dot)org + 32. mailto:%20jones@hermes.chpc.utexas.edu + 33. mailto:%20dkatz@cisco.com + 34. mailto:%20leres@ee.lbl.gov + 35. mailto:%20lindholm@ucs.ubc.ca + 36. mailto:%20louie@ni.umd.edu + 37. mailto:%20thorinn@diku.dk + 38. mailto:%20mayer@ntp.org + 39. mailto:%20mills@udel.edu + 40. mailto:%20moeller@gwdgv1.dnet.gwdg.de + 41. mailto:%20mogul@pa.dec.com + 42. mailto:%20tmoore@fievel.daytonoh.ncr.com + 43. mailto:%20kamal@whence.com + 44. mailto:%20derek@toybox.demon.co.uk + 45. mailto:%20d@hd.org + 46. mailto:%20neal@ntp.org + 47. mailto:%20Rainer.Pruy@informatik.uni-erlangen.de + 48. mailto:%20dirce@zk3.dec.com + 49. mailto:%20wsanchez@apple.com + 50. mailto:%20mrapple@quack.kfu.com + 51. mailto:%20jack@innovativeinternet.com + 52. mailto:%20schnitz@unipress.com + 53. mailto:%20shields@tembel.org + 54. mailto:%20pebbles.jpl.nasa.gov + 55. mailto:%20harlan@pfcs.com + 56. mailto:%20ken@sdd.hp.com + 57. mailto:%20ajit@ee.udel.edu + 58. mailto:%20tsuruoka@nc.fukuoka-u.ac.jp + 59. mailto:%20vixie@vix.com + 60. mailto:%20Ulrich.Windl@rz.uni-regensburg.de diff --git a/sntp/Makefile.am b/sntp/Makefile.am index 1bee65d..a19d77b 100644 --- a/sntp/Makefile.am +++ b/sntp/Makefile.am @@ -1,51 +1,104 @@ -# Makefile.am, by Harlan Stenn, from: -# Makefile for sntp -# N.M. Maclaren, October 2000. +# Makefile.am for JMK's SNTP, by Harlan Stenn -AUTOMAKE_OPTIONS = foreign -ACLOCAL_AMFLAGS= -I libopts/m4 +NULL = -AM_CPPFLAGS= $(LIBOPTS_CFLAGS) -LDADD= $(LIBOPTS_LDADD) +## LIBOPTS_CHECK_NOBUILD works with Automake 1.10 now +AUTOMAKE_OPTIONS = foreign 1.10 +ACLOCAL_AMFLAGS = -I ../m4 -I libopts/m4 -NULL= +AM_CPPFLAGS = $(LIBOPTS_CFLAGS) -I$(top_srcdir)/../include \ + -I$(top_srcdir)/../lib/isc/include \ + -I$(top_srcdir)/../lib/isc/nothreads/include \ + -I$(top_srcdir)/../lib/isc/unix/include -bindir= ${exec_prefix}/${BINSUBDIR} -bin_PROGRAMS= sntp -#run_ag= cd $(srcdir) && autogen --writable -L $(top_srcdir)/include -run_ag= cd $(srcdir) && autogen --writable +LDADD = $(LIBOPTS_LDADD) $(LIBM) ../libntp/libntp.a @LCRYPTO@ -SUBDIRS= +run_ag = cd $(srcdir) && env PATH="$(abs_builddir):$(PATH)" \ + autogen -L ../include --writable + +if NTP_BINSUBDIR_IS_BIN +bin_PROGRAMS = sntp +else +sbin_PROGRAMS = sntp +endif + +CLEANFILES = check-COPYRIGHT-submake + +SUBDIRS = if NEED_LIBOPTS -SUBDIRS+= libopts +SUBDIRS += libopts endif -SUBDIRS+= . - -sntp_SOURCES = \ - header.h \ - internet.c \ - internet.h \ - kludges.h \ - main.c \ - sntp-opts.c \ - sntp-opts.h \ - socket.c \ - timing.c \ - unix.c \ + +sntp_SOURCES = \ + crypto.c \ + crypto.h \ + data_formats.h \ + header.h \ + kod_management.c \ + kod_management.h \ + log.c \ + log.h \ + main.c \ + main.h \ + networking.c \ + networking.h \ + sntp.c \ + sntp-opts.c \ + sntp-opts.h \ + utilities.c \ + utilities.h \ + $(NULL) + +EXTRA_DIST = \ + $(srcdir)/autogen-version.def \ + bincheck.mf \ + $(srcdir)/COPYRIGHT \ + deps-ver \ + depsver.mf \ + sntp-opts.def \ + sntp-opts.menu \ + sntp-opts.texi \ + sntp.1 \ + sntp.html \ + sntp.texi \ + $(srcdir)/version.def \ + $(srcdir)/version.m4 \ + $(srcdir)/version.texi \ $(NULL) -dist_man_MANS= sntp.1 +OLD_EXTRA_DIST= \ + autogen-version.def version.def version.m4 version.texi -EXTRA_DIST= bincheck.mf \ - COPYRIGHT \ - sntp-opts.def sntp.1 sntp-opts.texi sntp-opts.menu \ - autogen-version.def version.def -BUILT_SOURCES= check-autogen-version.def check-version.def \ - sntp-opts.c sntp-opts.h sntp.1 sntp-opts.texi sntp-opts.menu -man_MANS= sntp.1 +BUILT_SOURCES= \ + check-autogen-version.def \ + check-version.def \ + check-version.m4 \ + check-version.texi \ + $(srcdir)/COPYRIGHT \ + libtool \ + $(srcdir)/sntp-opts.c \ + $(srcdir)/sntp-opts.h \ + $(NULL) +man_MANS= $(srcdir)/sntp.1 + +# HMS: Real Soon Now... +#info_TEXINFOS= sntp.texi +#sntp_TEXINFOS= sntp-opts.texi + +noinst_DATA= \ + $(srcdir)/sntp.html \ + $(srcdir)/sntp-opts.texi \ + $(srcdir)/sntp-opts.menu \ + $(NULL) FRC: + @: do-nothing action to prevent default SCCS get + @: FRC "force" depends on nothing and is not a file, so is + @: always out-of-date causing targets which depend on it to + @: similarly always be outdated causing their rules to fire + @: each time they or a dependent is built. + check-autogen-version.def: FRC @cd $(srcdir) \ && test -r ../include/autogen-version.def \ @@ -55,6 +108,9 @@ check-autogen-version.def: FRC echo "Installing new sntp/autogen-version.def file"; \ fi ) +$(srcdir)/autogen-version.def: + $(MAKE) check-autogen-version.def + check-version.def: FRC @cd $(srcdir) \ && test -r ../include/version.def \ @@ -64,14 +120,74 @@ check-version.def: FRC echo "Installing new sntp/version.def file"; \ fi ) +$(srcdir)/version.def: + $(MAKE) check-version.def + +check-version.m4: FRC + @cd $(srcdir) \ + && test -r ../version.m4 \ + && ( if cmp -s ../version.m4 version.m4; \ + then : ; \ + else cp ../version.m4 version.m4; \ + echo "Installing new sntp/version.m4 file"; \ + fi ) + +$(srcdir)/version.m4: + $(MAKE) check-version.m4 + +check-version.texi: FRC + @cd $(srcdir) \ + && test -r ../include/version.texi \ + && ( if cmp -s ../include/version.texi version.texi; \ + then : ; \ + else cp ../include/version.texi version.texi; \ + echo "Installing new sntp/version.texi file"; \ + fi ) + +$(srcdir)/version.texi: + $(MAKE) check-version.texi + +$(srcdir)/../COPYRIGHT: + cd .. && $(MAKE) COPYRIGHT-please + +check-COPYRIGHT-submake: $(srcdir)/../COPYRIGHT + @cmp -s $(srcdir)/../COPYRIGHT $(srcdir)/COPYRIGHT \ + || { cp $(srcdir)/../COPYRIGHT $(srcdir) \ + && echo 'updated sntp/COPYRIGHT installed' ;} + @echo 'submake avoided if this file is newer than parent COPYRIGHT' > $@ + +check-COPYRIGHT: FRC + [ ! -r $(srcdir)/../COPYRIGHT ] \ + || [ check-COPYRIGHT-submake -nt $(srcdir)/../COPYRIGHT ] \ + || $(MAKE) check-COPYRIGHT-submake + +$(srcdir)/COPYRIGHT: check-COPYRIGHT + @: do-nothing action to prevent any default + $(srcdir)/sntp-opts.h: $(srcdir)/sntp-opts.c -$(srcdir)/sntp-opts.c: $(srcdir)/sntp-opts.def $(srcdir)/version.def + @: do-nothing action to avoid default SCCS get, .h built with .c + +$(srcdir)/sntp-opts.c: $(srcdir)/sntp-opts.def $(srcdir)/version.def $(srcdir)/../include/copyright.def $(run_ag) sntp-opts.def -$(srcdir)/sntp.1: $(srcdir)/sntp-opts.def $(srcdir)/version.def +$(srcdir)/sntp.1: $(srcdir)/sntp-opts.def $(srcdir)/version.def $(srcdir)/../include/copyright.def $(run_ag) -Tagman1.tpl -bsntp sntp-opts.def -$(srcdir)/sntp-opts.texi $(srcdir)/sntp-opts.menu: $(srcdir)/sntp-opts.def $(srcdir)/version.def +$(srcdir)/sntp-opts.menu: $(srcdir)/sntp-opts.texi + @: do-nothing action to avoid default SCCS get, .menu built with .texi + +$(srcdir)/sntp-opts.texi: $(srcdir)/sntp-opts.def $(srcdir)/version.def $(srcdir)/../include/copyright.def $(run_ag) -Taginfo.tpl -DLEVEL=section sntp-opts.def + $(top_srcdir)/../scripts/check--help $@ + +$(srcdir)/sntp.html: $(srcdir)/sntp-opts.menu $(srcdir)/sntp-opts.texi $(srcdir)/sntp.texi $(srcdir)/version.texi + cd $(srcdir) && ( makeinfo --force --html --no-split -o sntp.html sntp.texi || true ) + +../libntp/libntp.a: + cd ../libntp && $(MAKE) libntp.a + +libtool: $(LIBTOOL_DEPS) + ./config.status --recheck -include bincheck.mf +include $(top_srcdir)/bincheck.mf +include $(top_srcdir)/depsver.mf diff --git a/sntp/Makefile.in b/sntp/Makefile.in index 62acb87..f77fe62 100644 --- a/sntp/Makefile.in +++ b/sntp/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -15,14 +15,13 @@ @SET_MAKE@ -# Makefile.am, by Harlan Stenn, from: -# Makefile for sntp -# N.M. Maclaren, October 2000. +# Makefile.am for JMK's SNTP, by Harlan Stenn # we traditionally installed software in bindir, while it should have gone # in sbindir. Now that we offer a choice, look in the "other" installation # subdir to warn folks if there is another version there. + VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -42,16 +41,26 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -bin_PROGRAMS = sntp$(EXEEXT) +@NTP_BINSUBDIR_IS_BIN_TRUE@bin_PROGRAMS = sntp$(EXEEXT) +@NTP_BINSUBDIR_IS_BIN_FALSE@sbin_PROGRAMS = sntp$(EXEEXT) @NEED_LIBOPTS_TRUE@am__append_1 = libopts -DIST_COMMON = README $(am__configure_deps) $(dist_man_MANS) \ - $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/bincheck.mf $(srcdir)/config.h.in \ - $(top_srcdir)/configure compile config.guess config.sub \ +DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(top_srcdir)/bincheck.mf $(top_srcdir)/configure \ + $(top_srcdir)/depsver.mf compile config.guess config.sub \ depcomp install-sh ltmain.sh missing subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/libopts/m4/libopts.m4 \ + $(top_srcdir)/../m4/libtool.m4 \ + $(top_srcdir)/../m4/ltoptions.m4 \ + $(top_srcdir)/../m4/ltsugar.m4 \ + $(top_srcdir)/../m4/ltversion.m4 \ + $(top_srcdir)/../m4/lt~obsolete.m4 \ + $(top_srcdir)/../m4/ntp_cacheversion.m4 \ + $(top_srcdir)/../m4/ntp_dir_sep.m4 \ + $(top_srcdir)/../m4/ntp_lib_m.m4 \ + $(top_srcdir)/../m4/ntp_openssl.m4 $(top_srcdir)/../version.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -61,16 +70,19 @@ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" -PROGRAMS = $(bin_PROGRAMS) +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" \ + "$(DESTDIR)$(man1dir)" +PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) am__objects_1 = -am_sntp_OBJECTS = internet.$(OBJEXT) main.$(OBJEXT) \ - sntp-opts.$(OBJEXT) socket.$(OBJEXT) timing.$(OBJEXT) \ - unix.$(OBJEXT) $(am__objects_1) +am_sntp_OBJECTS = crypto.$(OBJEXT) kod_management.$(OBJEXT) \ + log.$(OBJEXT) main.$(OBJEXT) networking.$(OBJEXT) \ + sntp.$(OBJEXT) sntp-opts.$(OBJEXT) utilities.$(OBJEXT) \ + $(am__objects_1) sntp_OBJECTS = $(am_sntp_OBJECTS) sntp_LDADD = $(LDADD) am__DEPENDENCIES_1 = -sntp_DEPENDENCIES = $(am__DEPENDENCIES_1) +sntp_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + ../libntp/libntp.a DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -116,7 +128,8 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' man1dir = $(mandir)/man1 NROFF = nroff -MANS = $(dist_man_MANS) $(man_MANS) +MANS = $(man_MANS) +DATA = $(noinst_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ @@ -124,7 +137,7 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags -DIST_SUBDIRS = libopts . +DIST_SUBDIRS = libopts DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -177,12 +190,15 @@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -ECHO = @ECHO@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +FGREP = @FGREP@ GREP = @GREP@ HAVE_INLINE = @HAVE_INLINE@ INSTALL = @INSTALL@ @@ -190,18 +206,31 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LCRYPTO = @LCRYPTO@ +LD = @LD@ LDFLAGS = @LDFLAGS@ +LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBOPTS_CFLAGS = @LIBOPTS_CFLAGS@ LIBOPTS_DIR = @LIBOPTS_DIR@ LIBOPTS_LDADD = @LIBOPTS_LDADD@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OPENSSL = @OPENSSL@ +OPENSSL_INC = @OPENSSL_INC@ +OPENSSL_LIB = @OPENSSL_LIB@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -210,7 +239,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +POSIX_SHELL = @POSIX_SHELL@ RANLIB = @RANLIB@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -219,13 +250,15 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -bindir = ${exec_prefix}/${BINSUBDIR} +bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ @@ -265,37 +298,75 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -AUTOMAKE_OPTIONS = foreign -ACLOCAL_AMFLAGS = -I libopts/m4 -AM_CPPFLAGS = $(LIBOPTS_CFLAGS) -LDADD = $(LIBOPTS_LDADD) NULL = -#run_ag= cd $(srcdir) && autogen --writable -L $(top_srcdir)/include -run_ag = cd $(srcdir) && autogen --writable -SUBDIRS = $(am__append_1) . +AUTOMAKE_OPTIONS = foreign 1.10 +ACLOCAL_AMFLAGS = -I ../m4 -I libopts/m4 +AM_CPPFLAGS = $(LIBOPTS_CFLAGS) -I$(top_srcdir)/../include \ + -I$(top_srcdir)/../lib/isc/include \ + -I$(top_srcdir)/../lib/isc/nothreads/include \ + -I$(top_srcdir)/../lib/isc/unix/include + +LDADD = $(LIBOPTS_LDADD) $(LIBM) ../libntp/libntp.a @LCRYPTO@ +run_ag = cd $(srcdir) && env PATH="$(abs_builddir):$(PATH)" \ + autogen -L ../include --writable + +CLEANFILES = check-COPYRIGHT-submake .deps-ver +SUBDIRS = $(am__append_1) sntp_SOURCES = \ - header.h \ - internet.c \ - internet.h \ - kludges.h \ - main.c \ - sntp-opts.c \ - sntp-opts.h \ - socket.c \ - timing.c \ - unix.c \ + crypto.c \ + crypto.h \ + data_formats.h \ + header.h \ + kod_management.c \ + kod_management.h \ + log.c \ + log.h \ + main.c \ + main.h \ + networking.c \ + networking.h \ + sntp.c \ + sntp-opts.c \ + sntp-opts.h \ + utilities.c \ + utilities.h \ $(NULL) -dist_man_MANS = sntp.1 -EXTRA_DIST = bincheck.mf \ - COPYRIGHT \ - sntp-opts.def sntp.1 sntp-opts.texi sntp-opts.menu \ - autogen-version.def version.def +EXTRA_DIST = \ + $(srcdir)/autogen-version.def \ + bincheck.mf \ + $(srcdir)/COPYRIGHT \ + deps-ver \ + depsver.mf \ + sntp-opts.def \ + sntp-opts.menu \ + sntp-opts.texi \ + sntp.1 \ + sntp.html \ + sntp.texi \ + $(srcdir)/version.def \ + $(srcdir)/version.m4 \ + $(srcdir)/version.texi \ + $(NULL) -BUILT_SOURCES = check-autogen-version.def check-version.def \ - sntp-opts.c sntp-opts.h sntp.1 sntp-opts.texi sntp-opts.menu +OLD_EXTRA_DIST = \ + autogen-version.def version.def version.m4 version.texi + +BUILT_SOURCES = check-autogen-version.def check-version.def \ + check-version.m4 check-version.texi $(srcdir)/COPYRIGHT \ + libtool $(srcdir)/sntp-opts.c $(srcdir)/sntp-opts.h $(NULL) \ + .deps-ver +man_MANS = $(srcdir)/sntp.1 + +# HMS: Real Soon Now... +#info_TEXINFOS= sntp.texi +#sntp_TEXINFOS= sntp-opts.texi +noinst_DATA = \ + $(srcdir)/sntp.html \ + $(srcdir)/sntp-opts.texi \ + $(srcdir)/sntp-opts.menu \ + $(NULL) -man_MANS = sntp.1 all: $(BUILT_SOURCES) config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -303,7 +374,7 @@ all: $(BUILT_SOURCES) config.h .SUFFIXES: .c .lo .o .obj am--refresh: @: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/bincheck.mf $(am__configure_deps) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/bincheck.mf $(top_srcdir)/depsver.mf $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -395,6 +466,49 @@ clean-binPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list +install-sbinPROGRAMS: $(sbin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)" + @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-sbinPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(sbindir)" && rm -f $$files + +clean-sbinPROGRAMS: + @list='$(sbin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list sntp$(EXEEXT): $(sntp_OBJECTS) $(sntp_DEPENDENCIES) @rm -f sntp$(EXEEXT) $(LINK) $(sntp_OBJECTS) $(sntp_LDADD) $(LIBS) @@ -405,12 +519,14 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/internet.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crypto.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kod_management.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/networking.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sntp-opts.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socket.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timing.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unix.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sntp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utilities.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -441,12 +557,12 @@ clean-libtool: distclean-libtool: -rm -f libtool config.lt -install-man1: $(dist_man_MANS) $(man_MANS) +install-man1: $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" @list=''; test -n "$(man1dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ - l2='$(dist_man_MANS) $(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ @@ -472,7 +588,7 @@ uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ - l2='$(dist_man_MANS) $(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ @@ -487,7 +603,7 @@ uninstall-man1: # (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): - @failcom='exit 1'; \ + @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ @@ -512,7 +628,7 @@ $(RECURSIVE_TARGETS): fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): - @failcom='exit 1'; \ + @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ @@ -689,7 +805,8 @@ distdir: $(DISTFILES) fi; \ done -test -n "$(am__skip_mode_fix)" \ - || find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ @@ -733,17 +850,17 @@ dist dist-all: distdir distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ - unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ + lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac @@ -805,10 +922,10 @@ distcleancheck: distclean check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-recursive -all-am: Makefile $(PROGRAMS) $(MANS) config.h +all-am: Makefile $(PROGRAMS) $(MANS) $(DATA) config.h installdirs: installdirs-recursive installdirs-am: - for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man1dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) @@ -829,6 +946,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) @@ -840,7 +958,8 @@ maintainer-clean-generic: -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-recursive -clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am +clean-am: clean-binPROGRAMS clean-generic clean-libtool \ + clean-sbinPROGRAMS mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) @@ -867,7 +986,7 @@ install-dvi: install-dvi-recursive install-dvi-am: -install-exec-am: install-binPROGRAMS +install-exec-am: install-binPROGRAMS install-sbinPROGRAMS @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-html: install-html-recursive @@ -910,7 +1029,8 @@ ps: ps-recursive ps-am: -uninstall-am: uninstall-binPROGRAMS uninstall-man +uninstall-am: uninstall-binPROGRAMS uninstall-man \ + uninstall-sbinPROGRAMS uninstall-man: uninstall-man1 @@ -920,25 +1040,33 @@ uninstall-man: uninstall-man1 .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-binPROGRAMS \ - clean-generic clean-libtool ctags ctags-recursive dist \ - dist-all dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ \ - dist-xz dist-zip distcheck distclean distclean-compile \ - distclean-generic distclean-hdr distclean-libtool \ - distclean-tags distcleancheck distdir distuninstallcheck dvi \ - dvi-am html html-am info info-am install install-am \ - install-binPROGRAMS install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-exec-hook \ - install-html install-html-am install-info install-info-am \ - install-man install-man1 install-pdf install-pdf-am install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs installdirs-am maintainer-clean \ + clean-generic clean-libtool clean-sbinPROGRAMS ctags \ + ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-lzma \ + dist-shar dist-tarZ dist-xz dist-zip distcheck distclean \ + distclean-compile distclean-generic distclean-hdr \ + distclean-libtool distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am html html-am info info-am \ + install install-am install-binPROGRAMS install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-exec-hook install-html install-html-am \ + install-info install-info-am install-man install-man1 \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-sbinPROGRAMS install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-recursive uninstall uninstall-am \ - uninstall-binPROGRAMS uninstall-man uninstall-man1 + uninstall-binPROGRAMS uninstall-man uninstall-man1 \ + uninstall-sbinPROGRAMS FRC: + @: do-nothing action to prevent default SCCS get + @: FRC "force" depends on nothing and is not a file, so is + @: always out-of-date causing targets which depend on it to + @: similarly always be outdated causing their rules to fire + @: each time they or a dependent is built. + check-autogen-version.def: FRC @cd $(srcdir) \ && test -r ../include/autogen-version.def \ @@ -948,6 +1076,9 @@ check-autogen-version.def: FRC echo "Installing new sntp/autogen-version.def file"; \ fi ) +$(srcdir)/autogen-version.def: + $(MAKE) check-autogen-version.def + check-version.def: FRC @cd $(srcdir) \ && test -r ../include/version.def \ @@ -957,27 +1088,150 @@ check-version.def: FRC echo "Installing new sntp/version.def file"; \ fi ) +$(srcdir)/version.def: + $(MAKE) check-version.def + +check-version.m4: FRC + @cd $(srcdir) \ + && test -r ../version.m4 \ + && ( if cmp -s ../version.m4 version.m4; \ + then : ; \ + else cp ../version.m4 version.m4; \ + echo "Installing new sntp/version.m4 file"; \ + fi ) + +$(srcdir)/version.m4: + $(MAKE) check-version.m4 + +check-version.texi: FRC + @cd $(srcdir) \ + && test -r ../include/version.texi \ + && ( if cmp -s ../include/version.texi version.texi; \ + then : ; \ + else cp ../include/version.texi version.texi; \ + echo "Installing new sntp/version.texi file"; \ + fi ) + +$(srcdir)/version.texi: + $(MAKE) check-version.texi + +$(srcdir)/../COPYRIGHT: + cd .. && $(MAKE) COPYRIGHT-please + +check-COPYRIGHT-submake: $(srcdir)/../COPYRIGHT + @cmp -s $(srcdir)/../COPYRIGHT $(srcdir)/COPYRIGHT \ + || { cp $(srcdir)/../COPYRIGHT $(srcdir) \ + && echo 'updated sntp/COPYRIGHT installed' ;} + @echo 'submake avoided if this file is newer than parent COPYRIGHT' > $@ + +check-COPYRIGHT: FRC + [ ! -r $(srcdir)/../COPYRIGHT ] \ + || [ check-COPYRIGHT-submake -nt $(srcdir)/../COPYRIGHT ] \ + || $(MAKE) check-COPYRIGHT-submake + +$(srcdir)/COPYRIGHT: check-COPYRIGHT + @: do-nothing action to prevent any default + $(srcdir)/sntp-opts.h: $(srcdir)/sntp-opts.c -$(srcdir)/sntp-opts.c: $(srcdir)/sntp-opts.def $(srcdir)/version.def + @: do-nothing action to avoid default SCCS get, .h built with .c + +$(srcdir)/sntp-opts.c: $(srcdir)/sntp-opts.def $(srcdir)/version.def $(srcdir)/../include/copyright.def $(run_ag) sntp-opts.def -$(srcdir)/sntp.1: $(srcdir)/sntp-opts.def $(srcdir)/version.def +$(srcdir)/sntp.1: $(srcdir)/sntp-opts.def $(srcdir)/version.def $(srcdir)/../include/copyright.def $(run_ag) -Tagman1.tpl -bsntp sntp-opts.def -$(srcdir)/sntp-opts.texi $(srcdir)/sntp-opts.menu: $(srcdir)/sntp-opts.def $(srcdir)/version.def +$(srcdir)/sntp-opts.menu: $(srcdir)/sntp-opts.texi + @: do-nothing action to avoid default SCCS get, .menu built with .texi + +$(srcdir)/sntp-opts.texi: $(srcdir)/sntp-opts.def $(srcdir)/version.def $(srcdir)/../include/copyright.def $(run_ag) -Taginfo.tpl -DLEVEL=section sntp-opts.def + $(top_srcdir)/../scripts/check--help $@ + +$(srcdir)/sntp.html: $(srcdir)/sntp-opts.menu $(srcdir)/sntp-opts.texi $(srcdir)/sntp.texi $(srcdir)/version.texi + cd $(srcdir) && ( makeinfo --force --html --no-split -o sntp.html sntp.texi || true ) + +../libntp/libntp.a: + cd ../libntp && $(MAKE) libntp.a + +libtool: $(LIBTOOL_DEPS) + ./config.status --recheck install-exec-hook: - @case ${BINSUBDIR} in \ - bin) ODIR=${exec_prefix}/sbin ;; \ - sbin) ODIR=${exec_prefix}/bin ;; \ - esac; \ - test -z "${bin_PROGRAMS}${bin_SCRIPTS}" \ + @case ${BINSUBDIR} in \ + bin) ODIR=${sbindir} ;; \ + sbin) ODIR=${bindir} ;; \ + esac; \ + test -z "${bin_PROGRAMS}${bin_SCRIPTS}" \ || for i in ${bin_PROGRAMS} ${bin_SCRIPTS} " "; do \ test ! -f $$ODIR/$$i || echo "*** $$i is also in $$ODIR!"; \ done # +$(DEPDIR)/deps-ver: $(top_srcdir)/deps-ver + @[ -f $@ ] || \ + cp $(top_srcdir)/deps-ver $@ + @[ -w $@ ] || \ + chmod ug+w $@ + @cmp $(top_srcdir)/deps-ver $@ > /dev/null || ( \ + $(MAKE) clean && \ + echo -n "Prior $(subdir)/$(DEPDIR) version " && \ + cat $@ && \ + rm -rf $(DEPDIR) && \ + mkdir $(DEPDIR) && \ + case "$(top_builddir)" in \ + .) \ + ./config.status Makefile depfiles \ + ;; \ + ..) \ + cd .. && \ + ./config.status $(subdir)/Makefile depfiles && \ + cd $(subdir) \ + ;; \ + *) \ + echo 'Fatal: depsver.mf Automake fragment limited' \ + 'to immediate subdirectories.' && \ + echo "top_builddir: $(top_builddir)" && \ + echo "subdir: $(subdir)" && \ + exit 1 \ + ;; \ + esac && \ + echo -n "Cleaned $(subdir)/$(DEPDIR) version " && \ + cat $(top_srcdir)/deps-ver \ + ) + cp $(top_srcdir)/deps-ver $@ + +.deps-ver: $(top_srcdir)/deps-ver + @[ ! -d $(DEPDIR) ] || $(MAKE) $(DEPDIR)/deps-ver + @touch $@ + +# +# depsver.mf included in Makefile.am for directories with .deps +# +# When building in the same directory with sources that change over +# time, such as when tracking using bk, the .deps files can become +# stale with respect to moved, deleted, or superceded headers. Most +# commonly, this would exhibit as make reporting a failure to make a +# header file which is no longer in the location given. To address +# this issue, we use a deps-ver file which is updated with each change +# that breaks old .deps files. A copy of deps-ver is made into +# $(DEPDIR) if not already present. If $(DEPDIR)/deps-ver is present +# with different contents than deps-ver, we make clean to ensure all +# .o files built before the incompatible change are rebuilt along with +# their updated .deps files, then remove $(DEPDIR) and recreate it as +# empty stubs. +# +# It is normal when configured with --disable-dependency-tracking for +# the DEPDIR to not have been created. For this reason, we use the +# intermediate target .deps-ver, which invokes make recursively if +# DEPDIR exists. +# +# If you modify depsver.mf, please make the changes to the master +# copy, the one in sntp is copied by the bootstrap script from it. +# +# This comment block follows rather than leads the related code so that +# it stays with it in the generated Makefile.in and Makefile. +# # 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/sntp/README b/sntp/README deleted file mode 100644 index d7738e9..0000000 --- a/sntp/README +++ /dev/null @@ -1,536 +0,0 @@ -SNTP (Simple Network Time Protocol Utility) - Version 1.6 ----------------------------------------------------------- - -Please read the file Copyright first. Also note that the file RFC2030.TXT is -David Mills's copyright and not the author's - it is just a copy of the RFC -that is available from so many Internet archives. - -RFC 1305 (Network Time Protocol - NTP) is an attempt to provide globally -consistent timestamps in an extremely hostile environment; it is fiendishly -complicated and an impressive piece of virtuosity. RFC 2030 (Simple Network -Time Protocol - SNTP) which supersedes RFC 1769 describes a subset of this that -will give excellent accuracy in most environments encountered in practice; it -uses only the obvious algorithms that have been used since time immemorial. - -WARNING: the text version of RFC 1305 is incomplete, and omits the tables that -are in the Postscript version. Unfortunately, these contain the only copy of -some critical information. - -draft-mills-sntp-v4-00.txt is the next proposed revision of RFC 2030, -and the current goal is to have this code implement that specification. - -SNTP Servers - Some Little-Known Facts --------------------------------------- - -RFC 2030 states that SNTP clients should be used only at the lowest level, -which is good practice. It then states that SNTP servers should be used only -at stratum 1 (i.e. top level), which is bizarre! A far saner use of them would -be for the very lowest level of server, exporting solely to local clients that -do not themselves act as servers to ANY system (e.g. on a Netware server, -exporting only to the PCs that it manages). - -[There is missing language in the previous paragraph. SNTP is designed -to be used in 2 cases: as a client at the lowest levels of the timing -hierarchy, or as a server of last resort at stratum 1 when connected to -a modem or radio clock.] - -[This is as far as I have updated this file as part of the upgrade.] - -If the NTP network were being run as a directed acyclic graph (i.e. using SNTP -rather than full NTP), with a diameter of D links and a maximum error per link -of E, the maximum synchronisation error would be D*E. Reasonable figures for D -and E are 5 and 0.1 seconds, so this would be adequate for most uses. Note -that the fact that the graph is acyclic is critical, which is one reason why -SNTP client/servers must NEVER be embedded WITHIN an NTP network. - -The other reason is that inserting SNTP client/servers at a low stratum (but -not the root) of an NTP network could easily break NTP! See RFC 1305 for why, -but don't expect the answer to stand out at you. It would be easy to extend -SNTP to a full-function client/server application, thus making it into a true -alternative to ntp, but this incompatibility is why it MUST NOT be done. - -The above does not mean that the SNTP approach is unsatisfactory, but only that -it is incompatible with full NTP. The author would favour a complete SNTP -network using the SNTP approach, and the statistical error reduction used in -SNTP, but it actually addresses a slightly different problem from that -addressed by NTP. TANSTAAFL. - -FINAL WARNING: do NOT use this program to serve NTP requests from outside the -systems that you manage. If you do this, and manage to break the time -synchronisation on other people's systems, you will be regarded very -unfavourably. Actually, this should be possible only if their NTP client is -completely broken, because SNTP does its damnedest to declare its packets as -the lowest form of NTP timestamp. - - - -SNTP and its Assumptions -------------------------- - -SNTP is intended to be a straightforward SNTP daemon/utility that is easy to -build on any reasonable Unix platform (and most near-Unix ones), whether or not -it has ever been ported to them before. It is intended to answer the following -requirements, either by challenge and response or the less reliable broadcast -method: - - A simple command to run on Unix systems that will check the time - and optionally drift compared with a known, local and reliable NTP - time server. No privilege is required just to read the time and - estimate the drift. - - A client for Unix systems that will synchronise the time from a known, - local and reliable NTP time server. This is probably the most common - one, and the need that caused the program to be written. - - A server for Unix systems that are synchronised other than by NTP - methods and that need to synchronise other systems by NTP. This is - the classroom of PCs with a central server scenario. It is NOT - intended to work as a peer with true NTP servers, and won't. - - A simple method by which two or more Unix systems can keep themselves - synchronised using what is becoming a standard protocol. Yes, I know - that there are half-a-dozen other such methods. - - A base for building non-Unix SNTP clients. Some 3/4 of the code - (including all of the complicated algorithms and NTP packet handling) - should work, unchanged, on any system with an ANSI/ISO C compiler. - -There are full tracing facilities and a lot of paranoia in the code to check -for bad packets (more than in ntp) which may need relaxing in the light of -experience. Unfortunately, RFC 1305 does not include a precise description of -the data protocol, despite its length, and there are some internal -inconsistencies and differences between it and RFC 2030 and ntp's behaviour. - -WARNING: SNTP has not been tested in conjunction with ntp broadcasts or ntp -clients, as the ability to do so was not available to the author. It is very -unlikely that it won't work, but you should check. Much of the paranoid code -is only partially tested, too, because it is dealing with cases that are very -hard to provoke. - -It assumes that the local network is tolerably secure and that any accessible -NTP or SNTP servers are trustworthy. It also makes no attempt to check that -it has been installed and is being used correctly (e.g. at an appropriate -priority) or that the changes it makes have the desired effect. When you first -use it, you should both run it in display mode and use the date command as a -cross-check. - -Furthermore, it does not attempt to solve all of the problems addressed by the -NTP protocol and you should NOT use it if any of those problems are likely to -cause you serious trouble. If they are, bite the bullet and implement ntp, or -buy a fancy time-server. - - -Building SNTP -------------- - -The contents of the distribution are: - -README - this file -Copyright - the copyright notice and conditions of use -Makefile - the makefile, with comments for several systems -header.h - the main header (almost entirely portable) -kludges.h - dirty kludges for difficult systems -internet.h - a very small header for internet.c and socket.c -main.c - most of the source (almost entirely portable) -unix.c - just for isatty, sleep and locking -internet.c - Internet host and service name lookup -socket.c - the Berkeley socket code -sntp.1 - the man page -RFC2030.TXT - the SNTPv4 specification - -All you SHOULD need to do is to uncomment the settings in file Makefile for -your system or to add new ones. But real life is not always so simple. As -POSIX does not yet define sub-second timers, Internet addressing facilities, -sockets etc., the code has to rely on the facilities described in the -ill-defined and non-standard 'X/Open' documents and the almost totally -unspecified 'BSD' extensions. - -Most hacks should be limited to the compiler options (e.g. setting flags like -_XOPEN_SOURCE), but perverse systems may need additions to kludges.h - please -report them to the author. See Makefile and kludges.h for documentation on -the standard hacks - there only 6, and most are only for obsolete systems. -But, generally, using the generic set of C options usually works with no -further ado. - - -Sick, Bizarre or non-Unix Systems ---------------------------------- - -A very few Unix systems and almost all non-Unix systems may need changes to the -code, such as: - - If the system doesn't have Berkeley sockets, you will need to replace - socket.c and possibly modify internet.h and internet.c. All of the - systems for which the author needs this have Berkeley sockets. - - NTP is supposedly an Internet protocol, but is not Internet specific. - For other types of network, you will need to replace internet.c and - probably modify internet.h. - - If the system doesn't have gettimeofday or settimeofday, you will - need to modify timing.c. If it doesn't have adjtime (e.g. HP-UX - on PA-RISC before 10.0), you can set -DADJTIME_MISSING and the code - will compile but the -a option will always give an error. - - If the system has totally broken signal handling, the program will - hang or crash if it can't reach its name server or responses time - out. You may be able to improve matters by hacking internet.c and - socket.c, but don't bet on it. - - If the the program won't be able to create files in /etc when - updating the clock, you can use another lock file or even set - -DLOCKFILE=NULL, which will disable the locking code entirely. On - systems that have it, using /var/run would be better than /etc. - - If the the program hangs when flushing outstanding packets (which - you can tell by setting -W), it may help to set -DNONBLOCK_BROKEN. - This seems needed only for obsolete systems, like Ultrix. - - If the system isn't Unix, even vaguely, you will probably need to - modify all of the above, and unix.c as well. - - Note that adjtime is commonly sick, but you don't need to change the - code - just use the -r option whan making large corrections (see below - for more details). - -Any changes needed to header.h or main.c are bugs. They may be bugs in the -code or in the compiler or libraries, but they are bugs. Please prod the -people responsible and tell the author, who may be able to bypass them cleanly -even if they aren't bugs in his code. The code also makes the following -assumptions, which would be quite hard to remove: - - 8-bit bytes. Strictly, neither ANSI/ISO C nor POSIX require these, - and there were some very early versions of Unix on systems with other - byte sizes. But, without a defined sub-byte facility in C, .... - - At least 32-bit ints. Well, actually, this wouldn't be too hard to - remove. But most Unix programs make this assumption, and I have very - little interest in the more rudimentary versions of MS-DOS etc. - - An ANSI/ISO C compiler. It didn't seem worth writing dual-language - code in 1996. Tough luck if you haven't got one. - - Tolerably efficient floating-point arithmetic, with at least 13 digits - (decimal), preferably 15, in the mantissa of doubles. Ditto. If you - want to port this to a toaster, please accept my insincerest sympathies - and don't bother me. - - A trustworthy local network. It does not check for DNS, Ethernet, - packet or other spoofing, and assumes that any accessible NTP or SNTP - servers are properly synchronised. - - -Warnings about Installation and Use ------------------------------------ - -Anyone attempting to fiddle with the clock on their system should already know -how to write system administration scripts, install daemons and so on. There -are a few warnings: - - Don't use the broadcast modes unless you really have to, as the - client-server modes are far more reliable. The broadcast modes were - implemented more for virtuosity (a.k.a. SNTP conformance) than use. - In particular, the error estimates are mere guesses, and may be low - or even very low. And even reading broadcasts needs privilege. - - The program is not intended to be installed setuid or setgid, and - doing so is asking for trouble. Its ownerships and access modes are - not important. It need not be run by root for merely displaying the - time (even in daemon mode). - - The program does not need to run at a high priority (low in Unix - terms!) even when being used to set the clock or as a server, except - when the '-r' option is used. However, doing so may improve its - accuracy. - - Unlike NTP, the SNTP protocol contains no protection against - client-server loops. If you set one up, your systems will spin - themselves off into a disconnected vortex of unreality! - - It will get very confused if another process changes the local time - while it is running. There is some locking code in unix.c to prevent - this program doing this to itself, but it will protect only against - some errors. However, the remaining failures should be harmless. - - Don't run it as a server unless you REALLY know what you are doing. - It should be used as a server only on a system that is properly - synchronised, by fair means or foul. If it isn't, you will simply - perpetrate misinformation. And remember that broadcasts are most - unpopular with overloaded administrators of overloaded networks. - - Watch out for multi-server broadcasts and systems with multiple ports - onto the same Ethernet; there is some code to protect against this, - but it is still easy to get confused. - - Don't put the lock file onto an automounted partition or delete it by - hand, unless you really want to start two daemons at the same time. - Both will probably fail horribly if you do this. - - The daemon save file is checked fairly carefully, but should be in a - reasonably safe directory, unless you want hackers to cause trouble. - /tmp is safe enough on most systems, but not all - /etc is better. - - -Installing and Using the Program --------------------------------- - -Start by copying the executable and man page to where you want them. If you -want only to display the time and as a replacement for the rdate or date -commands, the installation is finished! - -You can use it as a simple unprivileged command to check the time, quite -independently of whether it is running as a time-updating daemon or server, or -whether you are running ntp. You can run it in daemon mode without updating -the clock, to check for drift, but it may fail if the clock is changed under -its feet. Unfortunately, you cannot listen to broadcasts without privilege. - -If it is used with the -a option to keep the time synchronised, it is best to -run it as one of root's cron jobs - for many systems, running it once a day -should be adequate, but it will depend on the reliability of the local clock. -The author runs it this way with -a and -x - see below. - -If it is used with the -r option to set the time (instead of the rdate or date -commands), it should be used interactively and either on a lightly loaded -system or at a high priority. You should then check the result by running it -in display mode. - -You are advised NOT to run it with the -r option in a cron job, though this is -not locked out. If you have to (for example under HP-UX before 10.0), be sure -to run it as the highest priority that will not cause other system problems and -set the maximum automatic change to as low a value as you can get away with. - -WARNING: adjtime is more than a bit sick on many systems, and will ignore large -corrections, usually without any form of hint that it has done so. It is often -(even usually) necessary to reset the clock to approximately the right time -using the -r option before using the -a and -x options to keep it correct. - -It can be started as a time-updating daemon with the -a and -x options (or -r -and -x if you must), and will perform some limited drift correction. In this -case, start it from any suitable system initialisation script and leave it -running. Note that it will stop if it thinks that the time difference or drift -has got out of control, and you will need to reset the time and restart it by -hand. - -In daemon mode, it will survive its time server or network disappearing for a -while, but will eventually fail, and will fail immediately if the network call -returns an unexpected error. If this is a problem, you can start it (say, -hourly or nightly) from cron, and it will fail if it is already running -(provided that you haven't disabled or deleted the lock file). - -If it is used as a server, it should be started from any suitable system -initialisation script, just like any other daemon. It must be started after -the networking, of course. To run it in both server modes, start one copy with -the -B option and one with the -S option. - - -Simple Examples of Use ----------------------- - -Many people use it solely to check the time of their system, especially as a -cross-check on ntpd. You do not need privilege and it will not cause trouble -to the local network, so you can use it on someone else's system! You can -specify one server or several. For example: - - msntp ntp.server.local ntp.server.neighbour - -You can use it to check how your system is drifting, but it isn't very good at -this if the system is drifting very badly (in which case use the previous -technique and dc) or if you are running ntp. You do not need privilege and it -will not cause trouble to the local network. For example: - - sntp -x 120 -f /tmp/msntp.state ntp.server.local - -More generally, it is used to synchronise the clock, in which case you DO need -root privilege. It can be used in many ways, but the author favours running it -in daemon mode, started from a cron job, which will restart after power cuts -with no attention, and send a mail message (if cron is configured to do that) -when it fails badly. For example, the author uses a root crontab entry on one -system of: - - 15 0 * * * /bin/nice --10 /usr/local/bin/sntp -a -x 480 ntp.server.local - -If you have a home computer, it can be set up to resynchronise each time you -dial up. For example, the author uses a /etc/ppp/ip-up.d/sntp file on his -home Linux system of: - - #!/bin/sh - sleep 60 - /bin/nice --10 /usr/local/sbin/sntp -r -P 60 ntp.server.local - --a would be better, but adjtime is broken in Linux. - - -Debugging or Hacking the Program --------------------------------- - -Almost everybody who does this is likely to need to modify only the system -interfaces. While they are messy, they are pretty simple and have a simple -specification. This is documented in comments in the source. This is -described above. - -The main program SHOULD need no attention, though it may need the odd tweak to -bypass compiler problems - please report these, if you encounter any. If -something looks odd while it is running, start by setting the -v option (lower -case), as for investigating network problems, and checking any diagnostics that -appear. Note that most of it can be checked in display mode without harming -your system. - -The client will sometimes give up, complaining about inconsistent timestamps or -similar. This can be caused by the server being rebooted and similar glitches -to the time - unfortunately, there is no reliable way to tell an ignorable -fluctuation from a server up the spout. If this happens annoyingly often, -the -V option may help tie down the problem. In actual use, it is simplest -just to restart the client in a cron job! - -If it needs more than this, then you will need to debug the source seriously. -Start by putting an icepack on your head and pouring yourself a large whisky! -While it is commented, it is not well commented, and much of the code interacts -in complex and horrible ways. This isn't so much because it lacks 'structure' -as because one part needs to make assumptions about the numerical properties of -another. - -The -W option (upper case) will print out a complete trace of everything it -does, and this should be enough to tie down the problem. It does distort the -timing a bit, but not usually too badly. However, wading through that amount -of gibberish (let alone looking at the source) is not a pleasant task. If you -are pretty sure that you have a bug, you may tell the author, and he may ask -for a copy of the output - but he will reply rudely if you send thousands of -lines of tracing to him by Email! - -Note that there are a fair number of circumstances where its error recovery -could be better, but is left as it is to keep the code simple. Most of these -should be pretty rare. - - -Changes in Version 1.2 ----------------------- - -The main change was the addition of the daemon mode for drift correction (i.e. -the -x option). The daemon code is complex and has a lot of special-casing for -strange circumstances, not all of which are testable in practice. - -A lot of the code was reordered while doing this. The output was slightly -different - considerably different with -V. - -The error estimation for broadcasts was modified, and should bear more relation -to reality. It remains a guess, as there is no way to get decent error error -estimates under such circumstances. - -The -B option is now in minutes, and has a different permissible range and -default value. - -The argument consistency checking for broadcasts was tightened up a bit, and a -few other internal checks added. These should not affect any reasonable -requirement. - -A couple of new functions were added to the portability base, but they don't -use any non-standard new facilities. However, the specification of the -functions has changed slightly. - - -Changes in Version 1.3 ----------------------- - -The main change was the addition of the restarting facility for daemon mode -(i.e. the -f option), which is pretty straightforward. - -There were also a lot of minor changes to the paranoia code in daemon mode, to -try to separate out the case of a demented server from network and other -'ignorable' problems. These are not entirely successful. - - -Changes in Version 1.4 and 1.5 ------------------------------- - -There turned out to be a couple of places where the author misunderstood the -specification of NTP, which affect only its use in server mode. The main -change is to use stratum 15 instead of stratum 0. - -And there were some more relaxations of the paranoia code, to allow for more -erratic servers, plus a kludge to improve restarting in daemon mode after a -period of down time has unsynchronised the clock. There is also an -incompatible change to the debugging options to add a new level - the old -V -option is now -W, and -V is an intermediate one for debugging daemon mode - but -they are both hacker's facilities, and not for normal use. - -Version 1.5 adds some very minor fixes. - - -Changes in Version 1.6 ----------------------- - -The first change is support for multiple server addresses - it uses these in a -round-robin fashion. This may be useful when you have access to several -servers, all of which are a bit iffy. This means that the restart file format -is incompatible with msntp 1.5. - -It has also been modified to reset itself automatically after detecting an -inconsistency in its server's timestamps, because the author got sick of the -failures. It writes a comment to syslog (uniquely) in such cases. - -The ability to query a daemon save file was added. - -Related to the above, the -E argument has been redefined to mean an error bound -on various internal times (which is what it had become, anyway) and a -P option -introduced to be what the -E argument was documented to be. - -The lock and save file handling have been changed to allow defaults to be set -at installation time, and to be overridable at run-time. To disable these -at either stage, simply set the file names to the null string. - -And there have been the usual changes for portability, as standards have been -modified and/or introduced. - - -Future Versions ---------------- - -There are unlikely to be any, except probably one to fix bugs in version 1.6. - -I attempted to put support for intermittent connexions (e.g. dial-up) into the -daemon mode, but doing so needs so much code reorganisation that it isn't worth -it. What needs doing for that is to separate the socket handling from the -timekeeping, so that they can be run asynchronously (either in separate -processes or threads), and to look up a network name and open a socket only -when prodded (and to close it immediately thereafter). So just running it -with the -r option is the current best solution. - -I also attempted to put support for the "Unix 2000" interfaces into the code. -Ha, ha. Not merely do very few systems define socklen_t (needed for IPv6 -support), but "Unix 2000" neither addresses the leap second problem nor even -provides an adjtime replacement! Some function like the latter is critical, -not so much because of the gradual change, but because of its atomicity; -without it, msntp really needs to be made non-interruptible, and that brings in -a ghastly number of system-dependencies. - -Realistically, it needs a complete rewrite before adding any more function. -And, worse, the Unix 'standards' need fixing, too. - - - -Miscellaneous -------------- - -Thanks are due to Douglas M. Wells of Connection Technologies for helping the -author with several IP-related conventions, to Sam Nelson of Stirling -University for testing it on some very strange systems, and to David Mills for -clarifying what the NTP specification really is. - -Thanks are also due to several other people with locating bugs, finding -appropriate options for the Makefile and passing on extension code and -suggestions. As I am sure to leave someone out, I shall not name anyone else. - -Version 1.0 - October 1996. -Version 1.1 - November 1996 - mainly portability improvements. -Version 1.2 - January 1997 - mainly drift handling, but much reorganisation. -Version 1.3 - February 1997 - daemon save file, and some robustness changes. -Version 1.4 - May 1997 - relatively minor fixes, more diagnostic levels etc. -Version 1.5 - December 1997 - some very minor fixes -Version 1.6 - October 2000 - quite a few miscellaneous changes - - -Nick Maclaren, -University of Cambridge Computer Laboratory, -New Museums Site, Pembroke Street, Cambridge CB2 3QG, England. -Email: nmm1@cam.ac.uk -Tel.: +44 1223 334761 Fax: +44 1223 334679 diff --git a/sntp/aclocal.m4 b/sntp/aclocal.m4 index 1994696..f371c52 100644 --- a/sntp/aclocal.m4 +++ b/sntp/aclocal.m4 @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.11 -*- Autoconf -*- +# generated automatically by aclocal 1.11.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. @@ -13,6176 +13,12 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],, -[m4_warning([this file was generated for autoconf 2.65. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, +[m4_warning([this file was generated for autoconf 2.68. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- - -# serial 47 AC_PROG_LIBTOOL - - -# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) -# ----------------------------------------------------------- -# If this macro is not defined by Autoconf, define it here. -m4_ifdef([AC_PROVIDE_IFELSE], - [], - [m4_define([AC_PROVIDE_IFELSE], - [m4_ifdef([AC_PROVIDE_$1], - [$2], [$3])])]) - - -# AC_PROG_LIBTOOL -# --------------- -AC_DEFUN([AC_PROG_LIBTOOL], -[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl -dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX -dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. - AC_PROVIDE_IFELSE([AC_PROG_CXX], - [AC_LIBTOOL_CXX], - [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX - ])]) -dnl And a similar setup for Fortran 77 support - AC_PROVIDE_IFELSE([AC_PROG_F77], - [AC_LIBTOOL_F77], - [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 -])]) - -dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. -dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run -dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. - AC_PROVIDE_IFELSE([AC_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [ifdef([AC_PROG_GCJ], - [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) - ifdef([A][M_PROG_GCJ], - [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) - ifdef([LT_AC_PROG_GCJ], - [define([LT_AC_PROG_GCJ], - defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) -])])# AC_PROG_LIBTOOL - - -# _AC_PROG_LIBTOOL -# ---------------- -AC_DEFUN([_AC_PROG_LIBTOOL], -[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl -AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl -AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl -AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -# Prevent multiple expansion -define([AC_PROG_LIBTOOL], []) -])# _AC_PROG_LIBTOOL - - -# AC_LIBTOOL_SETUP -# ---------------- -AC_DEFUN([AC_LIBTOOL_SETUP], -[AC_PREREQ(2.50)dnl -AC_REQUIRE([AC_ENABLE_SHARED])dnl -AC_REQUIRE([AC_ENABLE_STATIC])dnl -AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_LD])dnl -AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl -AC_REQUIRE([AC_PROG_NM])dnl - -AC_REQUIRE([AC_PROG_LN_S])dnl -AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! -AC_REQUIRE([AC_OBJEXT])dnl -AC_REQUIRE([AC_EXEEXT])dnl -dnl - -AC_LIBTOOL_SYS_MAX_CMD_LEN -AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -AC_LIBTOOL_OBJDIR - -AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl -_LT_AC_PROG_ECHO_BACKSLASH - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e 1s/^X//' -[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] - -# Same as above, but do not quote variable references. -[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" - -AC_CHECK_TOOL(AR, ar, false) -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(STRIP, strip, :) - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$SED" && SED=sed -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" - ;; - *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -_LT_CC_BASENAME([$compiler]) - -# Only perform the check for file, if the check method requires it -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - AC_PATH_MAGIC - fi - ;; -esac - -AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) -AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], -enable_win32_dll=yes, enable_win32_dll=no) - -AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -AC_ARG_WITH([pic], - [AC_HELP_STRING([--with-pic], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [pic_mode="$withval"], - [pic_mode=default]) -test -z "$pic_mode" && pic_mode=default - -# Use C for the default configuration in the libtool script -tagname= -AC_LIBTOOL_LANG_C_CONFIG -_LT_AC_TAGCONFIG -])# AC_LIBTOOL_SETUP - - -# _LT_AC_SYS_COMPILER -# ------------------- -AC_DEFUN([_LT_AC_SYS_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_AC_SYS_COMPILER - - -# _LT_CC_BASENAME(CC) -# ------------------- -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -AC_DEFUN([_LT_CC_BASENAME], -[for cc_temp in $1""; do - case $cc_temp in - compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; - distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` -]) - - -# _LT_COMPILER_BOILERPLATE -# ------------------------ -# Check for compiler boilerplate output or warnings with -# the simple compiler test code. -AC_DEFUN([_LT_COMPILER_BOILERPLATE], -[ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* -])# _LT_COMPILER_BOILERPLATE - - -# _LT_LINKER_BOILERPLATE -# ---------------------- -# Check for linker boilerplate output or warnings with -# the simple link test code. -AC_DEFUN([_LT_LINKER_BOILERPLATE], -[ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* -])# _LT_LINKER_BOILERPLATE - - -# _LT_AC_SYS_LIBPATH_AIX -# ---------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], -[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi],[]) -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -])# _LT_AC_SYS_LIBPATH_AIX - - -# _LT_AC_SHELL_INIT(ARG) -# ---------------------- -AC_DEFUN([_LT_AC_SHELL_INIT], -[ifdef([AC_DIVERSION_NOTICE], - [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -$1 -AC_DIVERT_POP -])# _LT_AC_SHELL_INIT - - -# _LT_AC_PROG_ECHO_BACKSLASH -# -------------------------- -# Add some code to the start of the generated configure script which -# will find an echo command which doesn't interpret backslashes. -AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], -[_LT_AC_SHELL_INIT([ -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` - ;; -esac - -echo=${ECHO-echo} -if test "X[$]1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X[$]1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then - # Yippee, $echo works! - : -else - # Restart under the correct shell. - exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} -fi - -if test "X[$]1" = X--fallback-echo; then - # used as fallback echo - shift - cat <<EOF -[$]* -EOF - exit 0 -fi - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test -z "$ECHO"; then -if test "X${echo_test_string+set}" != Xset; then -# find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if (echo_test_string=`eval $cmd`) 2>/dev/null && - echo_test_string=`eval $cmd` && - (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null - then - break - fi - done -fi - -if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : -else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$echo" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - echo='print -r' - elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} - else - # Try using printf. - echo='printf %s\n' - if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - echo="$CONFIG_SHELL [$]0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$CONFIG_SHELL [$]0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do - if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "[$]0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} - else - # Oops. We lost completely, so just stick with echo. - echo=echo - fi - fi - fi - fi -fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -ECHO=$echo -if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then - ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" -fi - -AC_SUBST(ECHO) -])])# _LT_AC_PROG_ECHO_BACKSLASH - - -# _LT_AC_LOCK -# ----------- -AC_DEFUN([_LT_AC_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_LANG_PUSH(C) - AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], -[*-*-cygwin* | *-*-mingw* | *-*-pw32*) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; - ]) -esac - -need_locks="$enable_libtool_lock" - -])# _LT_AC_LOCK - - -# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], -[AC_REQUIRE([LT_AC_PROG_SED]) -AC_CACHE_CHECK([$1], [$2], - [$2=no - ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - fi - $rm conftest* -]) - -if test x"[$]$2" = xyes; then - ifelse([$5], , :, [$5]) -else - ifelse([$6], , :, [$6]) -fi -])# AC_LIBTOOL_COMPILER_OPTION - - -# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ------------------------------------------------------------ -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], -[AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - else - $2=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - ifelse([$4], , :, [$4]) -else - ifelse([$5], , :, [$5]) -fi -])# AC_LIBTOOL_LINKER_OPTION - - -# AC_LIBTOOL_SYS_MAX_CMD_LEN -# -------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], -[# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ - = "XX$teststring") >/dev/null 2>&1 && - new_result=`expr "X$teststring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - teststring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - ;; - esac -]) -if test -n $lt_cv_sys_max_cmd_len ; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -])# AC_LIBTOOL_SYS_MAX_CMD_LEN - - -# _LT_AC_CHECK_DLFCN -# -------------------- -AC_DEFUN([_LT_AC_CHECK_DLFCN], -[AC_CHECK_HEADERS(dlfcn.h)dnl -])# _LT_AC_CHECK_DLFCN - - -# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, -# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -# ------------------------------------------------------------------ -AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], -[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -if test "$cross_compiling" = yes; then : - [$4] -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<EOF -[#line __oline__ "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include <dlfcn.h> -#endif - -#include <stdio.h> - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -}] -EOF - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) $1 ;; - x$lt_dlneed_uscore) $2 ;; - x$lt_unknown|x*) $3 ;; - esac - else : - # compilation failed - $3 - fi -fi -rm -fr conftest* -])# _LT_AC_TRY_DLOPEN_SELF - - -# AC_LIBTOOL_DLOPEN_SELF -# ------------------- -AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], -[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ]) - ;; - - *) - AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen="shl_load"], - [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], - [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen="dlopen"], - [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], - [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], - [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) - ]) - ]) - ]) - ]) - ]) - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - AC_CACHE_CHECK([whether a program can dlopen itself], - lt_cv_dlopen_self, [dnl - _LT_AC_TRY_DLOPEN_SELF( - lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, - lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) - ]) - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - AC_CACHE_CHECK([whether a statically linked program can dlopen itself], - lt_cv_dlopen_self_static, [dnl - _LT_AC_TRY_DLOPEN_SELF( - lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, - lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) - ]) - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi -])# AC_LIBTOOL_DLOPEN_SELF - - -# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) -# --------------------------------- -# Check to see if options -c and -o are simultaneously supported by compiler -AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl -AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], - [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], - [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then - _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . 2>&AS_MESSAGE_LOG_FD - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* -]) -])# AC_LIBTOOL_PROG_CC_C_O - - -# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) -# ----------------------------------------- -# Check to see if we can do hard links to lock some files if needed -AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], -[AC_REQUIRE([_LT_AC_LOCK])dnl - -hard_links="nottested" -if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - AC_MSG_CHECKING([if we can lock with hard links]) - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - AC_MSG_RESULT([$hard_links]) - if test "$hard_links" = no; then - AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) - need_locks=warn - fi -else - need_locks=no -fi -])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS - - -# AC_LIBTOOL_OBJDIR -# ----------------- -AC_DEFUN([AC_LIBTOOL_OBJDIR], -[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -[rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null]) -objdir=$lt_cv_objdir -])# AC_LIBTOOL_OBJDIR - - -# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) -# ---------------------------------------------- -# Check hardcoding attributes. -AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_AC_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ - test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \ - test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then - - # We can hardcode non-existant directories. - if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && - test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then - # Linking always hardcodes the temporary library directory. - _LT_AC_TAGVAR(hardcode_action, $1)=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_AC_TAGVAR(hardcode_action, $1)=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - _LT_AC_TAGVAR(hardcode_action, $1)=unsupported -fi -AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) - -if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi -])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH - - -# AC_LIBTOOL_SYS_LIB_STRIP -# ------------------------ -AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], -[striplib= -old_striplib= -AC_MSG_CHECKING([whether stripping libraries is possible]) -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) -fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -])# AC_LIBTOOL_SYS_LIB_STRIP - - -# AC_LIBTOOL_SYS_DYNAMIC_LINKER -# ----------------------------- -# PORTME Fill in your ld.so characteristics -AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], -[AC_MSG_CHECKING([dynamic linker characteristics]) -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib<name>.so - # instead of lib<name>.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[[45]]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[[123]]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[[01]]* | freebsdelf3.[[01]]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -AC_MSG_RESULT([$dynamic_linker]) -test "$dynamic_linker" = no && can_build_shared=no -])# AC_LIBTOOL_SYS_DYNAMIC_LINKER - - -# _LT_AC_TAGCONFIG -# ---------------- -AC_DEFUN([_LT_AC_TAGCONFIG], -[AC_ARG_WITH([tags], - [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], - [include additional configurations @<:@automatic@:>@])], - [tagnames="$withval"]) - -if test -f "$ltmain" && test -n "$tagnames"; then - if test ! -f "${ofile}"; then - AC_MSG_WARN([output file `$ofile' does not exist]) - fi - - if test -z "$LTCC"; then - eval "`$SHELL ${ofile} --config | grep '^LTCC='`" - if test -z "$LTCC"; then - AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) - else - AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) - fi - fi - - # Extract list of available tagged configurations in $ofile. - # Note that this assumes the entire list is on one line. - available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` - - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for tagname in $tagnames; do - IFS="$lt_save_ifs" - # Check whether tagname contains only valid characters - case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in - "") ;; - *) AC_MSG_ERROR([invalid tag name: $tagname]) - ;; - esac - - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null - then - AC_MSG_ERROR([tag name \"$tagname\" already exists]) - fi - - # Update the list of available tags. - if test -n "$tagname"; then - echo appending configuration tag \"$tagname\" to $ofile - - case $tagname in - CXX) - if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - AC_LIBTOOL_LANG_CXX_CONFIG - else - tagname="" - fi - ;; - - F77) - if test -n "$F77" && test "X$F77" != "Xno"; then - AC_LIBTOOL_LANG_F77_CONFIG - else - tagname="" - fi - ;; - - GCJ) - if test -n "$GCJ" && test "X$GCJ" != "Xno"; then - AC_LIBTOOL_LANG_GCJ_CONFIG - else - tagname="" - fi - ;; - - RC) - AC_LIBTOOL_LANG_RC_CONFIG - ;; - - *) - AC_MSG_ERROR([Unsupported tag name: $tagname]) - ;; - esac - - # Append the new tag name to the list of available tags. - if test -n "$tagname" ; then - available_tags="$available_tags $tagname" - fi - fi - done - IFS="$lt_save_ifs" - - # Now substitute the updated list of available tags. - if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then - mv "${ofile}T" "$ofile" - chmod +x "$ofile" - else - rm -f "${ofile}T" - AC_MSG_ERROR([unable to update list of available tagged configurations.]) - fi -fi -])# _LT_AC_TAGCONFIG - - -# AC_LIBTOOL_DLOPEN -# ----------------- -# enable checks for dlopen support -AC_DEFUN([AC_LIBTOOL_DLOPEN], - [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) -])# AC_LIBTOOL_DLOPEN - - -# AC_LIBTOOL_WIN32_DLL -# -------------------- -# declare package support for building win32 DLLs -AC_DEFUN([AC_LIBTOOL_WIN32_DLL], -[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) -])# AC_LIBTOOL_WIN32_DLL - - -# AC_ENABLE_SHARED([DEFAULT]) -# --------------------------- -# implement the --enable-shared flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_SHARED], -[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([shared], - [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_shared=]AC_ENABLE_SHARED_DEFAULT) -])# AC_ENABLE_SHARED - - -# AC_DISABLE_SHARED -# ----------------- -#- set the default shared flag to --disable-shared -AC_DEFUN([AC_DISABLE_SHARED], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_SHARED(no) -])# AC_DISABLE_SHARED - - -# AC_ENABLE_STATIC([DEFAULT]) -# --------------------------- -# implement the --enable-static flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_STATIC], -[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([static], - [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_static=]AC_ENABLE_STATIC_DEFAULT) -])# AC_ENABLE_STATIC - - -# AC_DISABLE_STATIC -# ----------------- -# set the default static flag to --disable-static -AC_DEFUN([AC_DISABLE_STATIC], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_STATIC(no) -])# AC_DISABLE_STATIC - - -# AC_ENABLE_FAST_INSTALL([DEFAULT]) -# --------------------------------- -# implement the --enable-fast-install flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_FAST_INSTALL], -[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([fast-install], - [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) -])# AC_ENABLE_FAST_INSTALL - - -# AC_DISABLE_FAST_INSTALL -# ----------------------- -# set the default to --disable-fast-install -AC_DEFUN([AC_DISABLE_FAST_INSTALL], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_FAST_INSTALL(no) -])# AC_DISABLE_FAST_INSTALL - - -# AC_LIBTOOL_PICMODE([MODE]) -# -------------------------- -# implement the --with-pic flag -# MODE is either `yes' or `no'. If omitted, it defaults to `both'. -AC_DEFUN([AC_LIBTOOL_PICMODE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -pic_mode=ifelse($#,1,$1,default) -])# AC_LIBTOOL_PICMODE - - -# AC_PROG_EGREP -# ------------- -# This is predefined starting with Autoconf 2.54, so this conditional -# definition can be removed once we require Autoconf 2.54 or later. -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], -[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], - [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi]) - EGREP=$ac_cv_prog_egrep - AC_SUBST([EGREP]) -])]) - - -# AC_PATH_TOOL_PREFIX -# ------------------- -# find a file program which can recognise shared library -AC_DEFUN([AC_PATH_TOOL_PREFIX], -[AC_REQUIRE([AC_PROG_EGREP])dnl -AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[case $MAGIC_CMD in -[[\\/*] | ?:[\\/]*]) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="ifelse([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$1; then - lt_cv_path_MAGIC_CMD="$ac_dir/$1" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac]) -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -])# AC_PATH_TOOL_PREFIX - - -# AC_PATH_MAGIC -# ------------- -# find a file program which can recognise a shared library -AC_DEFUN([AC_PATH_MAGIC], -[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# AC_PATH_MAGIC - - -# AC_PROG_LD -# ---------- -# find the pathname to the GNU or non-GNU linker -AC_DEFUN([AC_PROG_LD], -[AC_ARG_WITH([gnu-ld], - [AC_HELP_STRING([--with-gnu-ld], - [assume the C compiler uses GNU ld @<:@default=no@:>@])], - [test "$withval" = no || with_gnu_ld=yes], - [with_gnu_ld=no]) -AC_REQUIRE([LT_AC_PROG_SED])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by $CC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(lt_cv_path_LD, -[if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in - *GNU* | *'with BFD'*) - test "$with_gnu_ld" != no && break - ;; - *) - test "$with_gnu_ld" != yes && break - ;; - esac - fi - done - IFS="$lt_save_ifs" -else - lt_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$lt_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT($LD) -else - AC_MSG_RESULT(no) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_PROG_LD_GNU -])# AC_PROG_LD - - -# AC_PROG_LD_GNU -# -------------- -AC_DEFUN([AC_PROG_LD_GNU], -[AC_REQUIRE([AC_PROG_EGREP])dnl -AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, -[# I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 </dev/null` in -*GNU* | *'with BFD'*) - lt_cv_prog_gnu_ld=yes - ;; -*) - lt_cv_prog_gnu_ld=no - ;; -esac]) -with_gnu_ld=$lt_cv_prog_gnu_ld -])# AC_PROG_LD_GNU - - -# AC_PROG_LD_RELOAD_FLAG -# ---------------------- -# find reload flag for linker -# -- PORTME Some linkers may need a different reload flag. -AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], -[AC_CACHE_CHECK([for $LD option to reload object files], - lt_cv_ld_reload_flag, - [lt_cv_ld_reload_flag='-r']) -reload_flag=$lt_cv_ld_reload_flag -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in - darwin*) - if test "$GCC" = yes; then - reload_cmds='$CC -nostdlib ${wl}-r -o $output$reload_objs' - else - reload_cmds='$LD$reload_flag -o $output$reload_objs' - fi - ;; -esac -])# AC_PROG_LD_RELOAD_FLAG - - -# AC_DEPLIBS_CHECK_METHOD -# ----------------------- -# how to check for library dependencies -# -- PORTME fill in with the dynamic library characteristics -AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], -[AC_CACHE_CHECK([how to recognise dependent libraries], -lt_cv_deplibs_check_method, -[lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [[regex]]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given extended regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. - -case $host_os in -aix4* | aix5*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi[[45]]*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin*) - # func_win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - ;; - -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump'. - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | kfreebsd*-gnu | dragonfly*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux*) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -nto-qnx*) - lt_cv_deplibs_check_method=unknown - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown -])# AC_DEPLIBS_CHECK_METHOD - - -# AC_PROG_NM -# ---------- -# find the pathname to a BSD-compatible name lister -AC_DEFUN([AC_PROG_NM], -[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/${ac_tool_prefix}nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - esac - fi - done - IFS="$lt_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi]) -NM="$lt_cv_path_NM" -])# AC_PROG_NM - - -# AC_CHECK_LIBM -# ------------- -# check for math library -AC_DEFUN([AC_CHECK_LIBM], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -])# AC_CHECK_LIBM - - -# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl convenience library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-convenience to the configure arguments. Note that -# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, -# it is assumed to be `libltdl'. LIBLTDL will be prefixed with -# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/' -# (note the single quotes!). If your package is not flat and you're not -# using automake, define top_builddir and top_srcdir appropriately in -# the Makefiles. -AC_DEFUN([AC_LIBLTDL_CONVENIENCE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - case $enable_ltdl_convenience in - no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; - "") enable_ltdl_convenience=yes - ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; - esac - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_CONVENIENCE - - -# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl installable library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-install to the configure arguments. Note that -# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, -# and an installed libltdl is not found, it is assumed to be `libltdl'. -# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with -# '${top_srcdir}/' (note the single quotes!). If your package is not -# flat and you're not using automake, define top_builddir and top_srcdir -# appropriately in the Makefiles. -# In the future, this macro may have to be called after AC_PROG_LIBTOOL. -AC_DEFUN([AC_LIBLTDL_INSTALLABLE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - AC_CHECK_LIB(ltdl, lt_dlinit, - [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], - [if test x"$enable_ltdl_install" = xno; then - AC_MSG_WARN([libltdl not installed, but installation disabled]) - else - enable_ltdl_install=yes - fi - ]) - if test x"$enable_ltdl_install" = x"yes"; then - ac_configure_args="$ac_configure_args --enable-ltdl-install" - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - LTDLINCL= - fi - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_INSTALLABLE - - -# AC_LIBTOOL_CXX -# -------------- -# enable support for C++ libraries -AC_DEFUN([AC_LIBTOOL_CXX], -[AC_REQUIRE([_LT_AC_LANG_CXX]) -])# AC_LIBTOOL_CXX - - -# _LT_AC_LANG_CXX -# --------------- -AC_DEFUN([_LT_AC_LANG_CXX], -[AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([_LT_AC_PROG_CXXCPP]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) -])# _LT_AC_LANG_CXX - -# _LT_AC_PROG_CXXCPP -# --------------- -AC_DEFUN([_LT_AC_PROG_CXXCPP], -[ -AC_REQUIRE([AC_PROG_CXX]) -if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - AC_PROG_CXXCPP -fi -])# _LT_AC_PROG_CXXCPP - -# AC_LIBTOOL_F77 -# -------------- -# enable support for Fortran 77 libraries -AC_DEFUN([AC_LIBTOOL_F77], -[AC_REQUIRE([_LT_AC_LANG_F77]) -])# AC_LIBTOOL_F77 - - -# _LT_AC_LANG_F77 -# --------------- -AC_DEFUN([_LT_AC_LANG_F77], -[AC_REQUIRE([AC_PROG_F77]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) -])# _LT_AC_LANG_F77 - - -# AC_LIBTOOL_GCJ -# -------------- -# enable support for GCJ libraries -AC_DEFUN([AC_LIBTOOL_GCJ], -[AC_REQUIRE([_LT_AC_LANG_GCJ]) -])# AC_LIBTOOL_GCJ - - -# _LT_AC_LANG_GCJ -# --------------- -AC_DEFUN([_LT_AC_LANG_GCJ], -[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], - [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], - [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], - [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], - [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) -])# _LT_AC_LANG_GCJ - - -# AC_LIBTOOL_RC -# -------------- -# enable support for Windows resource files -AC_DEFUN([AC_LIBTOOL_RC], -[AC_REQUIRE([LT_AC_PROG_RC]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) -])# AC_LIBTOOL_RC - - -# AC_LIBTOOL_LANG_C_CONFIG -# ------------------------ -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) -AC_DEFUN([_LT_AC_LANG_C_CONFIG], -[lt_save_CC="$CC" -AC_LANG_PUSH(C) - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' - -_LT_AC_SYS_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# -# Check for any special shared library compilation flags. -# -_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= -if test "$GCC" = no; then - case $host_os in - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' - ;; - esac -fi -if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then - AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) - if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[ ]]" >/dev/null; then : - else - AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) - _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no - fi -fi - - -# -# Check to make sure the static flag actually works. -# -AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), - $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), - [], - [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) - - -AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_DLOPEN_SELF($1) - -# Report which librarie types wil actually be built -AC_MSG_CHECKING([if libtool supports shared libraries]) -AC_MSG_RESULT([$can_build_shared]) - -AC_MSG_CHECKING([whether to build shared libraries]) -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case $host_os in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - -aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; -esac -AC_MSG_RESULT([$enable_shared]) - -AC_MSG_CHECKING([whether to build static libraries]) -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -AC_MSG_RESULT([$enable_static]) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_C_CONFIG - - -# AC_LIBTOOL_LANG_CXX_CONFIG -# -------------------------- -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) -AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], -[AC_LANG_PUSH(C++) -AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([_LT_AC_PROG_CXXCPP]) - -_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_AC_TAGVAR(allow_undefined_flag, $1)= -_LT_AC_TAGVAR(always_export_symbols, $1)=no -_LT_AC_TAGVAR(archive_expsym_cmds, $1)= -_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_direct, $1)=no -_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= -_LT_AC_TAGVAR(hardcode_minus_L, $1)=no -_LT_AC_TAGVAR(hardcode_automatic, $1)=no -_LT_AC_TAGVAR(module_cmds, $1)= -_LT_AC_TAGVAR(module_expsym_cmds, $1)= -_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown -_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_AC_TAGVAR(no_undefined_flag, $1)= -_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= -_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Dependencies to place before and after the object being linked: -_LT_AC_TAGVAR(predep_objects, $1)= -_LT_AC_TAGVAR(postdep_objects, $1)= -_LT_AC_TAGVAR(predeps, $1)= -_LT_AC_TAGVAR(postdeps, $1)= -_LT_AC_TAGVAR(compiler_lib_search_path, $1)= - -# Source file extension for C++ test sources. -ac_ext=cpp - -# Object file extension for compiled C++ test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_LD=$LD -lt_save_GCC=$GCC -GCC=$GXX -lt_save_with_gnu_ld=$with_gnu_ld -lt_save_path_LD=$lt_cv_path_LD -if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx -else - unset lt_cv_prog_gnu_ld -fi -if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX -else - unset lt_cv_path_LD -fi -test -z "${LDCXX+set}" || LD=$LDCXX -CC=${CXX-"c++"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) - -# We don't want -fno-exception wen compiling C++ code, so set the -# no_builtin_flag separately -if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' -else - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= -fi - -if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - AC_PROG_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ - grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - -else - GXX=no - with_gnu_ld=no - wlarc= -fi - -# PORTME: fill in a description of your system's C++ link characteristics -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -_LT_AC_TAGVAR(ld_shlibs, $1)=yes -case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - 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 - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GXX" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - darwin* | rhapsody*) - case $host_os in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GXX" = yes ; then - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case $cc_basename in - xlc*) - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi - ;; - - dgux*) - case $cc_basename in - ec++*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx*) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - freebsd[[12]]*) - # C++ shared libraries reported to be fairly broken before switch to ELF - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - freebsd-elf*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - freebsd* | kfreebsd*-gnu | dragonfly*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - ;; - gnu*) - ;; - hpux9*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - case $host_cpu in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case $host_cpu in - hppa*64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - *) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - case $host_cpu in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case $host_cpu in - ia64*|hppa*64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - irix5* | irix6*) - case $cc_basename in - CC*) - # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' - fi - fi - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - linux*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc*) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - tmp_idyn= - case $host_cpu in - ia64*) tmp_idyn=' -i_dynamic';; - esac - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - pgCC*) - # Portland Group C++ compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - ;; - cxx*) - # Compaq C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - esac - ;; - lynxos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - m88k*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - mvs*) - case $cc_basename in - cxx*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - openbsd2*) - # C++ shared libraries are fairly broken - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - openbsd*) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd='echo' - ;; - osf3*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - osf4* | osf5*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ - $rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - psos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - sco*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - lcc*) - # Lucid - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - solaris*) - case $cc_basename in - CC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. We must also pass each convience library through - # to the system linker between allextract/defaultextract. - # The C++ compiler will combine linker options so we - # cannot just pass the convience library names through - # without $wl. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' - ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - output_verbose_link_cmd='echo' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | grep -v '^2\.7' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - fi - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - fi - ;; - esac - ;; - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - vxworks*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; -esac -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_AC_TAGVAR(GCC, $1)="$GXX" -_LT_AC_TAGVAR(LD, $1)="$LD" - -AC_LIBTOOL_POSTDEP_PREDEP($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_DLOPEN_SELF($1) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC=$lt_save_CC -LDCXX=$LD -LD=$lt_save_LD -GCC=$lt_save_GCC -with_gnu_ldcxx=$with_gnu_ld -with_gnu_ld=$lt_save_with_gnu_ld -lt_cv_path_LDCXX=$lt_cv_path_LD -lt_cv_path_LD=$lt_save_path_LD -lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld -lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -])# AC_LIBTOOL_LANG_CXX_CONFIG - -# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) -# ------------------------ -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -ifelse([$1],[],[cat > conftest.$ac_ext <<EOF -int a; -void foo (void) { a = 0; } -EOF -],[$1],[CXX],[cat > conftest.$ac_ext <<EOF -class Foo -{ -public: - Foo (void) { a = 0; } -private: - int a; -}; -EOF -],[$1],[F77],[cat > conftest.$ac_ext <<EOF - subroutine foo - implicit none - integer*4 a - a=0 - return - end -EOF -],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF -public class foo { - private int a; - public void bar (void) { - a = 0; - } -}; -EOF -]) -dnl Parse the compiler output and extract the necessary -dnl objects, libraries and library flags. -if AC_TRY_EVAL(ac_compile); then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - # The `*' in the case matches for architectures that use `case' in - # $output_verbose_cmd can trigger glob expansion during the loop - # eval without this substitution. - output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"` - - for p in `eval $output_verbose_link_cmd`; do - case $p in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" \ - || test $p = "-R"; then - prev=$p - continue - else - prev= - fi - - if test "$pre_test_object_deps_done" = no; then - case $p in - -L* | -R*) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then - _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" - else - _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then - _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}" - else - _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}" - fi - fi - ;; - - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then - _LT_AC_TAGVAR(predep_objects, $1)="$p" - else - _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p" - fi - else - if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then - _LT_AC_TAGVAR(postdep_objects, $1)="$p" - else - _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling $1 test program" -fi - -$rm -f confest.$objext - -# PORTME: override above test on systems where it is broken -ifelse([$1],[CXX], -[case $host_os in -solaris*) - case $cc_basename in - CC*) - # Adding this requires a known-good setup of shared libraries for - # Sun compiler versions before 5.6, else PIC objects from an old - # archive will be linked into the output, leading to subtle bugs. - _LT_AC_TAGVAR(postdeps,$1)='-lCstd -lCrun' - ;; - esac -esac -]) - -case " $_LT_AC_TAGVAR(postdeps, $1) " in -*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; -esac -])# AC_LIBTOOL_POSTDEP_PREDEP - -# AC_LIBTOOL_LANG_F77_CONFIG -# ------------------------ -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)]) -AC_DEFUN([_LT_AC_LANG_F77_CONFIG], -[AC_REQUIRE([AC_PROG_F77]) -AC_LANG_PUSH(Fortran 77) - -_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_AC_TAGVAR(allow_undefined_flag, $1)= -_LT_AC_TAGVAR(always_export_symbols, $1)=no -_LT_AC_TAGVAR(archive_expsym_cmds, $1)= -_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_direct, $1)=no -_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= -_LT_AC_TAGVAR(hardcode_minus_L, $1)=no -_LT_AC_TAGVAR(hardcode_automatic, $1)=no -_LT_AC_TAGVAR(module_cmds, $1)= -_LT_AC_TAGVAR(module_expsym_cmds, $1)= -_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown -_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_AC_TAGVAR(no_undefined_flag, $1)= -_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= -_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for f77 test sources. -ac_ext=f - -# Object file extension for compiled f77 test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code=" subroutine t\n return\n end\n" - -# Code to be used in simple link tests -lt_simple_link_test_code=" program t\n end\n" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${F77-"f77"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) - -AC_MSG_CHECKING([if libtool supports shared libraries]) -AC_MSG_RESULT([$can_build_shared]) - -AC_MSG_CHECKING([whether to build shared libraries]) -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case $host_os in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; -aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; -esac -AC_MSG_RESULT([$enable_shared]) - -AC_MSG_CHECKING([whether to build static libraries]) -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -AC_MSG_RESULT([$enable_static]) - -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_AC_TAGVAR(GCC, $1)="$G77" -_LT_AC_TAGVAR(LD, $1)="$LD" - -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP - - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_F77_CONFIG - - -# AC_LIBTOOL_LANG_GCJ_CONFIG -# -------------------------- -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)]) -AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG], -[AC_LANG_SAVE - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${GCJ-"gcj"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - -_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds - -AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_DLOPEN_SELF($1) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_RESTORE -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_GCJ_CONFIG - - -# AC_LIBTOOL_LANG_RC_CONFIG -# -------------------------- -# Ensure that the configuration vars for the Windows resource compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)]) -AC_DEFUN([_LT_AC_LANG_RC_CONFIG], -[AC_LANG_SAVE - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${RC-"windres"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) -_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_RESTORE -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_RC_CONFIG - - -# AC_LIBTOOL_CONFIG([TAGNAME]) -# ---------------------------- -# If TAGNAME is not passed, then create an initial libtool script -# with a default configuration from the untagged config vars. Otherwise -# add code to config.status for appending the configuration named by -# TAGNAME from the matching tagged config vars. -AC_DEFUN([AC_LIBTOOL_CONFIG], -[# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - _LT_AC_TAGVAR(compiler, $1) \ - _LT_AC_TAGVAR(CC, $1) \ - _LT_AC_TAGVAR(LD, $1) \ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \ - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \ - _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \ - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \ - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \ - _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \ - _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \ - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \ - _LT_AC_TAGVAR(old_archive_cmds, $1) \ - _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \ - _LT_AC_TAGVAR(predep_objects, $1) \ - _LT_AC_TAGVAR(postdep_objects, $1) \ - _LT_AC_TAGVAR(predeps, $1) \ - _LT_AC_TAGVAR(postdeps, $1) \ - _LT_AC_TAGVAR(compiler_lib_search_path, $1) \ - _LT_AC_TAGVAR(archive_cmds, $1) \ - _LT_AC_TAGVAR(archive_expsym_cmds, $1) \ - _LT_AC_TAGVAR(postinstall_cmds, $1) \ - _LT_AC_TAGVAR(postuninstall_cmds, $1) \ - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \ - _LT_AC_TAGVAR(allow_undefined_flag, $1) \ - _LT_AC_TAGVAR(no_undefined_flag, $1) \ - _LT_AC_TAGVAR(export_symbols_cmds, $1) \ - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \ - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \ - _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \ - _LT_AC_TAGVAR(hardcode_automatic, $1) \ - _LT_AC_TAGVAR(module_cmds, $1) \ - _LT_AC_TAGVAR(module_expsym_cmds, $1) \ - _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \ - _LT_AC_TAGVAR(exclude_expsyms, $1) \ - _LT_AC_TAGVAR(include_expsyms, $1); do - - case $var in - _LT_AC_TAGVAR(old_archive_cmds, $1) | \ - _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \ - _LT_AC_TAGVAR(archive_cmds, $1) | \ - _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \ - _LT_AC_TAGVAR(module_cmds, $1) | \ - _LT_AC_TAGVAR(module_expsym_cmds, $1) | \ - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \ - _LT_AC_TAGVAR(export_symbols_cmds, $1) | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\[$]0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'` - ;; - esac - -ifelse([$1], [], - [cfgfile="${ofile}T" - trap "$rm \"$cfgfile\"; exit 1" 1 2 15 - $rm -f "$cfgfile" - AC_MSG_NOTICE([creating $ofile])], - [cfgfile="$ofile"]) - - cat <<__EOF__ >> "$cfgfile" -ifelse([$1], [], -[#! $SHELL - -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# -# This file is part of GNU Libtool: -# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# A sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e 1s/^X//" - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -# The names of the tagged configurations supported by this script. -available_tags= - -# ### BEGIN LIBTOOL CONFIG], -[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) - -# Is the compiler the GNU C compiler? -with_gcc=$_LT_AC_TAGVAR(GCC, $1) - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_[]_LT_AC_TAGVAR(LD, $1) - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) - -# Commands used to build and install a shared archive. -archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) -archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) -module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" - -# Set to yes if exported symbols are required. -always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) - -# The commands to list exported symbols. -export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) - -# Symbols that must always be exported. -include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) - -ifelse([$1],[], -[# ### END LIBTOOL CONFIG], -[# ### END LIBTOOL TAG CONFIG: $tagname]) - -__EOF__ - -ifelse([$1],[], [ - case $host_os in - aix3*) - cat <<\EOF >> "$cfgfile" - -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -EOF - ;; - esac - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || \ - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -]) -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -fi -])# AC_LIBTOOL_CONFIG - - -# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl - -_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - - AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI - - -# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -# --------------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], -[AC_REQUIRE([AC_CANONICAL_HOST]) -AC_REQUIRE([AC_PROG_NM]) -AC_REQUIRE([AC_OBJEXT]) -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) # Its linker distinguishes data from code symbols - if test "$host_cpu" = ia64; then - symcode='[[ABCDEGRST]]' - fi - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -linux*) - if test "$host_cpu" = ia64; then - symcode='[[ABCDGIRSTW]]' - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - fi - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris* | sysv5*) - symcode='[[BDRT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[[ABCDGIRSTW]]' ;; -esac - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -EOF - - if AC_TRY_EVAL(ac_compile); then - # Now try to grab the symbols. - nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if grep ' nm_test_var$' "$nlist" >/dev/null; then - if grep ' nm_test_func$' "$nlist" >/dev/null; then - cat <<EOF > conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' - - cat <<EOF >> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[[]] = -{ -EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi -]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE - - -# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) -# --------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], -[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= - -AC_MSG_CHECKING([for $compiler option to produce PIC]) - ifelse([$1],[CXX],[ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | os2* | pw32*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix4* | aix5*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68*) - # Green Hills C++ Compiler - # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case $cc_basename in - xlc*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx*) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | kfreebsd*-gnu | dragonfly*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux*) - case $cc_basename in - KCC*) - # KAI C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - icpc* | ecpc*) - # Intel C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - pgCC*) - # Portland Group C++ compiler. - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - cxx*) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd*) - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC*) - # Rational C++ 2.4.1 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx*) - # Digital/Compaq C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - sco*) - case $cc_basename in - CC*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - *) - ;; - esac - ;; - solaris*) - case $cc_basename in - CC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc*) - # Lucid - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - unixware*) - ;; - vxworks*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case $cc_basename in - xlc*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - ;; - esac - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - newsos6) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - linux*) - case $cc_basename in - icc* | ecc*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - pgcc* | pgf77* | pgf90* | pgf95*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - ccc*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' - ;; - - solaris*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; - *) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; - esac - ;; - - sunos4*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - unicos*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - - uts4*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then - AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), - [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" - ;; -esac -]) - - -# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) -# ------------------------------------ -# See if the linker supports building shared libraries. -AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], -[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -ifelse([$1],[CXX],[ - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - case $host_os in - aix4* | aix5*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - ;; - *) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac -],[ - runpath_var= - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)= - _LT_AC_TAGVAR(archive_expsym_cmds, $1)= - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown - _LT_AC_TAGVAR(hardcode_automatic, $1)=no - _LT_AC_TAGVAR(module_cmds, $1)= - _LT_AC_TAGVAR(module_expsym_cmds, $1)= - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_AC_TAGVAR(include_expsyms, $1)= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - _LT_CC_BASENAME([$compiler]) - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <<EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - - # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach <jrb3@best.com> says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <<EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sunos4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then - runpath_var= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - 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 - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - # see comment about different semantics on the GNU ld section - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - bsdi[[45]]*) - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' - _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - - darwin* | rhapsody*) - case $host_os in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case $cc_basename in - xlc*) - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi - ;; - - dgux*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - freebsd1*) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu | dragonfly*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - openbsd*) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - if test "$GCC" = yes; then - wlarc='${wl}' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - wlarc='' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; - *) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4.2uw2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv5*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_AC_TAGVAR(archive_cmds, $1) in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_MSG_CHECKING([whether -lc should be explicitly linked in]) - $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) - then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - else - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) - ;; - esac - fi - ;; -esac -])# AC_LIBTOOL_PROG_LD_SHLIBS - - -# _LT_AC_FILE_LTDLL_C -# ------------------- -# Be careful that the start marker always follows a newline. -AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ -# /* ltdll.c starts here */ -# #define WIN32_LEAN_AND_MEAN -# #include <windows.h> -# #undef WIN32_LEAN_AND_MEAN -# #include <stdio.h> -# -# #ifndef __CYGWIN__ -# # ifdef __CYGWIN32__ -# # define __CYGWIN__ __CYGWIN32__ -# # endif -# #endif -# -# #ifdef __cplusplus -# extern "C" { -# #endif -# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); -# #ifdef __cplusplus -# } -# #endif -# -# #ifdef __CYGWIN__ -# #include <cygwin/cygwin_dll.h> -# DECLARE_CYGWIN_DLL( DllMain ); -# #endif -# HINSTANCE __hDllInstance_base; -# -# BOOL APIENTRY -# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) -# { -# __hDllInstance_base = hInst; -# return TRUE; -# } -# /* ltdll.c ends here */ -])# _LT_AC_FILE_LTDLL_C - - -# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) -# --------------------------------- -AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) - - -# old names -AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) -AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) -AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) -AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) -AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) - -# This is just to silence aclocal about the macro not being used -ifelse([AC_DISABLE_FAST_INSTALL]) - -AC_DEFUN([LT_AC_PROG_GCJ], -[AC_CHECK_TOOL(GCJ, gcj, no) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS) -]) - -AC_DEFUN([LT_AC_PROG_RC], -[AC_CHECK_TOOL(RC, windres, no) -]) - -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_SED. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # -# LT_AC_PROG_SED -# -------------- -# Check for a fully-functional sed program, that truncates -# as few characters as possible. Prefer GNU sed if found. -AC_DEFUN([LT_AC_PROG_SED], -[AC_MSG_CHECKING([for a sed that does not truncate output]) -AC_CACHE_VAL(lt_cv_path_SED, -[# Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && continue - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -]) -SED=$lt_cv_path_SED -AC_MSG_RESULT([$SED]) -]) - # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation @@ -6198,7 +34,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.11], [], +m4_if([$1], [1.11.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -6214,7 +50,7 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.11])dnl +[AM_AUTOMAKE_VERSION([1.11.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) @@ -6570,18 +406,6 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 8 - -# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. -AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) - # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -6815,6 +639,41 @@ AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) +# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 6 + +# AM_PROG_CC_C_O +# -------------- +# Like AC_PROG_CC_C_O, but changed for automake. +AC_DEFUN([AM_PROG_CC_C_O], +[AC_REQUIRE([AC_PROG_CC_C_O])dnl +AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +# FIXME: we rely on the cache variable name because +# there is no other way. +set dummy $CC +am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` +eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o +if test "$am_t" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +dnl Make sure AC_PROG_CC is never called again, or it will override our +dnl setting of CC. +m4_define([AC_PROG_CC], + [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) +]) + # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 @@ -7126,3 +985,12 @@ AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([libopts/m4/libopts.m4]) +m4_include([../m4/libtool.m4]) +m4_include([../m4/ltoptions.m4]) +m4_include([../m4/ltsugar.m4]) +m4_include([../m4/ltversion.m4]) +m4_include([../m4/lt~obsolete.m4]) +m4_include([../m4/ntp_cacheversion.m4]) +m4_include([../m4/ntp_dir_sep.m4]) +m4_include([../m4/ntp_lib_m.m4]) +m4_include([../m4/ntp_openssl.m4]) diff --git a/sntp/autogen-version.def b/sntp/autogen-version.def index 8943983..d69457c 100644 --- a/sntp/autogen-version.def +++ b/sntp/autogen-version.def @@ -1,2 +1,2 @@ -#assert (version-compare >= autogen-version "5.9.1") +#assert (version-compare >= autogen-version "5.11.9") guard-option-names; diff --git a/sntp/bincheck.mf b/sntp/bincheck.mf index c67827d..326b7ad 100644 --- a/sntp/bincheck.mf +++ b/sntp/bincheck.mf @@ -3,11 +3,11 @@ # subdir to warn folks if there is another version there. install-exec-hook: - @case ${BINSUBDIR} in \ - bin) ODIR=${exec_prefix}/sbin ;; \ - sbin) ODIR=${exec_prefix}/bin ;; \ - esac; \ - test -z "${bin_PROGRAMS}${bin_SCRIPTS}" \ + @case ${BINSUBDIR} in \ + bin) ODIR=${sbindir} ;; \ + sbin) ODIR=${bindir} ;; \ + esac; \ + test -z "${bin_PROGRAMS}${bin_SCRIPTS}" \ || for i in ${bin_PROGRAMS} ${bin_SCRIPTS} " "; do \ test ! -f $$ODIR/$$i || echo "*** $$i is also in $$ODIR!"; \ done diff --git a/sntp/config.guess b/sntp/config.guess index 917bbc5..b02565c 100755 --- a/sntp/config.guess +++ b/sntp/config.guess @@ -1,9 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +# 2011 Free Software Foundation, Inc. -timestamp='2005-07-08' +timestamp='2011-06-03' # 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 @@ -26,16 +27,16 @@ timestamp='2005-07-08' # the same distribution terms that you use for the rest of that program. -# Originally written by Per Bothner <per@bothner.com>. -# Please send patches to <config-patches@gnu.org>. Submit a context -# diff and a properly formatted ChangeLog entry. +# Originally written by Per Bothner. Please send patches (context +# diff format) to <config-patches@gnu.org> and include a ChangeLog +# entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` @@ -55,8 +56,9 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free +Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -106,7 +108,7 @@ 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" ; } || + { tmp=`(umask 077 && mktemp -d "$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 ; } ; @@ -160,6 +162,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched @@ -168,7 +171,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null + | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? @@ -178,7 +181,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in fi ;; *) - os=netbsd + os=netbsd ;; esac # The OS release @@ -206,8 +209,11 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; macppc:MirBSD:*:*) - echo powerppc-unknown-mirbsd${UNAME_RELEASE} + echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} @@ -218,7 +224,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on @@ -264,7 +270,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit ;; + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead @@ -290,7 +299,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo s390-ibm-zvmoe exit ;; *:OS400:*:*) - echo powerpc-ibm-os400 + echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} @@ -319,14 +328,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize @@ -370,23 +398,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; @@ -456,8 +484,8 @@ EOF echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ @@ -470,7 +498,7 @@ EOF else echo i586-dg-dgux${UNAME_RELEASE} fi - exit ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; @@ -527,7 +555,7 @@ EOF echo rs6000-ibm-aix3.2 fi exit ;; - *:AIX:*:[45]) + *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 @@ -570,52 +598,52 @@ EOF 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac + esac ;; + esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + sed 's/^ //' << EOF >$dummy.c - #define _HPUX_SOURCE - #include <stdlib.h> - #include <unistd.h> + #define _HPUX_SOURCE + #include <stdlib.h> + #include <unistd.h> - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa @@ -635,7 +663,7 @@ EOF # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep __LP64__ >/dev/null + grep -q __LP64__ then HP_ARCH="hppa2.0w" else @@ -706,22 +734,22 @@ EOF exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; @@ -745,14 +773,14 @@ EOF exit ;; 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 ;; + 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 ;; 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}" + 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 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} @@ -764,27 +792,46 @@ EOF echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; - i*:MINGW*:*) + *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; - x86:Interix*:[34]*) - echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' - exit ;; + *:Interix*:*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; 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 @@ -794,7 +841,7 @@ EOF i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; - amd64:CYGWIN*:*:*) + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) @@ -814,7 +861,37 @@ EOF i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabihf + fi + fi + exit ;; + avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) @@ -824,7 +901,18 @@ EOF echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) - echo frv-unknown-linux-gnu + echo frv-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + LIBC=gnu + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu @@ -835,63 +923,33 @@ EOF m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #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; } - ;; - mips64:Linux:*:*) + mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU - #undef mips64 - #undef mips64el + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el + CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 + CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + or32:Linux:*:*) + echo or32-unknown-linux-gnu exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + padre:Linux:*:*) + echo sparc-unknown-linux-gnu exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level @@ -901,14 +959,17 @@ EOF *) echo hppa-unknown-linux-gnu ;; esac exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu @@ -916,68 +977,18 @@ EOF sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; + tile*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include <features.h> - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #ifdef __INTEL_COMPILER - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && { - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit - } - test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } - ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both @@ -985,11 +996,11 @@ EOF echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. + # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) @@ -1006,7 +1017,7 @@ EOF i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) @@ -1021,7 +1032,7 @@ EOF fi exit ;; i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. + # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; @@ -1049,10 +1060,13 @@ EOF exit ;; pc:*:*:*) # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit ;; + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configury will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; @@ -1087,8 +1101,18 @@ EOF /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; @@ -1101,7 +1125,7 @@ EOF rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) @@ -1121,10 +1145,10 @@ EOF echo ns32k-sni-sysv fi exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says <Richard.M.Bartel@ccMail.Census.GOV> - echo i586-unisys-sysv4 - exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> + echo i586-unisys-sysv4 + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes <hewes@openmarket.com>. # How about differentiating between stratus architectures? -djm @@ -1150,11 +1174,11 @@ EOF exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} + echo mips-nec-sysv${UNAME_RELEASE} else - echo mips-unknown-sysv${UNAME_RELEASE} + echo mips-unknown-sysv${UNAME_RELEASE} fi - exit ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; @@ -1164,6 +1188,9 @@ EOF BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; @@ -1173,6 +1200,15 @@ EOF SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; @@ -1182,7 +1218,16 @@ EOF *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in - *86) UNAME_PROCESSOR=i686 ;; + i386) + eval $set_cc_for_build + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + UNAME_PROCESSOR="x86_64" + fi + fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} @@ -1198,6 +1243,9 @@ EOF *:QNX:*:4*) echo i386-pc-qnx exit ;; + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} + exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; @@ -1243,13 +1291,13 @@ EOF echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} + echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` + UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; @@ -1261,6 +1309,12 @@ EOF i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -1283,11 +1337,11 @@ main () #include <sys/param.h> printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 - "4" + "4" #else - "" + "" #endif - ); exit (0); + ); exit (0); #endif #endif @@ -1421,9 +1475,9 @@ This script, last modified $timestamp, has failed to recognize the operating system you are using. It is advised that you download the most up to date version of the config scripts from - http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess + http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD and - http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub + http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD If the version you run ($0) is already up to date, please send the following data and any information you think might be diff --git a/sntp/config.h.in b/sntp/config.h.in index ae394d7..69fa2e3 100644 --- a/sntp/config.h.in +++ b/sntp/config.h.in @@ -1,16 +1,16 @@ /* config.h.in. Generated from configure.ac by autoheader. */ +/* Directory separator character, usually / or \\ */ +#undef DIR_SEP + /* fopen(3) accepts a 'b' in the mode flag */ #undef FOPEN_BINARY_FLAG /* fopen(3) accepts a 't' in the mode flag */ #undef FOPEN_TEXT_FLAG -/* Define to 1 if you have the `alarm' function. */ -#undef HAVE_ALARM - -/* Define to 1 if you have the <arpa/inet.h> header file. */ -#undef HAVE_ARPA_INET_H +/* What is getsockname()'s socklen type? */ +#undef GETSOCKNAME_SOCKLEN_TYPE /* Define to 1 if you have the `canonicalize_file_name' function. */ #undef HAVE_CANONICALIZE_FILE_NAME @@ -34,14 +34,8 @@ /* Define to 1 if you have the <fcntl.h> header file. */ #undef HAVE_FCNTL_H -/* Define to 1 if you have the <float.h> header file. */ -#undef HAVE_FLOAT_H - -/* Define to 1 if you have the `gettimeofday' function. */ -#undef HAVE_GETTIMEOFDAY - -/* Define to 1 if you have the `inet_ntoa' function. */ -#undef HAVE_INET_NTOA +/* Define to 1 if you have the `fork' function. */ +#undef HAVE_FORK /* inline keyword or macro available */ #undef HAVE_INLINE @@ -73,9 +67,6 @@ /* Define to 1 if you have the <memory.h> header file. */ #undef HAVE_MEMORY_H -/* Define to 1 if you have the `memset' function. */ -#undef HAVE_MEMSET - /* Define to 1 if you have the `mmap' function. */ #undef HAVE_MMAP @@ -88,30 +79,42 @@ /* Define to 1 if you have the <netinet/in.h> header file. */ #undef HAVE_NETINET_IN_H +/* Define to 1 if you have the <net/netmp.h> header file. */ +#undef HAVE_NET_NETMP_H + +/* sntp does not care about 'nice' */ +#undef HAVE_NO_NICE + /* Define this if pathfind(3) works */ #undef HAVE_PATHFIND +/* Define to 1 if the system has the type `pid_t'. */ +#undef HAVE_PID_T + /* Define this if we have a functional realpath(3C) */ #undef HAVE_REALPATH +/* Define to 1 if you have the <runetype.h> header file. */ +#undef HAVE_RUNETYPE_H + /* Define to 1 if you have the <setjmp.h> header file. */ #undef HAVE_SETJMP_H +/* Define to 1 if the system has the type `size_t'. */ +#undef HAVE_SIZE_T + /* Define to 1 if you have the `snprintf' function. */ #undef HAVE_SNPRINTF /* Define to 1 if you have the `socket' function. */ #undef HAVE_SOCKET -/* Define to 1 if you have the `sqrt' function. */ -#undef HAVE_SQRT - -/* Does struct sockaddr_storage have ss_family? */ -#undef HAVE_SS_FAMILY_IN_SS - /* Define to 1 if you have the <stdarg.h> header file. */ #undef HAVE_STDARG_H +/* Define to 1 if stdbool.h conforms to C99. */ +#undef HAVE_STDBOOL_H + /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H @@ -136,6 +139,12 @@ /* Define to 1 if you have the `strrchr' function. */ #undef HAVE_STRRCHR +/* Define to 1 if you have the `strsignal' function. */ +#undef HAVE_STRSIGNAL + +/* Does a system header define struct sockaddr_storage? */ +#undef HAVE_STRUCT_SOCKADDR_STORAGE + /* Define to 1 if you have the <sysexits.h> header file. */ #undef HAVE_SYSEXITS_H @@ -189,6 +198,12 @@ /* Define to 1 if you have the <sys/wait.h> header file. */ #undef HAVE_SYS_WAIT_H +/* Define to 1 if the system has the type `s_char'. */ +#undef HAVE_S_CHAR + +/* sntp does not care about TTY stuff */ +#undef HAVE_TERMIOS + /* Define to 1 if the system has the type `uint16_t'. */ #undef HAVE_UINT16_T @@ -216,18 +231,119 @@ /* Define to 1 if you have the <varargs.h> header file. */ #undef HAVE_VARARGS_H +/* Define to 1 if you have the `vfork' function. */ +#undef HAVE_VFORK + +/* Define to 1 if you have the <vfork.h> header file. */ +#undef HAVE_VFORK_H + /* Define to 1 if you have the `vprintf' function. */ #undef HAVE_VPRINTF +/* Define to 1 if you have the `vsnprintf' function. */ +#undef HAVE_VSNPRINTF + +/* Define to 1 if you have the `vsprintf' function. */ +#undef HAVE_VSPRINTF + +/* Define to 1 if you have the <wchar.h> header file. */ +#undef HAVE_WCHAR_H + +/* Define to 1 if the system has the type `wchar_t'. */ +#undef HAVE_WCHAR_T + +/* Define to 1 if the system has the type `wint_t'. */ +#undef HAVE_WINT_T + +/* Define to 1 if `fork' works. */ +#undef HAVE_WORKING_FORK + +/* Define to 1 if `vfork' works. */ +#undef HAVE_WORKING_VFORK + +/* Define to 1 if the system has the type `_Bool'. */ +#undef HAVE__BOOL + /* Does struct sockaddr_storage have __ss_family? */ #undef HAVE___SS_FAMILY_IN_SS + + /* Handle sockaddr_storage.__ss_family */ + #ifdef HAVE___SS_FAMILY_IN_SS + # define ss_family __ss_family + #endif /* HAVE___SS_FAMILY_IN_SS */ + + + +/* Does struct sockaddr_storage have __ss_len? */ +#undef HAVE___SS_LEN_IN_SS + + + /* Handle sockaddr_storage.__ss_len */ + #ifdef HAVE___SS_LEN_IN_SS + # define ss_len __ss_len + #endif /* HAVE___SS_LEN_IN_SS */ + + + +/* Do we need to fix in6isaddr? */ +#undef ISC_PLATFORM_FIXIN6ISADDR + +/* have struct if_laddrconf? */ +#undef ISC_PLATFORM_HAVEIF_LADDRCONF + +/* have struct if_laddrreq? */ +#undef ISC_PLATFORM_HAVEIF_LADDRREQ + +/* have struct in6_pktinfo? */ +#undef ISC_PLATFORM_HAVEIN6PKTINFO + +/* have IPv6? */ +#undef ISC_PLATFORM_HAVEIPV6 + +/* struct sockaddr has sa_len? */ +#undef ISC_PLATFORM_HAVESALEN + +/* sin6_scope_id? */ +#undef ISC_PLATFORM_HAVESCOPEID + +/* missing in6addr_any? */ +#undef ISC_PLATFORM_NEEDIN6ADDRANY + +/* Do we need netinet6/in6.h? */ +#undef ISC_PLATFORM_NEEDNETINET6IN6H + +/* ISC: provide inet_ntop() */ +#undef ISC_PLATFORM_NEEDNTOP + +/* Declare in_port_t? */ +#undef ISC_PLATFORM_NEEDPORTT + +/* ISC: provide inet_pton() */ +#undef ISC_PLATFORM_NEEDPTON + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Does the target support multicast IP? */ +#undef MCAST + +/* Do we need an s_char typedef? */ +#undef NEED_S_CHAR_TYPEDEF + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + /* Define this if optional arguments are disallowed */ #undef NO_OPTIONAL_OPT_ARGS /* Should we avoid #warning on option name collisions? */ #undef NO_OPTION_NAME_WARNINGS +/* Use OpenSSL? */ +#undef OPENSSL + /* Name of package */ #undef PACKAGE @@ -249,12 +365,12 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* define to a working POSIX compliant shell */ +#undef POSIX_SHELL + /* name of regex header file */ #undef REGEX_HEADER -/* Define as the return type of signal handlers (`int' or `void'). */ -#undef RETSIGTYPE - /* The size of `char*', as computed by sizeof. */ #undef SIZEOF_CHARP @@ -267,38 +383,71 @@ /* The size of `short', as computed by sizeof. */ #undef SIZEOF_SHORT +/* The size of `signed char', as computed by sizeof. */ +#undef SIZEOF_SIGNED_CHAR + +/* The size of `time_t', as computed by sizeof. */ +#undef SIZEOF_TIME_T + /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS +/* canonical system (cpu-vendor-os) of where we should run */ +#undef STR_SYSTEM + /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ #undef TIME_WITH_SYS_TIME -/* Define to 1 if your <sys/time.h> declares `struct tm'. */ -#undef TM_IN_SYS_TIME +/* What type to use for setsockopt */ +#undef TYPEOF_IP_MULTICAST_LOOP /* Version number of package */ #undef VERSION +/* configure --enable-ipv6 */ +#undef WANT_IPV6 + /* Define this if a working libregex can be found */ #undef WITH_LIBREGEX +/* Are we _special_? */ +#undef __APPLE_USE_RFC_3542 + +/* Define to 1 if type `char' is unsigned and you are not using gcc. */ +#ifndef __CHAR_UNSIGNED__ +# undef __CHAR_UNSIGNED__ +#endif + /* Define to empty if `const' does not conform to ANSI C. */ #undef const +/* Define to `int' if <sys/types.h> doesn't define. */ +#undef gid_t + /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif +/* Define to `int' if <sys/types.h> does not define. */ +#undef pid_t + /* Define to `unsigned int' if <sys/types.h> does not define. */ #undef size_t -/* normalize ss_family access */ -#undef ss_family +/* Define to `int' if <sys/types.h> doesn't define. */ +#undef uid_t + +/* Define as `fork' if `vfork' does not work. */ +#undef vfork -/* normalize ss_len access */ -#undef ss_len -/* Alternate uintptr_t for systems without it. */ -#undef uintptr_t +#ifndef MPINFOU_PREDECLARED +# define MPINFOU_PREDECLARED +typedef union mpinfou { /* For lint */ + struct pdk_mpinfo *pdkptr; + struct mpinfo *pikptr; +} mpinfou_t; +#endif + diff --git a/sntp/config.sub b/sntp/config.sub index 1c366df..f9fcdc8 100755 --- a/sntp/config.sub +++ b/sntp/config.sub @@ -1,9 +1,10 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +# 2011 Free Software Foundation, Inc. -timestamp='2005-07-08' +timestamp='2011-06-03' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -31,13 +32,16 @@ timestamp='2005-07-08' # Please send patches to <config-patches@gnu.org>. Submit a context -# diff and a properly formatted ChangeLog entry. +# diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. @@ -71,8 +75,9 @@ Report bugs and patches to <config-patches@gnu.org>." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free +Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -119,8 +124,11 @@ 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* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ - kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ + linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -146,10 +154,13 @@ 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 | -knuth | -cray) + -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; + -bluegene*) + os=-cnk + ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 @@ -164,13 +175,17 @@ case $os in os=-chorusos basic_machine=$1 ;; - -chorusrdb) - os=-chorusrdb + -chorusrdb) + os=-chorusrdb basic_machine=$1 - ;; + ;; -hiux*) os=-hiuxwe2 ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -187,6 +202,10 @@ case $os in # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -231,20 +250,24 @@ case $basic_machine in | 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 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ + | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ - | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ - | mips64vr | mips64vrel \ + | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ @@ -257,35 +280,63 @@ case $basic_machine in | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ - | ms1 \ + | moxie \ + | mt \ | msp430 \ + | nds32 | nds32le | nds32be \ + | nios | nios2 \ | ns16k | ns32k \ + | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ - | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b \ - | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ - | v850 | v850e \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ - | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ - | z8k) + | x86 | xc16x | xstormy16 | xtensa \ + | z8k | z80) basic_machine=$basic_machine-unknown ;; - m32c) - basic_machine=$basic_machine-unknown + c54x) + basic_machine=tic54x-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12) + c55x) + basic_machine=tic55x-unknown + ;; + c6x) + basic_machine=tic6x-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | picochip) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; + ms1) + basic_machine=mt-unknown + ;; + + strongarm | thumb | xscale) + basic_machine=arm-unknown + ;; + + xscaleeb) + basic_machine=armeb-unknown + ;; + + xscaleel) + basic_machine=armel-unknown + ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and @@ -305,25 +356,28 @@ case $basic_machine in | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* \ + | avr-* | avr32-* \ | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ - | m32r-* | m32rle-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ - | mips64vr-* | mips64vrel-* \ + | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ @@ -336,30 +390,38 @@ case $basic_machine in | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ - | ms1-* \ + | mt-* \ | msp430-* \ + | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ | tron-* \ - | v850-* | v850e-* | vax-* \ + | ubicom32-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ - | xstormy16-* | xtensa-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ + | xstormy16-* | xtensa*-* \ | ymp-* \ - | z8k-*) + | z8k-* | z80-*) ;; - m32c-*) + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. @@ -377,7 +439,7 @@ case $basic_machine in basic_machine=a29k-amd os=-udi ;; - abacus) + abacus) basic_machine=abacus-unknown ;; adobe68k) @@ -423,6 +485,10 @@ case $basic_machine in basic_machine=m68k-apollo os=-bsd ;; + aros) + basic_machine=i386-pc + os=-aros + ;; aux) basic_machine=m68k-apple os=-aux @@ -431,10 +497,35 @@ case $basic_machine in basic_machine=ns32k-sequent os=-dynix ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c54x-*) + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; c90) basic_machine=c90-cray os=-unicos ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; convex-c1) basic_machine=c1-convex os=-bsd @@ -463,8 +554,8 @@ case $basic_machine in basic_machine=craynv-cray os=-unicosmp ;; - cr16c) - basic_machine=cr16c-unknown + cr16 | cr16-*) + basic_machine=cr16-unknown os=-elf ;; crds | unos) @@ -502,6 +593,10 @@ case $basic_machine in basic_machine=m88k-motorola os=-sysv3 ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp @@ -656,6 +751,14 @@ case $basic_machine in basic_machine=m68k-isi os=-sysv ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; m88k-omron*) basic_machine=m88k-omron ;; @@ -667,10 +770,17 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; + microblaze) + basic_machine=microblaze-xilinx + ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; miniframe) basic_machine=m68000-convergent ;; @@ -696,6 +806,9 @@ case $basic_machine in basic_machine=i386-pc os=-msdos ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; mvs) basic_machine=i370-ibm os=-mvs @@ -764,6 +877,12 @@ case $basic_machine in np1) basic_machine=np1-gould ;; + neo-tandem) + basic_machine=neo-tandem + ;; + nse-tandem) + basic_machine=nse-tandem + ;; nsr-tandem) basic_machine=nsr-tandem ;; @@ -794,6 +913,14 @@ case $basic_machine in basic_machine=i860-intel os=-osf ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; pbd) basic_machine=sparc-tti ;; @@ -803,6 +930,12 @@ case $basic_machine in pc532 | pc532-*) basic_machine=ns32k-pc532 ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; @@ -832,9 +965,10 @@ case $basic_machine in ;; power) basic_machine=power-ibm ;; - ppc) basic_machine=powerpc-unknown + ppc | ppcbe) basic_machine=powerpc-unknown ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown @@ -859,6 +993,10 @@ case $basic_machine in basic_machine=i586-unknown os=-pw32 ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; rom68k) basic_machine=m68k-rom68k os=-coff @@ -885,6 +1023,10 @@ case $basic_machine in sb1el) basic_machine=mipsisa64sb1el-unknown ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; sei) basic_machine=mips-sei os=-seiux @@ -896,6 +1038,9 @@ case $basic_machine in basic_machine=sh-hitachi os=-hms ;; + sh5el) + basic_machine=sh5le-unknown + ;; sh64) basic_machine=sh64-unknown ;; @@ -917,6 +1062,9 @@ case $basic_machine in basic_machine=i860-stratus os=-sysv4 ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; sun2) basic_machine=m68000-sun ;; @@ -973,17 +1121,9 @@ case $basic_machine in basic_machine=t90-cray os=-unicos ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff + tile*) + basic_machine=$basic_machine-unknown + os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown @@ -1052,6 +1192,9 @@ case $basic_machine in xps | xps100) basic_machine=xps100-honeywell ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; ymp) basic_machine=ymp-cray os=-unicos @@ -1060,6 +1203,10 @@ case $basic_machine in basic_machine=z8k-unknown os=-sim ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; none) basic_machine=none-none os=-none @@ -1098,10 +1245,10 @@ case $basic_machine in we32k) basic_machine=we32k-att ;; - sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; - sparc | sparcv8 | sparcv9 | sparcv9b) + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) @@ -1145,9 +1292,12 @@ esac if [ x"$os" != x"" ] then case $os in - # First match some system type aliases - # that might get confused with valid system types. + # First match some system type aliases + # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; @@ -1168,27 +1318,31 @@ case $os in # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ + | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ | -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* \ + | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -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* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1227,7 +1381,7 @@ case $os in -opened*) os=-openedition ;; - -os400*) + -os400*) os=-os400 ;; -wince*) @@ -1276,7 +1430,7 @@ case $os in -sinix*) os=-sysv4 ;; - -tpf*) + -tpf*) os=-tpf ;; -triton*) @@ -1318,6 +1472,11 @@ case $os in -zvmoe) os=-zvmoe ;; + -dicos*) + os=-dicos + ;; + -nacl*) + ;; -none) ;; *) @@ -1340,6 +1499,12 @@ else # system, and we'll never get to this point. case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; *-acorn) os=-riscix1.2 ;; @@ -1349,9 +1514,18 @@ case $basic_machine in arm*-semi) os=-aout ;; - c4x-* | tic4x-*) - os=-coff - ;; + c4x-* | tic4x-*) + os=-coff + ;; + tic54x-*) + os=-coff + ;; + tic55x-*) + os=-coff + ;; + tic6x-*) + os=-coff + ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 @@ -1377,6 +1551,9 @@ case $basic_machine in m68*-cisco) os=-aout ;; + mep-*) + os=-elf + ;; mips*-cisco) os=-elf ;; @@ -1401,7 +1578,7 @@ case $basic_machine in *-ibm) os=-aix ;; - *-knuth) + *-knuth) os=-mmixware ;; *-wec) @@ -1506,7 +1683,7 @@ case $basic_machine in -sunos*) vendor=sun ;; - -aix*) + -cnk*|-aix*) vendor=ibm ;; -beos*) diff --git a/sntp/configure b/sntp/configure index 1bcdaf7..7782c29 100755 --- a/sntp/configure +++ b/sntp/configure @@ -1,11 +1,11 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.65. +# Generated by GNU Autoconf 2.68 for sntp 4.2.6p5. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -89,6 +89,7 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -171,7 +172,15 @@ test x\$exitcode = x0 || exit 1" as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" +test \$(( 1 + 1 )) = 2 || exit 1 + + test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ + || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else @@ -214,11 +223,18 @@ IFS=$as_save_IFS # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : @@ -316,7 +332,7 @@ $as_echo X"$as_dir" | test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p @@ -356,19 +372,19 @@ else fi # as_fn_arith -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. +# script with STATUS, using 1 if that was 0. as_fn_error () { - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $1" >&2 + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -525,162 +541,14 @@ 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'" - - -# Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} -case X$ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` - ;; -esac - -echo=${ECHO-echo} -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then - # Yippee, $echo works! - : -else - # Restart under the correct shell. - exec $SHELL "$0" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat <<EOF -$* -EOF - exit 0 -fi - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test -z "$ECHO"; then -if test "X${echo_test_string+set}" != Xset; then -# find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if (echo_test_string=`eval $cmd`) 2>/dev/null && - echo_test_string=`eval $cmd` && - (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null - then - break - fi - done -fi - -if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : -else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$echo" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - echo='print -r' - elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} - else - # Try using printf. - echo='printf %s\n' - if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - echo="$CONFIG_SHELL $0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$CONFIG_SHELL $0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do - if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "$0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} - else - # Oops. We lost completely, so just stick with echo. - echo=echo - fi - fi - fi - fi -fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -ECHO=$echo -if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then - ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" -fi - - - test -n "$DJDIR" || exec 7<&0 </dev/null exec 6>&1 # Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` @@ -697,15 +565,13 @@ MFLAGS= MAKEFLAGS= # Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= -PACKAGE_URL= - -ac_unique_file="main.c" -ac_unique_file="header.h" +PACKAGE_NAME='sntp' +PACKAGE_TARNAME='sntp' +PACKAGE_VERSION='4.2.6p5' +PACKAGE_STRING='sntp 4.2.6p5' +PACKAGE_BUGREPORT='' +PACKAGE_URL='' + # Factoring default headers for most tests. ac_includes_default="\ #include <stdio.h> @@ -746,23 +612,45 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +NTP_BINSUBDIR_IS_BIN_FALSE +NTP_BINSUBDIR_IS_BIN_TRUE BINSUBDIR +LCRYPTO +OPENSSL_LIB +OPENSSL_INC +OPENSSL HAVE_INLINE +LIBM +OTOOL64 +OTOOL +LIPO +NMEDIT +DSYMUTIL +MANIFEST_TOOL +RANLIB +ac_ct_AR +AR +DLLTOOL +OBJDUMP +LN_S +NM +ac_ct_DUMPBIN +DUMPBIN +LD +FGREP +LIBTOOL +LIBOPTS_DIR LIBOPTS_CFLAGS LIBOPTS_LDADD NEED_LIBOPTS_FALSE NEED_LIBOPTS_TRUE INSTALL_LIBOPTS_FALSE INSTALL_LIBOPTS_TRUE -LIBOPTS_DIR -LIBTOOL -CPP -RANLIB -AR -ECHO -LN_S +POSIX_SHELL +SED EGREP GREP +CPP am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE @@ -853,12 +741,6 @@ ac_user_opts=' enable_option_checking enable_dependency_tracking enable_shared -enable_static -enable_fast_install -with_gnu_ld -enable_libtool_lock -with_pic -with_tags enable_local_libopts enable_libopts_install with_autoopts_config @@ -867,6 +749,17 @@ with_libregex with_libregex_cflags with_libregex_libs enable_optional_args +enable_static +with_pic +enable_fast_install +with_gnu_ld +with_sysroot +enable_libtool_lock +with_openssl_libdir +with_openssl_incdir +with_crypto +enable_ipv6 +with_kame with_binsubdir ' ac_precious_vars='build_alias @@ -918,7 +811,7 @@ sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE}' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' @@ -940,8 +833,9 @@ do fi case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. @@ -986,7 +880,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1012,7 +906,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1216,7 +1110,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1232,7 +1126,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1262,8 +1156,8 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) as_fn_error "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information." + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" ;; *=*) @@ -1271,7 +1165,7 @@ Try \`$0 --help' for more information." # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error "invalid variable name: \`$ac_envvar'" ;; + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; @@ -1281,7 +1175,7 @@ Try \`$0 --help' for more information." $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac @@ -1289,13 +1183,13 @@ done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error "missing argument to $ac_option" + as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; - fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1318,7 +1212,7 @@ do [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' @@ -1332,8 +1226,8 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_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 + $as_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 @@ -1348,9 +1242,9 @@ test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error "working directory cannot be determined" + as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error "pwd does not report name of working directory" + as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. @@ -1389,11 +1283,11 @@ else fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then @@ -1419,7 +1313,7 @@ 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. +\`configure' configures sntp 4.2.6p5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1433,7 +1327,7 @@ Configuration: --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 + -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 @@ -1467,7 +1361,7 @@ Fine tuning of the installation directories: --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] + --docdir=DIR documentation root [DATAROOTDIR/doc/sntp] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] @@ -1488,7 +1382,9 @@ _ACEOF fi if test -n "$ac_init_help"; then - + case $ac_init_help in + short | recursive ) echo "Configuration of sntp 4.2.6p5:";; + esac cat <<\_ACEOF Optional Features: @@ -1498,27 +1394,34 @@ Optional Features: --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-shared[=PKGS] build shared libraries [default=no] - --enable-static[=PKGS] build static libraries [default=yes] - --enable-fast-install[=PKGS] - optimize for fast installation [default=yes] - --disable-libtool-lock avoid locking (might break parallel builds) --enable-local-libopts Force using the supplied libopts tearoff code --disable-libopts-install Do not install libopts with client installation --disable-optional-args not wanting optional option args + --enable-static[=PKGS] build static libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + --enable-ipv6 s use IPv6? + 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-pic try to use only PIC/non-PIC objects [default=use - both] - --with-tags[=TAGS] include additional configurations [automatic] --with-autoopts-config specify the config-info script --with-regex-header a reg expr header is specified --with-libregex libregex installation prefix --with-libregex-cflags libregex compile flags --with-libregex-libs libregex link command arguments + --with-pic try to use only PIC/non-PIC objects [default=use + both] + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-sysroot=DIR Search for dependent libraries within DIR + (or the compiler's sysroot if not specified). + --with-openssl-libdir + =/something/reasonable + --with-openssl-incdir + =/something/reasonable + --with-crypto + =openssl + --with-kame - =/usr/local/v6 --with-binsubdir bin ={bin,sbin} Some influential environment variables: @@ -1597,10 +1500,10 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -configure -generated by GNU Autoconf 2.65 +sntp configure 4.2.6p5 +generated by GNU Autoconf 2.68 -Copyright (C) 2009 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1644,26 +1547,25 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" + if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 @@ -1671,44 +1573,79 @@ $as_echo "$ac_try_echo"; } >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_retval=1 + ac_retval=1 fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval -} # ac_fn_c_try_link +} # ac_fn_c_try_cpp -# ac_fn_c_try_cpp LINENO +# ac_fn_c_try_run LINENO # ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" + if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 @@ -1716,21 +1653,29 @@ $as_echo "$ac_try_echo"; } >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_retval=1 + ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval -} # ac_fn_c_try_cpp +} # ac_fn_c_try_link # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- @@ -1740,10 +1685,10 @@ fi ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -1779,7 +1724,7 @@ if ac_fn_c_try_cpp "$LINENO"; then : else ac_header_preproc=no fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } @@ -1806,7 +1751,7 @@ $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -1815,52 +1760,10 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in @@ -1870,7 +1773,7 @@ ac_fn_c_check_header_compile () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1888,77 +1791,10 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case <limits.h> declares $2. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* 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_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_func - # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache @@ -1968,7 +1804,7 @@ ac_fn_c_check_type () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -2009,7 +1845,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type @@ -2186,16 +2022,83 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ rm -f conftest.val fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_compute_int + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case <limits.h> declares $2. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* 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_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func cat >config.log <<_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.65. Invocation command line was +It was created by sntp $as_me 4.2.6p5, which was +generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2305,11 +2208,9 @@ trap 'exit_status=$? { echo - cat <<\_ASBOX -## ---------------- ## + $as_echo "## ---------------- ## ## Cache variables. ## -## ---------------- ## -_ASBOX +## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( @@ -2343,11 +2244,9 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - cat <<\_ASBOX -## ----------------- ## + $as_echo "## ----------------- ## ## Output variables. ## -## ----------------- ## -_ASBOX +## ----------------- ##" echo for ac_var in $ac_subst_vars do @@ -2360,11 +2259,9 @@ _ASBOX echo if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------------- ## + $as_echo "## ------------------- ## ## File substitutions. ## -## ------------------- ## -_ASBOX +## ------------------- ##" echo for ac_var in $ac_subst_files do @@ -2378,11 +2275,9 @@ _ASBOX fi if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## + $as_echo "## ----------- ## ## confdefs.h. ## -## ----------- ## -_ASBOX +## ----------- ##" echo cat confdefs.h echo @@ -2437,7 +2332,12 @@ _ACEOF ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - ac_site_file1=$CONFIG_SITE + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site @@ -2452,7 +2352,11 @@ do { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } fi done @@ -2528,7 +2432,7 @@ if $ac_cache_corrupted; then $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## @@ -2541,20 +2445,25 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -am__api_version='1.11' ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - for ac_t in install-sh install.sh shtool; do - if test -f "$ac_dir/$ac_t"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/$ac_t -c" - break 2 - fi - done +for ac_dir in . "$srcdir"/.; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + 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 - as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 + as_fn_error $? "cannot find install-sh, install.sh, or shtool in . \"$srcdir\"/." "$LINENO" 5 fi # These three variables are undocumented and unsupported, @@ -2566,6 +2475,132 @@ ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + +# Increment sntp_configure_cache_version by one for each change to +# configure.ac or .m4 files which invalidates cached values from +# previous versions. +# +# If the change affects cache variables used only by the main NTP +# configure.ac, then only its version number should be bumped, while +# the subdir configure.ac version numbers should be unchanged. The +# same is true for a test/variable that is used only by one subdir +# being changed incompatibly; only that subdir's cache version needs +# bumping. +# +# If a change affects variables shared by all NTP configure scripts, +# please bump the version numbers of all three. If you are not sure, +# the safe choice is to bump all three on any cache-invalidating change. +# +# In order to avoid the risk of version stamp collision between -stable +# and -dev branches, do not simply increment the version, instead use +# the date YYYYMMDD optionally with -HHMM if there is more than one +# bump in a day. + +sntp_configure_cache_version=20091117 + +# When the version of config.cache and configure do not +# match, NTP_CACHEVERSION will flush the cache. + + + + ntp_cache_flush=1 + + case "$ntp_cv_sntp_cache_version" in + $sntp_configure_cache_version) + # same version, good + ntp_cache_flush=0 + ;; + '') + # No cache, predates ntp_cv_sntp_cache_version, or is empty. + case "$cache_file" in + /dev/null) + ntp_cache_flush=0 + ;; + *) + case "$NTP_CACHEVERSION_PARENT" in + '') + # Do not clear the cache immediately after it is created + # empty as it is noisy. Differentiate a newly-created + # config.cache from one predating the cache version + # mechanism by looking for the first cached variable set + # by Autoconf + case "$ac_cv_path_install" in + '') + # empty config.cache file + ntp_cache_flush=0 + esac + ;; + *) + # Parent configure just created cache from empty, + # flushing would be counterproductive. + ntp_cache_flush=0; + esac + esac + ;; + *) + # configure cache version mismatches config.cache version + esac + + case "$ntp_cache_flush" in + 1) + c_version="${ntp_cv_sntp_cache_version:-(no version found)}" + + # Do we flush all variables or exclude others' version stamps? + + case "$NTP_CACHEVERSION_PARENT" in + '') + # Clear all *_cv_* variables including our child subdirs' + # ntp_cv_*_cache_version variables. This prevents subdir + # configure scripts from noticing a version mismatch just + # after the top configure in the invocation cleared and + # recreated the cache. + + c_varname_list=`set | + sed -n -e 's/=.*$//' \ + -e '/_cv_/p' + ` + ;; + *) + # This is not the top configure this particular invocation. + # Clear all *_cv_* variables sparing the version stamps + # of other configure scripts, so we don't trigger + # useless repeated clearings. + + c_varname_list=`set | + sed -n -e 's/=.*$//' \ + -e '/ntp_cv_.*_cache_version/d' \ + -e '/_cv_/p' + ` + esac + + for c_varname in $c_varname_list + do + { eval $c_varname=; unset $c_varname;} + done + + { $as_echo "$as_me:${as_lineno-$LINENO}: $cache_file saved by another version, ignored." >&5 +$as_echo "$as_me: $cache_file saved by another version, ignored." >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: configure script cache version: $sntp_configure_cache_version" >&5 +$as_echo "$as_me: configure script cache version: $sntp_configure_cache_version" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: $cache_file version: $c_version" >&5 +$as_echo "$as_me: $cache_file version: $c_version" >&6;} + { c_varname=; unset c_varname;} + { c_varname_list=; unset c_varname_list;} + { c_version=; unset c_version;} + esac + + { ntp_cache_flush=; unset ntp_cache_flush;} + + # save configure version in config.cache for next time + ntp_cv_sntp_cache_version="$sntp_configure_cache_version" + + # let any subdir configure.ac NTP_CACHEVERSION invocations + # know they are not the top level. + NTP_CACHEVERSION_PARENT='sntp' ; export NTP_CACHEVERSION_PARENT + + +am__api_version='1.11' + # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: @@ -2583,7 +2618,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then : +if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -2670,11 +2705,11 @@ am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) - as_fn_error "unsafe absolute working directory name" "$LINENO" 5;; + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; + as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's @@ -2696,7 +2731,7 @@ 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". - as_fn_error "ls -t appears to fail. Make sure there is not a broken + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi @@ -2706,7 +2741,7 @@ then # Ok. : else - as_fn_error "newly created file is older than distributed files! + as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 @@ -2760,7 +2795,7 @@ if test "$cross_compiling" != no; then set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then : +if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then @@ -2800,7 +2835,7 @@ if test -z "$ac_cv_prog_STRIP"; then set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then @@ -2853,7 +2888,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then - if test "${ac_cv_path_mkdir+set}" = set; then : + if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -2904,7 +2939,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AWK+set}" = set; then : +if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then @@ -2944,7 +2979,7 @@ done $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF @@ -2952,7 +2987,7 @@ SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; @@ -2986,7 +3021,7 @@ if test "`cd $srcdir && pwd`" != "`pwd`"; then am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then - as_fn_error "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi @@ -3001,8 +3036,8 @@ fi # Define the identity of the package. - PACKAGE=msntp - VERSION=1.6 + PACKAGE='sntp' + VERSION='4.2.6p5' cat >>confdefs.h <<_ACEOF @@ -3042,30 +3077,29 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' - # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } -if test "${ac_cv_build+set}" = set; then : +if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && - as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5 + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; -*) as_fn_error "invalid value of canonical build" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' @@ -3083,14 +3117,14 @@ case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } -if test "${ac_cv_host+set}" = set; then : +if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi @@ -3098,7 +3132,7 @@ fi $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; -*) as_fn_error "invalid value of canonical host" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' @@ -3114,10 +3148,77 @@ IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + +cat >>confdefs.h <<_ACEOF +#define STR_SYSTEM "$host" +_ACEOF + ac_config_headers="$ac_config_headers config.h" # Checks for programs. +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from `make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3128,7 +3229,7 @@ if test -n "$ac_tool_prefix"; then set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3168,7 +3269,7 @@ if test -z "$ac_cv_prog_CC"; then set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3221,7 +3322,7 @@ if test -z "$CC"; then set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3261,7 +3362,7 @@ if test -z "$CC"; then set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3320,7 +3421,7 @@ if test -z "$CC"; then set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3364,7 +3465,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3418,8 +3519,8 @@ fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "no acceptable C compiler found in \$PATH -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -3533,9 +3634,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "C compiler cannot create executables -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -3577,8 +3677,8 @@ done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -3635,9 +3735,9 @@ $as_echo "$ac_try_echo"; } >&5 else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot run C compiled programs. +as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details." "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5; } fi fi fi @@ -3648,7 +3748,7 @@ rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then : +if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3688,8 +3788,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of object files: cannot compile -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -3699,7 +3799,7 @@ OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : +if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3736,7 +3836,7 @@ ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : +if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag @@ -3814,7 +3914,7 @@ else fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then : +if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no @@ -3908,74 +4008,12 @@ 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 -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from `make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf - -# Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi - if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : +if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then @@ -4098,9 +4136,698 @@ else fi +if test "x$CC" != xcc; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 +$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 +$as_echo_n "checking whether cc understands -c and -o together... " >&6; } +fi +set dummy $CC; ac_cc=`$as_echo "$2" | + sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +# Make sure it works both with $CC and with simple cc. +# We do the test twice because some compilers refuse to overwrite an +# existing .o file with -o, though they will create one. +ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' +rm -f conftest2.* +if { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && + test -f conftest2.$ac_objext && { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; +then + eval ac_cv_prog_cc_${ac_cc}_c_o=yes + if test "x$CC" != xcc; then + # Test first that cc exists at all. + if { ac_try='cc -c conftest.$ac_ext >&5' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' + rm -f conftest2.* + if { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && + test -f conftest2.$ac_objext && { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; + then + # cc works too. + : + else + # cc exists but doesn't like -o. + eval ac_cv_prog_cc_${ac_cc}_c_o=no + fi + fi + fi +else + eval ac_cv_prog_cc_${ac_cc}_c_o=no +fi +rm -f core conftest* + +fi +if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h + +fi + +# FIXME: we rely on the cache variable name because +# there is no other way. +set dummy $CC +am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o +if test "$am_t" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # 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 <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$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 <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +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 + + +# AC_PROG_CC_STDC has two functions. It attempts to find a compiler +# capable of C99, or failing that, for C89. CC is set afterward with +# the selected invocation, such as "gcc --std=gnu99". Also, the +# ac_cv_prog_cc_stdc variable is no if the compiler selected for CC +# does not accept C89. + + case $ac_cv_prog_cc_stdc in #( + no) : + ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; #( + *) : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 +$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } +if ${ac_cv_prog_cc_c99+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdarg.h> +#include <stdbool.h> +#include <stdlib.h> +#include <wchar.h> +#include <stdio.h> + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +#define debug(...) fprintf (stderr, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + your preprocessor is broken; +#endif +#if BIG_OK +#else + your preprocessor is broken; +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\0'; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static void +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str; + int number; + float fnumber; + + while (*format) + { + switch (*format++) + { + case 's': // string + str = va_arg (args_copy, const char *); + break; + case 'd': // int + number = va_arg (args_copy, int); + break; + case 'f': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); +} + +int +main () +{ + + // Check bool. + _Bool success = false; + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + test_varargs ("s, d' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' + || dynamic_array[ni.number - 1] != 543); + + ; + return 0; +} +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -xc99=all -qlanglvl=extc99 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c99" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c99" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c99" != xno; then : + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* 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 -std 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 -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 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 +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 +else + ac_cv_prog_cc_stdc=no +fi + +fi + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO Standard C" >&5 +$as_echo_n "checking for $CC option to accept ISO Standard C... " >&6; } + if ${ac_cv_prog_cc_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +fi + + case $ac_cv_prog_cc_stdc in #( + no) : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; #( + '') : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; #( + *) : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_stdc" >&5 +$as_echo "$ac_cv_prog_cc_stdc" >&6; } ;; +esac + + +case "$ac_cv_prog_cc_stdc" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ANSI C89/ISO C90 is the minimum to compile SNTP + version 4.2.5 and higher." >&5 +$as_echo "$as_me: WARNING: ANSI C89/ISO C90 is the minimum to compile SNTP + version 4.2.5 and higher." >&2;} +esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC can handle #warning" >&5 +$as_echo_n "checking if $CC can handle #warning... " >&6; } +if ${ntp_cv_cpp_warning+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#warning foo + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ntp_cv_cpp_warning=yes +else + ntp_cv_cpp_warning=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_cv_cpp_warning" >&5 +$as_echo "$ntp_cv_cpp_warning" >&6; } +case "$ntp_cv_cpp_warning" in + no) + +$as_echo "#define NO_OPTION_NAME_WARNINGS 1" >>confdefs.h + +esac + +case "$GCC" in + yes) + SAVED_CFLAGS_NTP="$CFLAGS" + CFLAGS="$CFLAGS -Wstrict-overflow" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC can handle -Wstrict-overflow" >&5 +$as_echo_n "checking if $CC can handle -Wstrict-overflow... " >&6; } +if ${ntp_cv_gcc_Wstrict_overflow+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ntp_cv_gcc_Wstrict_overflow=yes +else + ntp_cv_gcc_Wstrict_overflow=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_cv_gcc_Wstrict_overflow" >&5 +$as_echo "$ntp_cv_gcc_Wstrict_overflow" >&6; } + # + # $ntp_cv_gcc_Wstrict_overflow is tested later to add the + # flag to CFLAGS. + # + CFLAGS="$SAVED_CFLAGS_NTP -Winit-self" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC can handle -Winit-self" >&5 +$as_echo_n "checking if $CC can handle -Winit-self... " >&6; } +if ${ntp_cv_gcc_Winit_self+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ntp_cv_gcc_Winit_self=yes +else + ntp_cv_gcc_Winit_self=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_cv_gcc_Winit_self" >&5 +$as_echo "$ntp_cv_gcc_Winit_self" >&6; } + CFLAGS="$SAVED_CFLAGS_NTP" + { SAVED_CFLAGS_NTP=; unset SAVED_CFLAGS_NTP;} + # + # $ntp_cv_gcc_Winit_self is tested later to add the + # flag to CFLAGS. + # +esac + +# HMS: These need to be moved to AM_CPPFLAGS and/or AM_CFLAGS +case "$host" in + *-*-solaris*) + # see "man standards". + # -D_XOPEN_SOURCE=500 is probably OK for c89 and before + # -D_XOPEN_SOURCE=600 seems OK for c99 + #CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500 -D__EXTENSIONS__" + CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__" + libxnet=-lxnet + ;; +esac -# So far, the only shared library we might use is libopts. -# It's a small library - we might as well use a static version of it. # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} @@ -4130,114 +4857,26 @@ fi -# Check whether --enable-static was given. -if test "${enable_static+set}" = set; then : - enableval=$enable_static; p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_static=yes -fi - - -# Check whether --enable-fast-install was given. -if test "${enable_fast_install+set}" = set; then : - enableval=$enable_fast_install; p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_fast_install=yes -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 -$as_echo_n "checking for a sed that does not truncate output... " >&6; } -if test "${lt_cv_path_SED+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - # Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && continue - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -fi -SED=$lt_cv_path_SED -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SED" >&5 -$as_echo "$SED" >&6; } +# NTP has (so far) been relying on leading-edge autogen. +# Therefore, by default: +# - use the version we ship with +# - do not install it +# - build a static copy (AC_DISABLE_SHARED - done earlier) +case "${enable_local_libopts+set}" in + set) ;; + *) enable_local_libopts=yes ;; +esac +case "${enable_libopts_install+set}" in + set) ;; + *) enable_libopts_install=no ;; +esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then : +if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -4286,7 +4925,7 @@ esac done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then - as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP @@ -4300,7 +4939,7 @@ $as_echo "$ac_cv_path_GREP" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then : +if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -4352,7 +4991,7 @@ esac done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then - as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP @@ -4365,6 +5004,1959 @@ $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <string.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdlib.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +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 : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <ctype.h> +#include <stdlib.h> +#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 + +#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)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# 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 : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" +if test "x$ac_cv_type_pid_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define pid_t int +_ACEOF + +fi + + + + ac_header_dirent=no +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do + as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 +$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } +if eval \${$as_ac_Header+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <sys/types.h> +#include <$ac_hdr> + +int +main () +{ +if ((DIR *) 0) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$as_ac_Header=yes" +else + eval "$as_ac_Header=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$as_ac_Header + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 +_ACEOF + +ac_header_dirent=$ac_hdr; break +fi + +done +# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. +if test $ac_header_dirent = dirent.h; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 +$as_echo_n "checking for library containing opendir... " >&6; } +if ${ac_cv_search_opendir+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char opendir (); +int +main () +{ +return opendir (); + ; + return 0; +} +_ACEOF +for ac_lib in '' dir; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_opendir=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_opendir+:} false; then : + break +fi +done +if ${ac_cv_search_opendir+:} false; then : + +else + ac_cv_search_opendir=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 +$as_echo "$ac_cv_search_opendir" >&6; } +ac_res=$ac_cv_search_opendir +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 +$as_echo_n "checking for library containing opendir... " >&6; } +if ${ac_cv_search_opendir+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char opendir (); +int +main () +{ +return opendir (); + ; + return 0; +} +_ACEOF +for ac_lib in '' x; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_opendir=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_opendir+:} false; then : + break +fi +done +if ${ac_cv_search_opendir+:} false; then : + +else + ac_cv_search_opendir=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 +$as_echo "$ac_cv_search_opendir" >&6; } +ac_res=$ac_cv_search_opendir +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +fi + + + # ================= + # AC_CHECK_HEADERS + # ================= + for ac_header in \ + dlfcn.h errno.h fcntl.h libgen.h \ + memory.h netinet/in.h setjmp.h sys/mman.h \ + sys/param.h sys/poll.h sys/procset.h sys/select.h \ + sys/socket.h sys/stropts.h sys/time.h sys/un.h \ + sys/wait.h unistd.h utime.h sysexits.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + for ac_header in stdarg.h varargs.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + lo_have_arg_hdr=true;break +else + lo_have_arg_hdr=false +fi + +done + + + for ac_header in string.h strings.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + lo_have_str_hdr=true;break +else + lo_have_str_hdr=false +fi + +done + + + for ac_header in limits.h sys/limits.h values.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + lo_have_lim_hdr=true;break +else + lo_have_lim_hdr=false +fi + +done + + + for ac_header in inttypes.h stdint.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + lo_have_typ_hdr=true;break +else + lo_have_typ_hdr=false +fi + +done + + + # ---------------------------------------------------------------------- + # check for various programs used during the build. + # On OS/X, "wchar.h" needs "runetype.h" to work properly. + # ---------------------------------------------------------------------- + for ac_header in runetype.h wchar.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " + $ac_includes_default + #if HAVE_RUNETYPE_H + # include <runetype.h> + #endif + +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + # -------------------------------------------- + # Verify certain entries from AC_CHECK_HEADERS + # -------------------------------------------- + for f in sys_types sys_mman sys_param sys_stat sys_wait \ + string errno stdlib memory setjmp + do eval as_ac_var=\${ac_cv_header_${f}_h+set} + test "${as_ac_var}" = set || { + as_fn_error $? "You must have ${f}.h on your system" "$LINENO" 5 + } + done + + ${lo_have_arg_hdr} || \ + as_fn_error $? "You must have stdarg.h or varargs.h on your system" "$LINENO" 5 + + ${lo_have_str_hdr} || \ + as_fn_error $? "You must have string.h or strings.h on your system" "$LINENO" 5 + + ${lo_have_lim_hdr} || \ + as_fn_error $? "You must have one of limits.h, sys/limits.h or values.h" "$LINENO" 5 + + ${lo_have_typ_hdr} || \ + as_fn_error $? "You must have inttypes.h or stdint.h on your system" "$LINENO" 5 + + # ---------------------------------------------------------------------- + # Checks for typedefs + # ---------------------------------------------------------------------- + ac_fn_c_check_type "$LINENO" "wchar_t" "ac_cv_type_wchar_t" "$ac_includes_default" +if test "x$ac_cv_type_wchar_t" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_WCHAR_T 1 +_ACEOF + + +fi + + ac_fn_c_check_type "$LINENO" "wint_t" "ac_cv_type_wint_t" " + $ac_includes_default + #if HAVE_RUNETYPE_H + # include <runetype.h> + #endif + #if HAVE_WCHAR_H + # include <wchar.h> + #endif + +" +if test "x$ac_cv_type_wint_t" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_WINT_T 1 +_ACEOF + + +fi + + ac_fn_c_check_type "$LINENO" "int8_t" "ac_cv_type_int8_t" "$ac_includes_default" +if test "x$ac_cv_type_int8_t" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_INT8_T 1 +_ACEOF + + +fi +ac_fn_c_check_type "$LINENO" "uint8_t" "ac_cv_type_uint8_t" "$ac_includes_default" +if test "x$ac_cv_type_uint8_t" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_UINT8_T 1 +_ACEOF + + +fi +ac_fn_c_check_type "$LINENO" "int16_t" "ac_cv_type_int16_t" "$ac_includes_default" +if test "x$ac_cv_type_int16_t" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_INT16_T 1 +_ACEOF + + +fi +ac_fn_c_check_type "$LINENO" "uint16_t" "ac_cv_type_uint16_t" "$ac_includes_default" +if test "x$ac_cv_type_uint16_t" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_UINT16_T 1 +_ACEOF + + +fi +ac_fn_c_check_type "$LINENO" "int32_t" "ac_cv_type_int32_t" "$ac_includes_default" +if test "x$ac_cv_type_int32_t" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_INT32_T 1 +_ACEOF + + +fi +ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "$ac_includes_default" +if test "x$ac_cv_type_uint32_t" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_UINT32_T 1 +_ACEOF + + +fi +ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "$ac_includes_default" +if test "x$ac_cv_type_intptr_t" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_INTPTR_T 1 +_ACEOF + + +fi +ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "$ac_includes_default" +if test "x$ac_cv_type_uintptr_t" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_UINTPTR_T 1 +_ACEOF + + +fi +ac_fn_c_check_type "$LINENO" "uint_t" "ac_cv_type_uint_t" "$ac_includes_default" +if test "x$ac_cv_type_uint_t" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_UINT_T 1 +_ACEOF + + +fi +ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" +if test "x$ac_cv_type_pid_t" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_PID_T 1 +_ACEOF + + +fi +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_SIZE_T 1 +_ACEOF + + +fi + + + # ===== + # sizes + # ===== + # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of char*" >&5 +$as_echo_n "checking size of char*... " >&6; } +if ${ac_cv_sizeof_charp+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (char*))" "ac_cv_sizeof_charp" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_charp" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (char*) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_charp=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_charp" >&5 +$as_echo "$ac_cv_sizeof_charp" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_CHARP $ac_cv_sizeof_charp +_ACEOF + + + # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 +$as_echo_n "checking size of int... " >&6; } +if ${ac_cv_sizeof_int+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_int" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (int) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_int=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 +$as_echo "$ac_cv_sizeof_int" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_INT $ac_cv_sizeof_int +_ACEOF + + + # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 +$as_echo_n "checking size of long... " >&6; } +if ${ac_cv_sizeof_long+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_long" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (long) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_long=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 +$as_echo "$ac_cv_sizeof_long" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG $ac_cv_sizeof_long +_ACEOF + + + # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 +$as_echo_n "checking size of short... " >&6; } +if ${ac_cv_sizeof_short+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_short" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (short) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_short=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5 +$as_echo "$ac_cv_sizeof_short" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_SHORT $ac_cv_sizeof_short +_ACEOF + + + + # ---------------------------------------------------------------------- + # AC_CHECK_LIB for SVR4 libgen, and use it if it defines pathfind. + # ---------------------------------------------------------------------- + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pathfind in -lgen" >&5 +$as_echo_n "checking for pathfind in -lgen... " >&6; } +if ${ac_cv_lib_gen_pathfind+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgen $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pathfind (); +int +main () +{ +return pathfind (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_gen_pathfind=yes +else + ac_cv_lib_gen_pathfind=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gen_pathfind" >&5 +$as_echo "$ac_cv_lib_gen_pathfind" >&6; } +if test "x$ac_cv_lib_gen_pathfind" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBGEN 1 +_ACEOF + + LIBS="-lgen $LIBS" + +fi + + for ac_func in vprintf +do : + ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf" +if test "x$ac_cv_func_vprintf" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_VPRINTF 1 +_ACEOF + +ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt" +if test "x$ac_cv_func__doprnt" = xyes; then : + +$as_echo "#define HAVE_DOPRNT 1" >>confdefs.h + +fi + +fi +done + + + for ac_header in vfork.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" +if test "x$ac_cv_header_vfork_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_VFORK_H 1 +_ACEOF + +fi + +done + +for ac_func in fork vfork +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +if test "x$ac_cv_func_fork" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 +$as_echo_n "checking for working fork... " >&6; } +if ${ac_cv_func_fork_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_fork_works=cross +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + /* By Ruediger Kuhlmann. */ + return fork () < 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_fork_works=yes +else + ac_cv_func_fork_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 +$as_echo "$ac_cv_func_fork_works" >&6; } + +else + ac_cv_func_fork_works=$ac_cv_func_fork +fi +if test "x$ac_cv_func_fork_works" = xcross; then + case $host in + *-*-amigaos* | *-*-msdosdjgpp*) + # Override, as these systems have only a dummy fork() stub + ac_cv_func_fork_works=no + ;; + *) + ac_cv_func_fork_works=yes + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 +$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} +fi +ac_cv_func_vfork_works=$ac_cv_func_vfork +if test "x$ac_cv_func_vfork" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 +$as_echo_n "checking for working vfork... " >&6; } +if ${ac_cv_func_vfork_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_vfork_works=cross +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Thanks to Paul Eggert for this test. */ +$ac_includes_default +#include <sys/wait.h> +#ifdef HAVE_VFORK_H +# include <vfork.h> +#endif +/* On some sparc systems, changes by the child to local and incoming + argument registers are propagated back to the parent. The compiler + is told about this with #include <vfork.h>, but some compilers + (e.g. gcc -O) don't grok <vfork.h>. Test for this by using a + static variable whose address is put into a register that is + clobbered by the vfork. */ +static void +#ifdef __cplusplus +sparc_address_test (int arg) +# else +sparc_address_test (arg) int arg; +#endif +{ + static pid_t child; + if (!child) { + child = vfork (); + if (child < 0) { + perror ("vfork"); + _exit(2); + } + if (!child) { + arg = getpid(); + write(-1, "", 0); + _exit (arg); + } + } +} + +int +main () +{ + pid_t parent = getpid (); + pid_t child; + + sparc_address_test (0); + + child = vfork (); + + if (child == 0) { + /* Here is another test for sparc vfork register problems. This + test uses lots of local variables, at least as many local + variables as main has allocated so far including compiler + temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris + 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should + reuse the register of parent for one of the local variables, + since it will think that parent can't possibly be used any more + in this routine. Assigning to the local variable will thus + munge parent in the parent process. */ + pid_t + p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), + p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); + /* Convince the compiler that p..p7 are live; otherwise, it might + use the same hardware register for all 8 local variables. */ + if (p != p1 || p != p2 || p != p3 || p != p4 + || p != p5 || p != p6 || p != p7) + _exit(1); + + /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent + from child file descriptors. If the child closes a descriptor + before it execs or exits, this munges the parent's descriptor + as well. Test for this by closing stdout in the child. */ + _exit(close(fileno(stdout)) != 0); + } else { + int status; + struct stat st; + + while (wait(&status) != child) + ; + return ( + /* Was there some problem with vforking? */ + child < 0 + + /* Did the child fail? (This shouldn't happen.) */ + || status + + /* Did the vfork/compiler bug occur? */ + || parent != getpid() + + /* Did the file descriptor bug occur? */ + || fstat(fileno(stdout), &st) != 0 + ); + } +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_vfork_works=yes +else + ac_cv_func_vfork_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 +$as_echo "$ac_cv_func_vfork_works" >&6; } + +fi; +if test "x$ac_cv_func_fork_works" = xcross; then + ac_cv_func_vfork_works=$ac_cv_func_vfork + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 +$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} +fi + +if test "x$ac_cv_func_vfork_works" = xyes; then + +$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h + +else + +$as_echo "#define vfork fork" >>confdefs.h + +fi +if test "x$ac_cv_func_fork_works" = xyes; then + +$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h + +fi + + for ac_func in mmap canonicalize_file_name snprintf strdup strchr \ + strrchr strsignal +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + 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_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + + while : + do + POSIX_SHELL=`which bash` + test -x "$POSIX_SHELL" && break + POSIX_SHELL=`which dash` + test -x "$POSIX_SHELL" && break + POSIX_SHELL=/usr/xpg4/bin/sh + test -x "$POSIX_SHELL" && break + POSIX_SHELL=`/bin/sh -c ' + exec 2>/dev/null + if ! true ; then exit 1 ; fi + echo /bin/sh'` + test -x "$POSIX_SHELL" && break + as_fn_error $? "Cannot locate a working POSIX shell" "$LINENO" 5 + done + +cat >>confdefs.h <<_ACEOF +#define POSIX_SHELL "${POSIX_SHELL}" +_ACEOF + + + + + + LIBOPTS_BUILD_BLOCKED='' + + + NEED_LIBOPTS_DIR='' + + # Check whether --enable-local-libopts was given. +if test "${enable_local_libopts+set}" = set; then : + enableval=$enable_local_libopts; + if test x$enableval = xyes ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Using supplied libopts tearoff" >&5 +$as_echo "$as_me: Using supplied libopts tearoff" >&6;} + LIBOPTS_LDADD='$(top_builddir)/libopts/libopts.la' + LIBOPTS_CFLAGS='-I$(top_srcdir)/libopts' + NEED_LIBOPTS_DIR=true + fi +fi + + + # Check whether --enable-libopts-install was given. +if test "${enable_libopts_install+set}" = set; then : + enableval=$enable_libopts_install; +fi + + if test "X${enable_libopts_install}" != Xno; then + INSTALL_LIBOPTS_TRUE= + INSTALL_LIBOPTS_FALSE='#' +else + INSTALL_LIBOPTS_TRUE='#' + INSTALL_LIBOPTS_FALSE= +fi + + + if test -z "${NEED_LIBOPTS_DIR}" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether autoopts-config can be found" >&5 +$as_echo_n "checking whether autoopts-config can be found... " >&6; } + +# Check whether --with-autoopts-config was given. +if test "${with_autoopts_config+set}" = set; then : + withval=$with_autoopts_config; lo_cv_with_autoopts_config=${with_autoopts_config} +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether autoopts-config is specified" >&5 +$as_echo_n "checking whether autoopts-config is specified... " >&6; } +if ${lo_cv_with_autoopts_config+:} false; then : + $as_echo_n "(cached) " >&6 +else + if autoopts-config --help 2>/dev/null 1>&2 + then lo_cv_with_autoopts_config=autoopts-config + elif libopts-config --help 2>/dev/null 1>&2 + then lo_cv_with_autoopts_config=libopts-config + else lo_cv_with_autoopts_config=no ; fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lo_cv_with_autoopts_config" >&5 +$as_echo "$lo_cv_with_autoopts_config" >&6; } + +fi + # end of AC_ARG_WITH + + if ${lo_cv_test_autoopts+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test -z "${lo_cv_with_autoopts_config}" \ + -o X"${lo_cv_with_autoopts_config}" = Xno + then + if autoopts-config --help 2>/dev/null 1>&2 + then lo_cv_with_autoopts_config=autoopts-config + elif libopts-config --help 2>/dev/null 1>&2 + then lo_cv_with_autoopts_config=libopts-config + else lo_cv_with_autoopts_config=false ; fi + fi + lo_cv_test_autoopts=` + ${lo_cv_with_autoopts_config} --libs` 2> /dev/null + if test $? -ne 0 -o -z "${lo_cv_test_autoopts}" + then lo_cv_test_autoopts=no ; fi + +fi + # end of CACHE_VAL + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lo_cv_test_autoopts}" >&5 +$as_echo "${lo_cv_test_autoopts}" >&6; } + + if test "X${lo_cv_test_autoopts}" != Xno + then + LIBOPTS_LDADD="${lo_cv_test_autoopts}" + LIBOPTS_CFLAGS="`${lo_cv_with_autoopts_config} --cflags`" + else + LIBOPTS_LDADD='$(top_builddir)/libopts/libopts.la' + LIBOPTS_CFLAGS='-I$(top_srcdir)/libopts' + NEED_LIBOPTS_DIR=true + fi + fi # end of if test -z "${NEED_LIBOPTS_DIR}" + if test -n "${LIBOPTS_BUILD_BLOCKED}" ; then + NEED_LIBOPTS_DIR='' + fi + if test -n "${NEED_LIBOPTS_DIR}"; then + NEED_LIBOPTS_TRUE= + NEED_LIBOPTS_FALSE='#' +else + NEED_LIBOPTS_TRUE='#' + NEED_LIBOPTS_FALSE= +fi + + + + LIBOPTS_DIR=libopts + + +# end of AC_DEFUN of LIBOPTS_CHECK_COMMON + + +if test -z "$NEED_LIBOPTS_TRUE"; then : + + + + # Check to see if a reg expr header is specified. + + +# Check whether --with-regex-header was given. +if test "${with_regex_header+set}" = set; then : + withval=$with_regex_header; libopts_cv_with_regex_header=${with_regex_header} +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a reg expr header is specified" >&5 +$as_echo_n "checking whether a reg expr header is specified... " >&6; } +if ${libopts_cv_with_regex_header+:} false; then : + $as_echo_n "(cached) " >&6 +else + libopts_cv_with_regex_header=no +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libopts_cv_with_regex_header" >&5 +$as_echo "$libopts_cv_with_regex_header" >&6; } + +fi + # end of AC_ARG_WITH + if test "X${libopts_cv_with_regex_header}" != Xno + then + cat >>confdefs.h <<_ACEOF +#define REGEX_HEADER <${libopts_cv_with_regex_header}> +_ACEOF + + else + +$as_echo "#define REGEX_HEADER <regex.h>" >>confdefs.h + + fi + + + + # Check to see if a working libregex can be found. + + +# Check whether --with-libregex was given. +if test "${with_libregex+set}" = set; then : + withval=$with_libregex; libopts_cv_with_libregex_root=${with_libregex} +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether with-libregex was specified" >&5 +$as_echo_n "checking whether with-libregex was specified... " >&6; } +if ${libopts_cv_with_libregex_root+:} false; then : + $as_echo_n "(cached) " >&6 +else + libopts_cv_with_libregex_root=no +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libopts_cv_with_libregex_root" >&5 +$as_echo "$libopts_cv_with_libregex_root" >&6; } + +fi + # end of AC_ARG_WITH libregex + + if test "${with_libregex+set}" = set && \ + test "${withval}" = no + then ## disabled by request + libopts_cv_with_libregex_root=no + libopts_cv_with_libregex_cflags=no + libopts_cv_with_libregex_libs=no + else + + +# Check whether --with-libregex-cflags was given. +if test "${with_libregex_cflags+set}" = set; then : + withval=$with_libregex_cflags; libopts_cv_with_libregex_cflags=${with_regex_cflags} +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether with-libregex-cflags was specified" >&5 +$as_echo_n "checking whether with-libregex-cflags was specified... " >&6; } +if ${libopts_cv_with_libregex_cflags+:} false; then : + $as_echo_n "(cached) " >&6 +else + libopts_cv_with_libregex_cflags=no +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libopts_cv_with_libregex_cflags" >&5 +$as_echo "$libopts_cv_with_libregex_cflags" >&6; } + +fi + # end of AC_ARG_WITH libregex-cflags + + +# Check whether --with-libregex-libs was given. +if test "${with_libregex_libs+set}" = set; then : + withval=$with_libregex_libs; libopts_cv_with_libregex_libs=${with_regex_libs} +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether with-libregex-libs was specified" >&5 +$as_echo_n "checking whether with-libregex-libs was specified... " >&6; } +if ${libopts_cv_with_libregex_libs+:} false; then : + $as_echo_n "(cached) " >&6 +else + libopts_cv_with_libregex_libs=no +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libopts_cv_with_libregex_libs" >&5 +$as_echo "$libopts_cv_with_libregex_libs" >&6; } + +fi + # end of AC_ARG_WITH libregex-libs + + case "X${libopts_cv_with_libregex_cflags}" in + Xyes|Xno|X ) + case "X${libopts_cv_with_libregex_root}" in + Xyes|Xno|X ) libopts_cv_with_libregex_cflags=no ;; + * ) libopts_cv_with_libregex_cflags=-I${libopts_cv_with_libregex_root}/include ;; + esac + esac + case "X${libopts_cv_with_libregex_libs}" in + Xyes|Xno|X ) + case "X${libopts_cv_with_libregex_root}" in + Xyes|Xno|X ) libopts_cv_with_libregex_libs=no ;; + * ) libopts_cv_with_libregex_libs="-L${libopts_cv_with_libregex_root}/lib -lregex";; + esac + esac + libopts_save_CPPFLAGS="${CPPFLAGS}" + libopts_save_LIBS="${LIBS}" + fi ## disabled by request + + case "X${libopts_cv_with_libregex_cflags}" in + Xyes|Xno|X ) + libopts_cv_with_libregex_cflags="" ;; + * ) CPPFLAGS="${CPPFLAGS} ${libopts_cv_with_libregex_cflags}" ;; + esac + case "X${libopts_cv_with_libregex_libs}" in + Xyes|Xno|X ) + libopts_cv_with_libregex_libs="" ;; + * ) + LIBS="${LIBS} ${libopts_cv_with_libregex_libs}" ;; + esac + LIBREGEX_CFLAGS="" + LIBREGEX_LIBS="" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libregex functions properly" >&5 +$as_echo_n "checking whether libregex functions properly... " >&6; } + if ${libopts_cv_with_libregex+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test "$cross_compiling" = yes; then : + libopts_cv_with_libregex=no +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> +#include REGEX_HEADER +static regex_t re; +void comp_re( char const* pzPat ) { + int res = regcomp( &re, pzPat, REG_EXTENDED|REG_ICASE|REG_NEWLINE ); + if (res == 0) return; + exit( res ); } +int main() { + regmatch_t m[2]; + comp_re( "^.*\$" ); + comp_re( "()|no.*" ); + comp_re( "." ); + if (regexec( &re, "X", 2, m, 0 ) != 0) return 1; + if ((m[0].rm_so != 0) || (m[0].rm_eo != 1)) { + fputs( "error: regex -->.<-- did not match\n", stderr ); + return 1; + } + return 0; } +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + libopts_cv_with_libregex=yes +else + libopts_cv_with_libregex=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + # end of AC_TRY_RUN + +fi + # end of AC_CACHE_VAL for libopts_cv_with_libregex + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${libopts_cv_with_libregex}" >&5 +$as_echo "${libopts_cv_with_libregex}" >&6; } + if test "X${libopts_cv_with_libregex}" != Xno + then + +$as_echo "#define WITH_LIBREGEX 1" >>confdefs.h + + else + CPPFLAGS="${libopts_save_CPPFLAGS}" + LIBS="${libopts_save_LIBS}" + fi + + + + # Check to see if pathfind(3) works. + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pathfind(3) works" >&5 +$as_echo_n "checking whether pathfind(3) works... " >&6; } + if ${libopts_cv_run_pathfind+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test "$cross_compiling" = yes; then : + libopts_cv_run_pathfind=no + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <string.h> +#include <stdlib.h> +int main (int argc, char** argv) { + char* pz = pathfind( getenv( "PATH" ), "sh", "x" ); + return (pz == 0) ? 1 : 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + libopts_cv_run_pathfind=yes +else + libopts_cv_run_pathfind=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + # end of TRY_RUN + +fi + # end of AC_CACHE_VAL for libopts_cv_run_pathfind + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${libopts_cv_run_pathfind}" >&5 +$as_echo "${libopts_cv_run_pathfind}" >&6; } + if test "X${libopts_cv_run_pathfind}" != Xno + then + +$as_echo "#define HAVE_PATHFIND 1" >>confdefs.h + + fi + + + + # Check to see if /dev/zero is readable device. + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether /dev/zero is readable device" >&5 +$as_echo_n "checking whether /dev/zero is readable device... " >&6; } + if ${libopts_cv_test_dev_zero+:} false; then : + $as_echo_n "(cached) " >&6 +else + + libopts_cv_test_dev_zero=`exec 2> /dev/null +dzero=\`ls -lL /dev/zero | egrep ^c......r\` +test -z "${dzero}" && exit 1 +echo ${dzero}` + if test $? -ne 0 || test -z "$libopts_cv_test_dev_zero" + then libopts_cv_test_dev_zero=no + fi + +fi + # end of CACHE_VAL of libopts_cv_test_dev_zero + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${libopts_cv_test_dev_zero}" >&5 +$as_echo "${libopts_cv_test_dev_zero}" >&6; } + if test "X${libopts_cv_test_dev_zero}" != Xno + then + +$as_echo "#define HAVE_DEV_ZERO 1" >>confdefs.h + + fi + + + + # Check to see if we have a functional realpath(3C). + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we have a functional realpath(3C)" >&5 +$as_echo_n "checking whether we have a functional realpath(3C)... " >&6; } + if ${libopts_cv_run_realpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test "$cross_compiling" = yes; then : + libopts_cv_run_realpath=no + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <limits.h> +#include <stdlib.h> +int main (int argc, char** argv) { +#ifndef PATH_MAX +choke me!! +#else + char zPath[PATH_MAX+1]; +#endif + char *pz = realpath(argv[0], zPath); + return (pz == zPath) ? 0 : 1; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + libopts_cv_run_realpath=yes +else + libopts_cv_run_realpath=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + # end of TRY_RUN + +fi + # end of AC_CACHE_VAL for libopts_cv_run_realpath + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${libopts_cv_run_realpath}" >&5 +$as_echo "${libopts_cv_run_realpath}" >&6; } + if test "X${libopts_cv_run_realpath}" != Xno + then + +$as_echo "#define HAVE_REALPATH 1" >>confdefs.h + + fi + + + + # Check to see if strftime() works. + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strftime() works" >&5 +$as_echo_n "checking whether strftime() works... " >&6; } + if ${libopts_cv_run_strftime+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test "$cross_compiling" = yes; then : + libopts_cv_run_strftime=no + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <time.h> +#include <string.h> +char t_buf[ 64 ]; +int main() { + static char const z[] = "Thursday Aug 28 240"; + struct tm tm; + tm.tm_sec = 36; /* seconds after the minute [0, 61] */ + tm.tm_min = 44; /* minutes after the hour [0, 59] */ + tm.tm_hour = 12; /* hour since midnight [0, 23] */ + tm.tm_mday = 28; /* day of the month [1, 31] */ + tm.tm_mon = 7; /* months since January [0, 11] */ + tm.tm_year = 86; /* years since 1900 */ + tm.tm_wday = 4; /* days since Sunday [0, 6] */ + tm.tm_yday = 239; /* days since January 1 [0, 365] */ + tm.tm_isdst = 1; /* flag for daylight savings time */ + strftime( t_buf, sizeof( t_buf ), "%A %b %d %j", &tm ); + return (strcmp( t_buf, z ) != 0); } +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + libopts_cv_run_strftime=yes +else + libopts_cv_run_strftime=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + # end of TRY_RUN + +fi + # end of AC_CACHE_VAL for libopts_cv_run_strftime + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${libopts_cv_run_strftime}" >&5 +$as_echo "${libopts_cv_run_strftime}" >&6; } + if test "X${libopts_cv_run_strftime}" != Xno + then + +$as_echo "#define HAVE_STRFTIME 1" >>confdefs.h + + fi + + + + # Check to see if fopen accepts "b" mode. + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fopen accepts \"b\" mode" >&5 +$as_echo_n "checking whether fopen accepts \"b\" mode... " >&6; } + if ${libopts_cv_run_fopen_binary+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test "$cross_compiling" = yes; then : + libopts_cv_run_fopen_binary=no + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdio.h> +int main (int argc, char** argv) { +FILE* fp = fopen("conftest.$ac_ext", "rb"); +return (fp == NULL) ? 1 : fclose(fp); } +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + libopts_cv_run_fopen_binary=yes +else + libopts_cv_run_fopen_binary=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + # end of TRY_RUN + +fi + # end of AC_CACHE_VAL for libopts_cv_run_fopen_binary + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${libopts_cv_run_fopen_binary}" >&5 +$as_echo "${libopts_cv_run_fopen_binary}" >&6; } + if test "X${libopts_cv_run_fopen_binary}" != Xno + then + +$as_echo "#define FOPEN_BINARY_FLAG \"b\"" >>confdefs.h + + else + +$as_echo "#define FOPEN_BINARY_FLAG \"\"" >>confdefs.h + + fi + + + + # Check to see if fopen accepts "t" mode. + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fopen accepts \"t\" mode" >&5 +$as_echo_n "checking whether fopen accepts \"t\" mode... " >&6; } + if ${libopts_cv_run_fopen_text+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test "$cross_compiling" = yes; then : + libopts_cv_run_fopen_text=no + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdio.h> +int main (int argc, char** argv) { +FILE* fp = fopen("conftest.$ac_ext", "rt"); +return (fp == NULL) ? 1 : fclose(fp); } +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + libopts_cv_run_fopen_text=yes +else + libopts_cv_run_fopen_text=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + # end of TRY_RUN + +fi + # end of AC_CACHE_VAL for libopts_cv_run_fopen_text + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${libopts_cv_run_fopen_text}" >&5 +$as_echo "${libopts_cv_run_fopen_text}" >&6; } + if test "X${libopts_cv_run_fopen_text}" != Xno + then + +$as_echo "#define FOPEN_TEXT_FLAG \"t\"" >>confdefs.h + + else + +$as_echo "#define FOPEN_TEXT_FLAG \"\"" >>confdefs.h + + fi + + + + # Check to see if not wanting optional option args. + + # Check whether --enable-optional-args was given. +if test "${enable_optional_args+set}" = set; then : + enableval=$enable_optional_args; libopts_cv_enable_optional_args=${enable_optional_args} +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether not wanting optional option args" >&5 +$as_echo_n "checking whether not wanting optional option args... " >&6; } +if ${libopts_cv_enable_optional_args+:} false; then : + $as_echo_n "(cached) " >&6 +else + libopts_cv_enable_optional_args=yes +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libopts_cv_enable_optional_args" >&5 +$as_echo "$libopts_cv_enable_optional_args" >&6; } + +fi + # end of AC_ARG_ENABLE + if test "X${libopts_cv_enable_optional_args}" = Xno + then + +$as_echo "#define NO_OPTIONAL_OPT_ARGS 1" >>confdefs.h + + fi + + + + + ac_config_files="$ac_config_files libopts/Makefile" + + +fi # end of AC_DEFUN of LIBOPTS_CHECK + + +case `pwd` in + *\ * | *\ *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac + + + +macro_version='2.4' +macro_revision='1.3293' + + + + + + + + + + + + + +ltmain="$ac_aux_dir/ltmain.sh" + +# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +$as_echo_n "checking how to print strings... " >&6; } +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "" +} + +case "$ECHO" in + printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +$as_echo "printf" >&6; } ;; + print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +$as_echo "print -r" >&6; } ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +$as_echo "cat" >&6; } ;; +esac + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + 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_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +$as_echo_n "checking for fgrep... " >&6; } +if ${ac_cv_path_FGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + if test -z "$FGREP"; then + ac_path_FGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in fgrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in +*GNU*) + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_FGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_FGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_FGREP"; then + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_FGREP=$FGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +$as_echo "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" + + +test -z "$GREP" && GREP=grep + + + + + + + + + + + + + + + + + + # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : @@ -4390,9 +6982,9 @@ $as_echo_n "checking for ld used by $CC... " >&6; } [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld - ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` + 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" ;; @@ -4412,7 +7004,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi -if test "${lt_cv_path_LD+set}" = set; then : +if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then @@ -4449,10 +7041,10 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi -test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5 +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if test "${lt_cv_prog_gnu_ld+set}" = set; then : +if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. @@ -4470,9 +7062,501 @@ $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if ${lt_cv_path_NM+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +$as_echo "$lt_cv_path_NM" >&6; } +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + if test -n "$ac_tool_prefix"; then + for ac_prog in dumpbin "link -dump" + 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DUMPBIN"; then + ac_cv_prog_DUMPBIN="$DUMPBIN" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DUMPBIN=$ac_cv_prog_DUMPBIN +if test -n "$DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +$as_echo "$DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$DUMPBIN" && break + done +fi +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in dumpbin "link -dump" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DUMPBIN"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN +if test -n "$ac_ct_DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +$as_echo "$ac_ct_DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_DUMPBIN" && break +done + + if test "x$ac_ct_DUMPBIN" = x; then + DUMPBIN=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DUMPBIN=$ac_ct_DUMPBIN + fi +fi + + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi + + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +$as_echo_n "checking the name lister ($NM) interface... " >&6; } +if ${lt_cv_nm_interface+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +$as_echo "$lt_cv_nm_interface" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } +fi + +# find the maximum length of command line arguments +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +$as_echo_n "checking the maximum length of command line arguments... " >&6; } +if ${lt_cv_sys_max_cmd_len+:} false; then : + $as_echo_n "(cached) " >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +$as_echo "$lt_cv_sys_max_cmd_len" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } +fi +max_cmd_len=$lt_cv_sys_max_cmd_len + + + + + + +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 +$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 +$as_echo "$xsi_shell" >&6; } + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 +$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } +lt_shell_append=no +( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 +$as_echo "$lt_shell_append" >&6; } + + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi + + + + + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +$as_echo_n "checking how to convert $build file names to $host format... " >&6; } +if ${lt_cv_to_host_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac + +fi + +to_host_file_cmd=$lt_cv_to_host_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +$as_echo "$lt_cv_to_host_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } +if ${lt_cv_to_tool_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + #assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac + +fi + +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +$as_echo "$lt_cv_to_tool_file_cmd" >&6; } + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } -if test "${lt_cv_ld_reload_flag+set}" = set; then : +if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' @@ -4486,75 +7570,133 @@ case $reload_flag in esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test "$GCC" != yes; then + reload_cmds=false + fi + ;; darwin*) if test "$GCC" = yes; then - reload_cmds='$CC -nostdlib ${wl}-r -o $output$reload_objs' + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD-compatible nm" >&5 -$as_echo_n "checking for BSD-compatible nm... " >&6; } -if test "${lt_cv_path_NM+set}" = set; then : + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/${ac_tool_prefix}nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - esac - fi +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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done done - IFS="$lt_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +IFS=$as_save_IFS + fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 -$as_echo "$lt_cv_path_NM" >&6; } -NM="$lt_cv_path_NM" +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 -$as_echo_n "checking whether ln -s works... " >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 -$as_echo "no, using $LN_S" >&6; } + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognise dependent libraries" >&5 -$as_echo_n "checking how to recognise dependent libraries... " >&6; } -if test "${lt_cv_deplibs_check_method+set}" = set; then : +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +$as_echo_n "checking how to recognize dependent libraries... " >&6; } +if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' @@ -4572,7 +7714,7 @@ lt_cv_deplibs_check_method='unknown' # whether `pass_all' will *always* work, you probably want this one. case $host_os in -aix4* | aix5*) +aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; @@ -4594,8 +7736,22 @@ cygwin*) mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump'. - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. + if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; @@ -4603,8 +7759,8 @@ darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; -freebsd* | kfreebsd*-gnu | dragonfly*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. @@ -4623,6 +7779,10 @@ gnu*) lt_cv_deplibs_check_method=pass_all ;; +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in @@ -4631,16 +7791,21 @@ hpux10.20* | hpux11*) lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; @@ -4652,12 +7817,12 @@ irix5* | irix6* | nonstopux*) ;; # This must be Linux ELF. -linux*) +linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' @@ -4670,12 +7835,12 @@ newos6*) lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; -nto-qnx*) - lt_cv_deplibs_check_method=unknown +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all ;; openbsd*) - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' @@ -4686,7 +7851,7 @@ osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; -sco3.2v5*) +rdos*) lt_cv_deplibs_check_method=pass_all ;; @@ -4694,7 +7859,11 @@ solaris*) lt_cv_deplibs_check_method=pass_all ;; -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' @@ -4715,10 +7884,13 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) siemens) lt_cv_deplibs_check_method=pass_all ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; esac ;; -sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7* | sysv4*uw2*) +tpf*) lt_cv_deplibs_check_method=pass_all ;; esac @@ -4726,6 +7898,21 @@ esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` + fi + ;; + esac +fi + file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown @@ -4733,327 +7920,286 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} -# Allow CC to be a program name with arguments. -compiler=$CC -# Check whether --enable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then : - enableval=$enable_libtool_lock; -fi -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '#line 4774 "configure"' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 -$as_echo_n "checking whether the C compiler needs -belf... " >&6; } -if test "${lt_cv_cc_needs_belf+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - 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 - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_cc_needs_belf=yes -else - lt_cv_cc_needs_belf=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext 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 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 -$as_echo "$lt_cv_cc_needs_belf" >&6; } - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -esac -need_locks="$enable_libtool_lock" -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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then : + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else - # 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 + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - # <limits.h> 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 confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } else - # Broken: fails on valid input. -continue + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi -rm -f conftest.err conftest.$ac_ext - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <ac_nonexistent.h> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue + +fi +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 else - # Passes both tests. -ac_preproc_ok=: -break + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } 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 + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" fi - done - ac_cv_prog_CPP=$CPP +test -z "$DLLTOOL" && DLLTOOL=dlltool -fi - CPP=$ac_cv_prog_CPP + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +$as_echo_n "checking how to associate runtime and link libraries... " >&6; } +if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : + $as_echo_n "(cached) " >&6 else - ac_cv_prog_CPP=$CPP + lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + + + + + + + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar + 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - # <limits.h> 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 confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } else - # Broken: fails on valid input. -continue + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi -rm -f conftest.err conftest.$ac_ext - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <ac_nonexistent.h> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 else - # Passes both tests. -ac_preproc_ok=: -break + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi -rm -f conftest.err conftest.$ac_ext + + test -n "$ac_ct_AR" && break 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 - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." "$LINENO" 5; } + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi 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 +: ${AR=ar} +: ${AR_FLAGS=cru} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + lt_cv_ar_at_file=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <float.h> int main () @@ -5064,237 +8210,320 @@ main () } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no + echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + fi rm -f core 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 confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <string.h> - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= else - ac_cv_header_stdc=no + archiver_list_spec=$lt_cv_ar_at_file fi -rm -f conftest* -fi -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <stdlib.h> -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : -else - ac_cv_header_stdc=no -fi -rm -f conftest* -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 : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <ctype.h> -#include <stdlib.h> -#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 -#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)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } else - ac_cv_header_stdc=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext + + 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" fi -# 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 : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +test -z "$STRIP" && STRIP=: -fi -done -for ac_header in dlfcn.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default" -if test "x$ac_cv_header_dlfcn_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_DLFCN_H 1 -_ACEOF -fi +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi done + done +IFS=$as_save_IFS +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! -# find the maximum length of command line arguments -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 -$as_echo_n "checking the maximum length of command line arguments... " >&6; } -if test "${lt_cv_sys_max_cmd_len+set}" = set; then : +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else - i=0 - teststring="ABCD" + 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; +test -z "$RANLIB" && RANLIB=: - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi + + + + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ - = "XX$teststring") >/dev/null 2>&1 && - new_result=`expr "X$teststring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - teststring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac - + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -if test -n $lt_cv_sys_max_cmd_len ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 -$as_echo "$lt_cv_sys_max_cmd_len" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -$as_echo "none" >&6; } -fi +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } -if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then : +if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else @@ -5307,33 +8536,18 @@ symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' -# Transform an extracted symbol line into a proper C declaration -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; -cygwin* | mingw* | pw32*) +cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; -hpux*) # Its linker distinguishes data from code symbols +hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -linux*) - if test "$host_cpu" = ia64; then - symcode='[ABCDGIRSTW]' - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' @@ -5341,52 +8555,90 @@ irix* | nonstopux*) osf*) symcode='[BCDEGQRST]' ;; -solaris* | sysv5*) +solaris*) symcode='[BDRT]' ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; sysv4) symcode='[DFNSTU]' ;; esac +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[ABCDGIRSTW]' ;; -esac - -# Try without a prefix undercore, then with it. +# Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK '"\ +" {last_section=section; section=\$ 3};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* - cat > conftest.$ac_ext <<EOF + cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; -void nm_test_func(){} +void nm_test_func(void); +void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} -EOF +_LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 @@ -5395,8 +8647,8 @@ EOF test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5 - (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then @@ -5408,46 +8660,60 @@ EOF fi # Make sure that we snagged all the symbols we need. - if grep ' nm_test_var$' "$nlist" >/dev/null; then - if grep ' nm_test_func$' "$nlist" >/dev/null; then - cat <<EOF > conftest.$ac_ext + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + #ifdef __cplusplus extern "C" { #endif -EOF +_LT_EOF # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - cat <<EOF >> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif + cat <<_LT_EOF >> conftest.$ac_ext -/* The mapping between symbol names and symbols. */ -const struct { +/* The mapping between symbol names and symbols. */ +LT_DLSYM_CONST struct { const char *name; - lt_ptr_t address; + void *address; } -lt_preloaded_symbols[] = +lt__PROGRAM__LTX_preloaded_symbols[] = { -EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr_t) 0} + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} }; +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + #ifdef __cplusplus } #endif -EOF +_LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 @@ -5457,8 +8723,8 @@ EOF test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi @@ -5472,7 +8738,7 @@ EOF echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi - rm -f conftest* conftst* + rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then @@ -5495,80 +8761,439 @@ else $as_echo "ok" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 -$as_echo_n "checking for objdir... " >&6; } -if test "${lt_cv_objdir+set}" = set; then : +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +$as_echo_n "checking for sysroot... " >&6; } + +# Check whether --with-sysroot was given. +if test "${with_sysroot+set}" = set; then : + withval=$with_sysroot; +else + with_sysroot=no +fi + + +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 +$as_echo "${with_sysroot}" >&6; } + as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 + ;; +esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +$as_echo "${lt_sysroot:-no}" >&6; } + + + + + +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then : + enableval=$enable_libtool_lock; +fi + +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +$as_echo_n "checking whether the C compiler needs -belf... " >&6; } +if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else - rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs + 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 + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_cc_needs_belf=yes else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs + lt_cv_cc_needs_belf=no fi -rmdir .libs 2>/dev/null +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext 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 + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 -$as_echo "$lt_cv_objdir" >&6; } -objdir=$lt_cv_objdir +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +$as_echo "$lt_cv_cc_needs_belf" >&6; } + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac +need_locks="$enable_libtool_lock" +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. +set dummy ${ac_tool_prefix}mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$MANIFEST_TOOL"; then + ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS +fi +fi +MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL +if test -n "$MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +$as_echo "$MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES +fi +if test -z "$ac_cv_prog_MANIFEST_TOOL"; then + ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL + # Extract the first word of "mt", so it can be a program name with args. +set dummy mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_MANIFEST_TOOL"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi - ;; +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL +if test -n "$ac_ct_MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_MANIFEST_TOOL" = x; then + MANIFEST_TOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; esac + MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL + fi +else + MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" +fi -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e 1s/^X//' -sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if ${lt_cv_path_mainfest_tool+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&5 + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +$as_echo "$lt_cv_path_mainfest_tool" >&6; } +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi -# Same as above, but do not quote variable references. -double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' -# Constants: -rm="rm -f" -# Global variables: -default_ofile=libtool -can_build_shared=yes -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" + case $host_os in + rhapsody* | darwin*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AR+set}" = set; then : +if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -5577,7 +9202,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AR="${ac_tool_prefix}ar" + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -5587,10 +9212,62 @@ IFS=$as_save_IFS fi fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +$as_echo "$ac_ct_DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DSYMUTIL=$ac_ct_DSYMUTIL + fi +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +$as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -5598,17 +9275,17 @@ fi fi -if test -z "$ac_cv_prog_AR"; then - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 +if test -z "$ac_cv_prog_NMEDIT"; then + ac_ct_NMEDIT=$NMEDIT + # Extract the first word of "nmedit", so it can be a program name with args. +set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_AR+set}" = set; then : +if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. + if test -n "$ac_ct_NMEDIT"; then + ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -5617,7 +9294,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_AR="ar" + ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -5627,17 +9304,17 @@ IFS=$as_save_IFS fi fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } +ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT +if test -n "$ac_ct_NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +$as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_ct_AR" = x; then - AR="false" + if test "x$ac_ct_NMEDIT" = x; then + NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) @@ -5645,22 +9322,22 @@ yes:) $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - AR=$ac_ct_AR + NMEDIT=$ac_ct_NMEDIT fi else - AR="$ac_cv_prog_AR" + NMEDIT="$ac_cv_prog_NMEDIT" fi -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 + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. +set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_RANLIB+set}" = set; then : +if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. + if test -n "$LIPO"; then + ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -5669,7 +9346,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -5679,10 +9356,10 @@ IFS=$as_save_IFS fi fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } +LIPO=$ac_cv_prog_LIPO +if test -n "$LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +$as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -5690,17 +9367,17 @@ 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 +if test -z "$ac_cv_prog_LIPO"; then + ac_ct_LIPO=$LIPO + # Extract the first word of "lipo", so it can be a program name with args. +set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : +if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. + if test -n "$ac_ct_LIPO"; then + ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -5709,7 +9386,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_RANLIB="ranlib" + ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -5719,17 +9396,17 @@ IFS=$as_save_IFS fi fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } +ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO +if test -n "$ac_ct_LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +$as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" + if test "x$ac_ct_LIPO" = x; then + LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) @@ -5737,22 +9414,22 @@ yes:) $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - RANLIB=$ac_ct_RANLIB + LIPO=$ac_ct_LIPO fi else - RANLIB="$ac_cv_prog_RANLIB" + LIPO="$ac_cv_prog_LIPO" fi -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 + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then : +if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. + if test -n "$OTOOL"; then + ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -5761,7 +9438,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" + ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -5771,10 +9448,10 @@ IFS=$as_save_IFS fi fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } +OTOOL=$ac_cv_prog_OTOOL +if test -n "$OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +$as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -5782,17 +9459,17 @@ 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 +if test -z "$ac_cv_prog_OTOOL"; then + ac_ct_OTOOL=$OTOOL + # Extract the first word of "otool", so it can be a program name with args. +set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : +if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. + if test -n "$ac_ct_OTOOL"; then + ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -5801,7 +9478,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_STRIP="strip" + ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -5811,17 +9488,17 @@ IFS=$as_save_IFS fi fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } +ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL +if test -n "$ac_ct_OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +$as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_ct_STRIP" = x; then - STRIP=":" + if test "x$ac_ct_OTOOL" = x; then + OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) @@ -5829,50 +9506,479 @@ yes:) $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - STRIP=$ac_ct_STRIP + OTOOL=$ac_ct_OTOOL fi else - STRIP="$ac_cv_prog_STRIP" + OTOOL="$ac_cv_prog_OTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL64"; then + ac_cv_prog_OTOOL64="$OTOOL64" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL64=$ac_cv_prog_OTOOL64 +if test -n "$OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +$as_echo "$OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL64"; then + ac_ct_OTOOL64=$OTOOL64 + # Extract the first word of "otool64", so it can be a program name with args. +set dummy otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL64"; then + ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OTOOL64="otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 +if test -n "$ac_ct_OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +$as_echo "$ac_ct_OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL64" = x; then + OTOOL64=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL64=$ac_ct_OTOOL64 + fi +else + OTOOL64="$ac_cv_prog_OTOOL64" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +$as_echo_n "checking for -single_module linker flag... " >&6; } +if ${lt_cv_apple_cc_single_mod+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&5 + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +$as_echo "$lt_cv_apple_cc_single_mod" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } +if ${lt_cv_ld_exported_symbols_list+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_ld_exported_symbols_list=yes +else + lt_cv_ld_exported_symbols_list=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +$as_echo_n "checking for -force_load linker flag... " >&6; } +if ${lt_cv_ld_force_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 + echo "$AR cru libconftest.a conftest.o" >&5 + $AR cru libconftest.a conftest.o 2>&5 + echo "$RANLIB libconftest.a" >&5 + $RANLIB libconftest.a 2>&5 + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&5 + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +$as_echo "$lt_cv_ld_force_load" >&6; } + case $host_os in + rhapsody* | darwin1.[012]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[012]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac + +for ac_header in dlfcn.h +do : + ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +" +if test "x$ac_cv_header_dlfcn_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DLFCN_H 1 +_ACEOF + +fi + +done + + + + + +# Set options + + + + enable_dlopen=no + + + enable_win32_dll=no + + + + # Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=yes +fi + + + + + + + + + + +# Check whether --with-pic was given. +if test "${with_pic+set}" = set; then : + withval=$with_pic; pic_mode="$withval" +else + pic_mode=default fi +test -z "$pic_mode" && pic_mode=default + + + + + + + + # Check whether --enable-fast-install was given. +if test "${enable_fast_install+set}" = set; then : + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=yes +fi + + + + + + + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + + + + + + + + + + + + + + + + + + + + + + + + + + +test -z "$LN_S" && LN_S="ln -s" + + + + + + + + + + + + + + +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +$as_echo_n "checking for objdir... " >&6; } +if ${lt_cv_objdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +$as_echo "$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +cat >>confdefs.h <<_ACEOF +#define LT_OBJDIR "$lt_cv_objdir/" +_ACEOF + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC -test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$SED" && SED=sed -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" - ;; - *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; @@ -5881,16 +9987,17 @@ for cc_temp in $compiler""; do *) break;; esac done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } -if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : +if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in @@ -5915,7 +10022,7 @@ else $EGREP "$file_magic_regex" > /dev/null; then : else - cat <<EOF 1>&2 + cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. @@ -5926,7 +10033,7 @@ else *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org -EOF +_LT_EOF fi ;; esac fi @@ -5948,11 +10055,15 @@ else $as_echo "no" >&6; } fi + + + + if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } -if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : +if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in @@ -5977,7 +10088,7 @@ else $EGREP "$file_magic_regex" > /dev/null; then : else - cat <<EOF 1>&2 + cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. @@ -5988,7 +10099,7 @@ else *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org -EOF +_LT_EOF fi ;; esac fi @@ -6010,6 +10121,7 @@ else $as_echo "no" >&6; } fi + else MAGIC_CMD=: fi @@ -6019,28 +10131,8 @@ fi ;; esac -enable_dlopen=no -enable_win32_dll=no - -# Check whether --enable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then : - enableval=$enable_libtool_lock; -fi - -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - - -# Check whether --with-pic was given. -if test "${with_pic+set}" = set; then : - withval=$with_pic; pic_mode="$withval" -else - pic_mode=default -fi - -test -z "$pic_mode" && pic_mode=default - # Use C for the default configuration in the libtool script -tagname= + lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -6057,113 +10149,68 @@ objext=o objext=$objext # Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" +lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' +lt_simple_link_test_code='int main(){return(0);}' + + + + + # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + # Allow CC to be a program name with arguments. compiler=$CC +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* +$RM conftest* ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - -# -# Check for any special shared library compilation flags. -# -lt_prog_cc_shlib= -if test "$GCC" = no; then - case $host_os in - sco3.2v5*) - lt_prog_cc_shlib='-belf' - ;; - esac -fi -if test -n "$lt_prog_cc_shlib"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&5 -$as_echo "$as_me: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&2;} - if echo "$old_CC $old_CFLAGS " | grep "[ ]$lt_prog_cc_shlib[ ]" >/dev/null; then : - else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 -$as_echo "$as_me: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} - lt_cv_prog_cc_can_build_shared=no - fi -fi - - -# -# Check to make sure the static flag actually works. -# -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_prog_compiler_static works" >&5 -$as_echo_n "checking if $compiler static flag $lt_prog_compiler_static works... " >&6; } -if test "${lt_prog_compiler_static_works+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - lt_prog_compiler_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_prog_compiler_static" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_static_works=yes - fi - else - lt_prog_compiler_static_works=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_static_works" >&5 -$as_echo "$lt_prog_compiler_static_works" >&6; } - -if test x"$lt_prog_compiler_static_works" = xyes; then - : -else - lt_prog_compiler_static= -fi - +$RM -r conftest* +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag=' -fno-builtin' - + case $cc_basename in + nvcc*) + lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; + *) + lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; + esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then : +if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. @@ -6174,21 +10221,21 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6177: $lt_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6181: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi - $rm conftest* + $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 @@ -6202,12 +10249,15 @@ fi fi -lt_prog_compiler_wl= + + + + + + lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' @@ -6223,19 +10273,29 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } ;; amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + esac ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; - mingw* | pw32* | os2*) + mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; @@ -6245,6 +10305,31 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_pic='-fno-common' ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. @@ -6252,29 +10337,29 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } enable_shared=no ;; + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - ;; - *) lt_prog_compiler_pic='-fPIC' ;; esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + lt_prog_compiler_wl='-Xlinker ' + lt_prog_compiler_pic='-Xcompiler -fPIC' + ;; + esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in @@ -6287,18 +10372,8 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case $cc_basename in - xlc*) - lt_prog_compiler_pic='-qnocommon' - lt_prog_compiler_wl='-Wl,' - ;; - esac - ;; - mingw* | pw32* | os2*) + mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' @@ -6326,19 +10401,34 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_static='-non_shared' ;; - newsos6) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - linux*) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in - icc* | ecc*) + # old Intel for x86_64 which still supported -KPIC. + ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; - pgcc* | pgf77* | pgf90* | pgf95*) + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='--shared' + lt_prog_compiler_static='--static' + ;; + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' @@ -6350,25 +10440,57 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ F* | *Sun*Fortran*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + esac + ;; esac ;; + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; - sco3.2v5*) - lt_prog_compiler_pic='-Kpic' - lt_prog_compiler_static='-dn' + rdos*) + lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in - f77* | f90* | f95*) + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; @@ -6381,7 +10503,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_static='-Bstatic' ;; - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' @@ -6394,6 +10516,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } fi ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no @@ -6410,22 +10538,39 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5 -$as_echo "$lt_prog_compiler_pic" >&6; } +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic=$lt_prog_compiler_pic +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +$as_echo "$lt_cv_prog_compiler_pic" >&6; } +lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } -if test "${lt_prog_compiler_pic_works+set}" = set; then : +if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else - lt_prog_compiler_pic_works=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. @@ -6436,27 +10581,27 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6439: $lt_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6443: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_pic_works=yes + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes fi fi - $rm conftest* + $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_works" >&5 -$as_echo "$lt_prog_compiler_pic_works" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } -if test x"$lt_prog_compiler_pic_works" = xyes; then +if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; @@ -6467,27 +10612,130 @@ else fi fi -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic= - ;; - *) - lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 + + + + + + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if ${lt_cv_prog_compiler_static_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +$as_echo "$lt_cv_prog_compiler_static_works" >&6; } + +if test x"$lt_cv_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if test "${lt_cv_prog_compiler_c_o+set}" = set; then : +if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no - $rm -r conftest 2>/dev/null + $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or @@ -6498,43 +10746,45 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6501: $lt_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6505: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 - $rm conftest* + $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out cd .. - rmdir conftest - $rm conftest* + $RM -r conftest + $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes - $rm conftest* + $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no @@ -6550,31 +10800,39 @@ else need_locks=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= - enable_shared_with_static_runtimes=no + always_export_symbols=no archive_cmds= archive_expsym_cmds= - old_archive_From_new_cmds= - old_archive_from_expsyms_cmds= + compiler_needs_object=no + enable_shared_with_static_runtimes=no export_dynamic_flag_spec= - whole_archive_flag_spec= - thread_safe_flag_spec= + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + hardcode_automatic=no + hardcode_direct=no + hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld= hardcode_libdir_separator= - hardcode_direct=no hardcode_minus_L=no hardcode_shlibpath_var=unsupported + inherit_rpath=no link_all_deplibs=unknown - hardcode_automatic=no module_cmds= module_expsym_cmds= - always_export_symbols=no - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + old_archive_from_new_cmds= + old_archive_from_expsyms_cmds= + thread_safe_flag_spec= + whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= @@ -6582,26 +10840,17 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. - exclude_expsyms="_GLOBAL_OFFSET_TABLE_" + exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in - cygwin* | mingw* | pw32*) + cygwin* | mingw* | pw32* | cegcc*) # 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++. @@ -6609,13 +10858,43 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` with_gnu_ld=no fi ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; + *\ \(GNU\ Binutils\)\ [3-9]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' @@ -6623,16 +10902,17 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= fi supports_anon_versioning=no - case `$LD -v 2>/dev/null` in + case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... @@ -6642,38 +10922,40 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # See if GNU ld supports shared libraries. case $host_os in - aix3* | aix4* | aix5*) + aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no - cat <<EOF 1>&2 + cat <<_LT_EOF 1>&2 -*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. -EOF +_LT_EOF fi ;; amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - - # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs=no + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac ;; beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach <jrb3@best.com> says some releases of gcc # support --undefined. This deserves some investigation. FIXME @@ -6683,17 +10965,19 @@ EOF fi ;; - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' + export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then @@ -6702,57 +10986,121 @@ EOF echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= + haiku*) + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + link_all_deplibs=yes + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; - pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + whole_archive_flag_spec= + tmp_sharedflag='--shared' ;; + xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + ;; esac - archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - if test $supports_anon_versioning = yes; then - archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld='-rpath $libdir' + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac else - ld_shlibs=no + ld_shlibs=no fi ;; netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no - cat <<EOF 1>&2 + cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool @@ -6761,15 +11109,46 @@ EOF *** your PATH or compiler configuration so that the native linker is *** used, and then restart. -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= @@ -6778,9 +11157,9 @@ EOF ;; *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi @@ -6803,14 +11182,14 @@ EOF # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; - aix4* | aix5*) + aix[4-9]*) 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. @@ -6820,23 +11199,26 @@ EOF else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else - export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi 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*) + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi done + ;; esac exp_sym_flag='-bexport' @@ -6851,29 +11233,32 @@ EOF archive_cmds='' hardcode_direct=yes + hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes + file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null then - # We have reworked collect2 - hardcode_direct=yes + # We have reworked collect2 + : else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= fi + ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then @@ -6882,18 +11267,19 @@ EOF else # not using gcc if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else - if test "$aix_use_runtimelinking" = yes; then + if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' - fi + fi fi fi + export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes @@ -6901,8 +11287,15 @@ EOF # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -6915,26 +11308,47 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else - # Determine the default libpath from the value encoded in an empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -6947,113 +11361,161 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec=' ' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + fi archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; - cygwin* | mingw* | pw32*) + cygwin* | mingw* | pw32* | cegcc*) # 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=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes=yes + case $cc_basename in + cl*) + # Native MSVC + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + always_export_symbols=yes + file_list_spec='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, )='true' + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + old_postinstall_cmds='chmod 644 $oldlib' + postlink_cmds='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + enable_shared_with_static_runtimes=yes + ;; + esac ;; darwin* | rhapsody*) - case $host_os in - rhapsody* | darwin1.[012]) - allow_undefined_flag='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc=no - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - whole_archive_flag_spec='' - link_all_deplibs=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case $cc_basename in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs=no - ;; - esac - fi + + + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + if test "$lt_cv_ld_force_load" = "yes"; then + whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + else + whole_archive_flag_spec='' + fi + link_all_deplibs=yes + allow_undefined_flag="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=func_echo_all + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + + else + ld_shlibs=no + fi + ;; dgux*) @@ -7086,8 +11548,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu | dragonfly*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + freebsd* | dragonfly*) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no @@ -7095,9 +11557,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux9*) if test "$GCC" = yes; then - archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else - archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: @@ -7109,48 +11571,102 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi export_dynamic_flag_spec='${wl}-E' ;; - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then + hpux10*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld='+b $libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in - hppa*64*|ia64*) + hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; + ia64*) + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; *) - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in - hppa*64*|ia64*) - archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + hppa*64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +$as_echo_n "checking if $CC understands -b... " >&6; } +if ${lt_cv_prog_compiler__b+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler__b=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -b" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler__b=yes + fi + else + lt_cv_prog_compiler__b=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +$as_echo "$lt_cv_prog_compiler__b" >&6; } + +if test x"$lt_cv_prog_compiler__b" = xyes; then + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' +else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' +fi + ;; esac fi if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + case $host_cpu in - hppa*64*) - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld='+b $libdir' - hardcode_libdir_separator=: - hardcode_direct=no - hardcode_shlibpath_var=no - ;; - ia64*) - hardcode_libdir_flag_spec='-L$libdir' + hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=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_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, @@ -7163,18 +11679,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if ${lt_cv_irix_exported_symbol+:} false; then : + $as_echo_n "(cached) " >&6 +else + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo (void) { return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_irix_exported_symbol=yes +else + lt_cv_irix_exported_symbol=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +$as_echo "$lt_cv_irix_exported_symbol" >&6; } + if test "$lt_cv_irix_exported_symbol" = yes; then + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi else - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld='-rpath $libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi + archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: + inherit_rpath=yes link_all_deplibs=yes ;; netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF @@ -7192,25 +11739,33 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var=no ;; + *nto* | *qnx*) + ;; + openbsd*) - hardcode_direct=yes - hardcode_shlibpath_var=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac + ld_shlibs=no fi ;; @@ -7218,18 +11773,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi + archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; @@ -7237,57 +11793,59 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi + archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; - sco3.2v5*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - solaris*) - no_undefined_flag=' -z text' + no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else - wlarc='' - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; esac link_all_deplibs=yes ;; @@ -7344,36 +11902,45 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi fi ;; - sysv4.2uw2*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=no + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='${wl}-z,text' + archive_cmds_need_lc=no hardcode_shlibpath_var=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; + runpath_var='LD_RUN_PATH' - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - no_undefined_flag='${wl}-z ${wl}text' if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else - archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no ;; - sysv5*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec= + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='${wl}-z,text' + allow_undefined_flag='${wl}-z,nodefs' + archive_cmds_need_lc=no hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-R,$libdir' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi ;; uts4*) @@ -7386,16 +11953,35 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ld_shlibs=no ;; esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + export_dynamic_flag_spec='${wl}-Blargedynsym' + ;; + esac + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi +with_gnu_ld=$with_gnu_ld + + + + + + + + + + + + + + # # Do we need to explicitly link libc? @@ -7416,3124 +12002,279 @@ x|xyes) # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } - $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext +if ${lt_cv_archive_cmds_need_lc+:} false; then : + $as_echo_n "(cached) " >&6 +else + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\""; } >&5 - (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } - then - archive_cmds_need_lc=no - else - archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5 -$as_echo "$archive_cmds_need_lc" >&6; } - ;; - esac - fi - ;; -esac + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib<name>.so - # instead of lib<name>.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[123]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } + archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var" || \ - test "X$hardcode_automatic" = "Xyes" ; then - # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 -$as_echo "$hardcode_action" >&6; } -if test "$hardcode_action" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi -striplib= -old_striplib= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 -$as_echo_n "checking whether stripping libraries is possible... " >&6; } -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - esac -fi -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - darwin*) - # if libdl is installed we need to link against it - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes -fi - ;; - *) - ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = x""yes; then : - lt_cv_dlopen="shl_load" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 -$as_echo_n "checking for shl_load in -ldld... " >&6; } -if test "${ac_cv_lib_dld_shl_load+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char shl_load (); -int -main () -{ -return shl_load (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_shl_load=yes -else - ac_cv_lib_dld_shl_load=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 -$as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = x""yes; then : - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" -else - ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = x""yes; then : - lt_cv_dlopen="dlopen" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 -$as_echo_n "checking for dlopen in -lsvld... " >&6; } -if test "${ac_cv_lib_svld_dlopen+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_svld_dlopen=yes -else - ac_cv_lib_svld_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 -$as_echo "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = x""yes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 -$as_echo_n "checking for dld_link in -ldld... " >&6; } -if test "${ac_cv_lib_dld_dld_link+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dld_link (); -int -main () -{ -return dld_link (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_dld_link=yes -else - ac_cv_lib_dld_dld_link=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 -$as_echo "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = x""yes; then : - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" -fi -fi -fi -fi -fi -fi - ;; - esac - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 -$as_echo_n "checking whether a program can dlopen itself... " >&6; } -if test "${lt_cv_dlopen_self+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<EOF -#line 8373 "configure" -#include "confdefs.h" -#if HAVE_DLFCN_H -#include <dlfcn.h> -#endif -#include <stdio.h> -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif -#ifdef __cplusplus -extern "C" void exit (int); -#endif -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - exit (status); -} -EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 -$as_echo "$lt_cv_dlopen_self" >&6; } - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 -$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } -if test "${lt_cv_dlopen_self_static+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<EOF -#line 8471 "configure" -#include "confdefs.h" -#if HAVE_DLFCN_H -#include <dlfcn.h> -#endif -#include <stdio.h> -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif -#ifdef __cplusplus -extern "C" void exit (int); -#endif -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - exit (status); -} -EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 -$as_echo "$lt_cv_dlopen_self_static" >&6; } - fi - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi -# Report which librarie types wil actually be built -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 -$as_echo_n "checking if libtool supports shared libraries... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 -$as_echo "$can_build_shared" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 -$as_echo_n "checking whether to build shared libraries... " >&6; } -test "$can_build_shared" = "no" && enable_shared=no -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case $host_os in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; -aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 -$as_echo "$enable_shared" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 -$as_echo_n "checking whether to build static libraries... " >&6; } -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 -$as_echo "$enable_static" >&6; } -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler \ - CC \ - LD \ - lt_prog_compiler_wl \ - lt_prog_compiler_pic \ - lt_prog_compiler_static \ - lt_prog_compiler_no_builtin_flag \ - export_dynamic_flag_spec \ - thread_safe_flag_spec \ - whole_archive_flag_spec \ - enable_shared_with_static_runtimes \ - old_archive_cmds \ - old_archive_from_new_cmds \ - predep_objects \ - postdep_objects \ - predeps \ - postdeps \ - compiler_lib_search_path \ - archive_cmds \ - archive_expsym_cmds \ - postinstall_cmds \ - postuninstall_cmds \ - old_archive_from_expsyms_cmds \ - allow_undefined_flag \ - no_undefined_flag \ - export_symbols_cmds \ - hardcode_libdir_flag_spec \ - hardcode_libdir_flag_spec_ld \ - hardcode_libdir_separator \ - hardcode_automatic \ - module_cmds \ - module_expsym_cmds \ - lt_cv_prog_compiler_c_o \ - exclude_expsyms \ - include_expsyms; do - - case $var in - old_archive_cmds | \ - old_archive_from_new_cmds | \ - archive_cmds | \ - archive_expsym_cmds | \ - module_cmds | \ - module_expsym_cmds | \ - old_archive_from_expsyms_cmds | \ - export_symbols_cmds | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac -cfgfile="${ofile}T" - trap "$rm \"$cfgfile\"; exit 1" 1 2 15 - $rm -f "$cfgfile" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ofile" >&5 -$as_echo "$as_me: creating $ofile" >&6;} - cat <<__EOF__ >> "$cfgfile" -#! $SHELL -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# -# This file is part of GNU Libtool: -# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. -# A sed program that does not truncate output. -SED=$lt_SED -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e 1s/^X//" -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH -# The names of the tagged configurations supported by this script. -available_tags= -# ### BEGIN LIBTOOL CONFIG -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared -# Whether or not to build static libraries. -build_old_libs=$enable_static -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os -# An echo program that does not interpret backslashes. -echo=$lt_echo -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS -# A C compiler. -LTCC=$lt_LTCC -# A language-specific compiler. -CC=$lt_compiler -# Is the compiler the GNU C compiler? -with_gcc=$GCC -# An ERE matcher. -EGREP=$lt_EGREP -# The linker used to build libraries. -LD=$lt_LD -# Whether we need hard or soft links. -LN_S=$lt_LN_S -# A BSD-compatible nm program. -NM=$lt_NM -# A symbol stripping program -STRIP=$lt_STRIP -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" -# Used on cygwin: assembler. -AS="$AS" -# The name of the directory that contains temporary libtool files. -objdir=$objdir -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl -# Object file suffix (normally "o"). -objext="$ac_objext" -# Old archive suffix (normally "a"). -libext="$libext" -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' -# Executable file suffix (normally ""). -exeext="$exeext" -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic -pic_mode=$pic_mode -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o -# Must we lock files when doing compilation? -need_locks=$lt_need_locks -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix -# Do we need a version for libraries? -need_version=$need_version -# Whether dlopen is supported. -dlopen_support=$enable_dlopen -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec -# Library versioning type. -version_type=$version_type -# Format of library name prefix. -libname_spec=$lt_libname_spec -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds -archive_expsym_cmds=$lt_archive_expsym_cmds -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds -module_expsym_cmds=$lt_module_expsym_cmds -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address -# This is the shared library runtime path variable. -runpath_var=$runpath_var -# This is the shared library path variable. -shlibpath_var=$shlibpath_var -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms - -# ### END LIBTOOL CONFIG - -__EOF__ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } +if test "$GCC" = yes; then case $host_os in - aix3*) - cat <<\EOF >> "$cfgfile" - -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -EOF - ;; + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; esac - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || \ - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC="$lt_save_CC" - - -# Check whether --with-tags was given. -if test "${with_tags+set}" = set; then : - withval=$with_tags; tagnames="$withval" -fi - - -if test -f "$ltmain" && test -n "$tagnames"; then - if test ! -f "${ofile}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: output file \`$ofile' does not exist" >&5 -$as_echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} - fi - - if test -z "$LTCC"; then - eval "`$SHELL ${ofile} --config | grep '^LTCC='`" - if test -z "$LTCC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: output file \`$ofile' does not look like a libtool script" >&5 -$as_echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} - else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 -$as_echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} - fi - fi - - # Extract list of available tagged configurations in $ofile. - # Note that this assumes the entire list is on one line. - available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` - - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for tagname in $tagnames; do - IFS="$lt_save_ifs" - # Check whether tagname contains only valid characters - case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in - "") ;; - *) as_fn_error "invalid tag name: $tagname" "$LINENO" 5 - ;; - esac - - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null - then - as_fn_error "tag name \"$tagname\" already exists" "$LINENO" 5 - fi - - # Update the list of available tags. - if test -n "$tagname"; then - echo appending configuration tag \"$tagname\" to $ofile - - case $tagname in - CXX) - if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - : - else - tagname="" - fi - ;; - - F77) - if test -n "$F77" && test "X$F77" != "Xno"; then - : - else - tagname="" - fi - ;; - - GCJ) - if test -n "$GCJ" && test "X$GCJ" != "Xno"; then - - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -objext_GCJ=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${GCJ-"gcj"} -compiler=$CC -compiler_GCJ=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -archive_cmds_need_lc_GCJ=no - -old_archive_cmds_GCJ=$old_archive_cmds - - -lt_prog_compiler_no_builtin_flag_GCJ= - -if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9250: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:9254: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $rm conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" -else - : -fi - -fi - -lt_prog_compiler_wl_GCJ= -lt_prog_compiler_pic_GCJ= -lt_prog_compiler_static_GCJ= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } - - if test "$GCC" = yes; then - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_static_GCJ='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_GCJ='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_GCJ='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared_GCJ=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_GCJ=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_GCJ='-fPIC' - ;; - esac - ;; - - *) - lt_prog_compiler_pic_GCJ='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl_GCJ='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_GCJ='-Bstatic' - else - lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' - fi - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case $cc_basename in - xlc*) - lt_prog_compiler_pic_GCJ='-qnocommon' - lt_prog_compiler_wl_GCJ='-Wl,' - ;; - esac - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl_GCJ='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_GCJ='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl_GCJ='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - - newsos6) - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - linux*) - case $cc_basename in - icc* | ecc*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-static' - ;; - pgcc* | pgf77* | pgf90* | pgf95*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-fpic' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - ccc*) - lt_prog_compiler_wl_GCJ='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl_GCJ='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - - sco3.2v5*) - lt_prog_compiler_pic_GCJ='-Kpic' - lt_prog_compiler_static_GCJ='-dn' - ;; - - solaris*) - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl_GCJ='-Qoption ld ';; - *) - lt_prog_compiler_wl_GCJ='-Wl,';; - esac - ;; - - sunos4*) - lt_prog_compiler_wl_GCJ='-Qoption ld ' - lt_prog_compiler_pic_GCJ='-PIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic_GCJ='-Kconform_pic' - lt_prog_compiler_static_GCJ='-Bstatic' - fi - ;; - - unicos*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_can_build_shared_GCJ=no - ;; - - uts4*) - lt_prog_compiler_pic_GCJ='-pic' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared_GCJ=no - ;; - esac - fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_GCJ" >&5 -$as_echo "$lt_prog_compiler_pic_GCJ" >&6; } - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_GCJ"; then - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... " >&6; } -if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - lt_prog_compiler_pic_works_GCJ=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_GCJ" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9512: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:9516: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_pic_works_GCJ=yes - fi - fi - $rm conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_works_GCJ" >&5 -$as_echo "$lt_prog_compiler_pic_works_GCJ" >&6; } - -if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then - case $lt_prog_compiler_pic_GCJ in - "" | " "*) ;; - *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; - esac -else - lt_prog_compiler_pic_GCJ= - lt_prog_compiler_can_build_shared_GCJ=no -fi - -fi -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_GCJ= + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) - lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; -esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o_GCJ=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9574: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:9578: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o_GCJ=yes - fi - fi - chmod u+w . 2>&5 - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 -$as_echo "$lt_cv_prog_compiler_c_o_GCJ" >&6; } - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } - if test "$hard_links" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - - runpath_var= - allow_undefined_flag_GCJ= - enable_shared_with_static_runtimes_GCJ=no - archive_cmds_GCJ= - archive_expsym_cmds_GCJ= - old_archive_From_new_cmds_GCJ= - old_archive_from_expsyms_cmds_GCJ= - export_dynamic_flag_spec_GCJ= - whole_archive_flag_spec_GCJ= - thread_safe_flag_spec_GCJ= - hardcode_libdir_flag_spec_GCJ= - hardcode_libdir_flag_spec_ld_GCJ= - hardcode_libdir_separator_GCJ= - hardcode_direct_GCJ=no - hardcode_minus_L_GCJ=no - hardcode_shlibpath_var_GCJ=unsupported - link_all_deplibs_GCJ=unknown - hardcode_automatic_GCJ=no - module_cmds_GCJ= - module_expsym_cmds_GCJ= - always_export_symbols_GCJ=no - export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms_GCJ= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - - 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_GCJ=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_GCJ= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs_GCJ=no - cat <<EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - - # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs_GCJ=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_GCJ=unsupported - # Joseph Beckenbach <jrb3@best.com> says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_GCJ='-L$libdir' - allow_undefined_flag_GCJ=unsupported - always_export_symbols_GCJ=no - enable_shared_with_static_runtimes_GCJ=yes - export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs_GCJ=no - fi - ;; - - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers - whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - ld_shlibs_GCJ=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs_GCJ=no - cat <<EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - - sunos4*) - archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - esac - - if test "$ld_shlibs_GCJ" = no; then - runpath_var= - hardcode_libdir_flag_spec_GCJ= - export_dynamic_flag_spec_GCJ= - whole_archive_flag_spec_GCJ= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag_GCJ=unsupported - always_export_symbols_GCJ=yes - archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L_GCJ=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct_GCJ=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - 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 - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_GCJ='' - hardcode_direct_GCJ=yes - hardcode_libdir_separator_GCJ=':' - link_all_deplibs_GCJ=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct_GCJ=yes - else - # We have old collect2 - hardcode_direct_GCJ=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_GCJ=yes - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_libdir_separator_GCJ= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_GCJ=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_GCJ='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_GCJ="-z nodefs" - archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_GCJ=' ${wl}-bernotok' - allow_undefined_flag_GCJ=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols_GCJ=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_GCJ=' ' - archive_cmds_need_lc_GCJ=yes - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - # see comment about different semantics on the GNU ld section - ld_shlibs_GCJ=no - ;; - - bsdi[45]*) - export_dynamic_flag_spec_GCJ=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec_GCJ=' ' - allow_undefined_flag_GCJ=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds_GCJ='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes_GCJ=yes - ;; - - darwin* | rhapsody*) - case $host_os in - rhapsody* | darwin1.[012]) - allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc_GCJ=no - hardcode_direct_GCJ=no - hardcode_automatic_GCJ=yes - hardcode_shlibpath_var_GCJ=unsupported - whole_archive_flag_spec_GCJ='' - link_all_deplibs_GCJ=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else - case $cc_basename in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs_GCJ=no - ;; - esac + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi - ;; - - dgux*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_shlibpath_var_GCJ=no - ;; - - freebsd1*) - ld_shlibs_GCJ=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu | dragonfly*) - archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_direct_GCJ=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - export_dynamic_flag_spec_GCJ='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*|ia64*) - archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*|ia64*) - archive_cmds_GCJ='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' - hardcode_libdir_separator_GCJ=: - hardcode_direct_GCJ=no - hardcode_shlibpath_var_GCJ=no - ;; - ia64*) - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_direct_GCJ=no - hardcode_shlibpath_var_GCJ=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - ;; - *) - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_direct_GCJ=yes - export_dynamic_flag_spec_GCJ='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' - fi - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - link_all_deplibs_GCJ=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - newsos6) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_shlibpath_var_GCJ=no - ;; - - openbsd*) - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' - export_dynamic_flag_spec_GCJ='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - ;; - *) - archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - allow_undefined_flag_GCJ=unsupported - archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag_GCJ=' -expect_unresolved \*' - archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag_GCJ=' -expect_unresolved \*' - archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec_GCJ='-rpath $libdir' - fi - hardcode_libdir_separator_GCJ=: - ;; - - sco3.2v5*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - export_dynamic_flag_spec_GCJ='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - no_undefined_flag_GCJ=' -z text' - if test "$GCC" = yes; then - wlarc='${wl}' - archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - wlarc='' - archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_shlibpath_var_GCJ=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; - esac - link_all_deplibs_GCJ=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds_GCJ='$CC -r -o $output$reload_objs' - hardcode_direct_GCJ=no - ;; - motorola) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_GCJ=no - ;; - - sysv4.3*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - export_dynamic_flag_spec_GCJ='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs_GCJ=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=no - hardcode_shlibpath_var_GCJ=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - no_undefined_flag_GCJ='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GCJ='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_GCJ=no - ;; - - sysv5*) - no_undefined_flag_GCJ=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec_GCJ= - hardcode_shlibpath_var_GCJ=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_shlibpath_var_GCJ=no - ;; - - *) - ld_shlibs_GCJ=no - ;; - esac - fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_GCJ" >&5 -$as_echo "$ld_shlibs_GCJ" >&6; } -test "$ld_shlibs_GCJ" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([A-Za-z]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_GCJ" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_GCJ=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_GCJ in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } - $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_GCJ - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ - allow_undefined_flag_GCJ= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\""; } >&5 - (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - then - archive_cmds_need_lc_GCJ=no - else - archive_cmds_need_lc_GCJ=yes - fi - allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc_GCJ" >&5 -$as_echo "$archive_cmds_need_lc_GCJ" >&6; } - ;; - esac - fi - ;; -esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } library_names_spec= libname_spec='lib$name' soname_spec= @@ -10547,20 +12288,6 @@ shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi need_lib_prefix=unknown hardcode_into_libs=no @@ -10578,7 +12305,7 @@ aix3*) soname_spec='${libname}${release}${shared_ext}$major' ;; -aix4* | aix5*) +aix[4-9]*) version_type=linux need_lib_prefix=no need_version=no @@ -10597,7 +12324,7 @@ aix4* | aix5*) aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no @@ -10623,9 +12350,18 @@ aix4* | aix5*) ;; amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac ;; beos*) @@ -10648,61 +12384,112 @@ bsdi[45]*) # libtool to hard-code these into programs ;; -cygwin* | mingw* | pw32*) +cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) + case $GCC,$cc_basename in + yes,*) + # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname' + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ - $rm \$dlpath' + $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; - mingw*) + mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' ;; *) + # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' ;; esac - dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; @@ -10712,17 +12499,13 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; @@ -10739,18 +12522,6 @@ freebsd1*) dynamic_linker=no ;; -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. @@ -10783,10 +12554,15 @@ freebsd* | dragonfly*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; - *) # from 3.2 on + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; esac ;; @@ -10800,6 +12576,19 @@ gnu*) hardcode_into_libs=yes ;; +haiku*) + version_type=linux + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. @@ -10822,18 +12611,18 @@ hpux9* | hpux10* | hpux11*) fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH @@ -10842,8 +12631,22 @@ hpux9* | hpux10* | hpux11*) soname_spec='${libname}${release}${shared_ext}$major' ;; esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[3-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) @@ -10889,7 +12692,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be Linux ELF. -linux*) +linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux need_lib_prefix=no need_version=no @@ -10898,6 +12701,41 @@ linux*) finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. @@ -10905,7 +12743,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -10918,23 +12756,11 @@ linux*) dynamic_linker='GNU/Linux ld.so' ;; -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - netbsd*) version_type=sunos need_lib_prefix=no need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' @@ -10955,28 +12781,31 @@ newsos6) shlibpath_overrides_runpath=yes ;; -nto-qnx*) - version_type=linux +*nto* | *qnx*) + version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no @@ -11010,11 +12839,8 @@ osf3* | osf4* | osf5*) sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH +rdos*) + dynamic_linker=no ;; solaris*) @@ -11042,7 +12868,7 @@ sunos4*) need_version=yes ;; -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) +sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' @@ -11051,7 +12877,6 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) sni) shlibpath_overrides_runpath=no need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) @@ -11075,6 +12900,39 @@ sysv4*MP*) fi ;; +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -11090,35 +12948,139 @@ esac $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } -hardcode_action_GCJ= -if test -n "$hardcode_libdir_flag_spec_GCJ" || \ - test -n "$runpath_var_GCJ" || \ - test "X$hardcode_automatic_GCJ" = "Xyes" ; then +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || + test -n "$runpath_var" || + test "X$hardcode_automatic" = "Xyes" ; then - # We can hardcode non-existant directories. - if test "$hardcode_direct_GCJ" != no && + # We can hardcode non-existent directories. + if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && - test "$hardcode_minus_L_GCJ" != no; then + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. - hardcode_action_GCJ=relink + hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_GCJ=immediate + hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. - hardcode_action_GCJ=unsupported + hardcode_action=unsupported fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_GCJ" >&5 -$as_echo "$hardcode_action_GCJ" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +$as_echo "$hardcode_action" >&6; } -if test "$hardcode_action_GCJ" = relink; then +if test "$hardcode_action" = relink || + test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || @@ -11127,36 +13089,12 @@ elif test "$shlibpath_overrides_runpath" = yes || enable_fast_install=needless fi -striplib= -old_striplib= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 -$as_echo_n "checking whether stripping libraries is possible... " >&6; } -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - esac -fi -if test "x$enable_dlopen" != xyes; then + + + + + if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown @@ -11171,21 +13109,21 @@ else lt_cv_dlopen_self=yes ;; - mingw* | pw32*) + mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= - ;; + ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= - ;; + ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then : +if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -11219,7 +13157,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else @@ -11229,16 +13167,16 @@ else fi - ;; + ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = x""yes; then : +if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } -if test "${ac_cv_lib_dld_shl_load+set}" = set; then : +if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -11272,16 +13210,16 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = x""yes; then : - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +if test "x$ac_cv_lib_dld_shl_load" = xyes; then : + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = x""yes; then : +if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then : +if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -11315,12 +13253,12 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } -if test "${ac_cv_lib_svld_dlopen+set}" = set; then : +if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -11354,12 +13292,12 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = x""yes; then : +if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } -if test "${ac_cv_lib_dld_dld_link+set}" = set; then : +if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -11393,8 +13331,8 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = x""yes; then : - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +if test "x$ac_cv_lib_dld_dld_link" = xyes; then : + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi @@ -11427,14 +13365,14 @@ fi test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } -if test "${lt_cv_dlopen_self+set}" = set; then : +if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -11442,8 +13380,8 @@ else else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<EOF -#line 11446 "configure" + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11484,11 +13422,13 @@ else # endif #endif -#ifdef __cplusplus -extern "C" void exit (int); +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); #endif -void fnord() { int i=42;} +int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); @@ -11497,13 +13437,19 @@ int main () if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } /* dlclose (self); */ } + else + puts (dlerror ()); - exit (status); + return status; } -EOF +_LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? @@ -11514,7 +13460,7 @@ EOF case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed @@ -11529,10 +13475,10 @@ fi $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } -if test "${lt_cv_dlopen_self_static+set}" = set; then : +if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -11540,8 +13486,8 @@ else else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<EOF -#line 11544 "configure" + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11582,11 +13528,13 @@ else # endif #endif -#ifdef __cplusplus -extern "C" void exit (int); +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); #endif -void fnord() { int i=42;} +int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); @@ -11595,13 +13543,19 @@ int main () if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } /* dlclose (self); */ } + else + puts (dlerror ()); - exit (status); + return status; } -EOF +_LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? @@ -11612,7 +13566,7 @@ EOF case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed @@ -11645,411 +13599,103 @@ $as_echo "$lt_cv_dlopen_self_static" >&6; } fi -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_GCJ \ - CC_GCJ \ - LD_GCJ \ - lt_prog_compiler_wl_GCJ \ - lt_prog_compiler_pic_GCJ \ - lt_prog_compiler_static_GCJ \ - lt_prog_compiler_no_builtin_flag_GCJ \ - export_dynamic_flag_spec_GCJ \ - thread_safe_flag_spec_GCJ \ - whole_archive_flag_spec_GCJ \ - enable_shared_with_static_runtimes_GCJ \ - old_archive_cmds_GCJ \ - old_archive_from_new_cmds_GCJ \ - predep_objects_GCJ \ - postdep_objects_GCJ \ - predeps_GCJ \ - postdeps_GCJ \ - compiler_lib_search_path_GCJ \ - archive_cmds_GCJ \ - archive_expsym_cmds_GCJ \ - postinstall_cmds_GCJ \ - postuninstall_cmds_GCJ \ - old_archive_from_expsyms_cmds_GCJ \ - allow_undefined_flag_GCJ \ - no_undefined_flag_GCJ \ - export_symbols_cmds_GCJ \ - hardcode_libdir_flag_spec_GCJ \ - hardcode_libdir_flag_spec_ld_GCJ \ - hardcode_libdir_separator_GCJ \ - hardcode_automatic_GCJ \ - module_cmds_GCJ \ - module_expsym_cmds_GCJ \ - lt_cv_prog_compiler_c_o_GCJ \ - exclude_expsyms_GCJ \ - include_expsyms_GCJ; do - - case $var in - old_archive_cmds_GCJ | \ - old_archive_from_new_cmds_GCJ | \ - archive_cmds_GCJ | \ - archive_expsym_cmds_GCJ | \ - module_cmds_GCJ | \ - module_expsym_cmds_GCJ | \ - old_archive_from_expsyms_cmds_GCJ | \ - export_symbols_cmds_GCJ | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac -cfgfile="$ofile" - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared -# Whether or not to build static libraries. -build_old_libs=$enable_static -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_GCJ -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os -# An echo program that does not interpret backslashes. -echo=$lt_echo -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS -# A C compiler. -LTCC=$lt_LTCC -# A language-specific compiler. -CC=$lt_compiler_GCJ - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_GCJ - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_GCJ - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_GCJ - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_GCJ -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_GCJ - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_GCJ -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_GCJ -archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_GCJ -module_expsym_cmds=$lt_module_expsym_cmds_GCJ - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_GCJ - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_GCJ - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_GCJ - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_GCJ - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_GCJ - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_GCJ - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_GCJ - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ +striplib= +old_striplib= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +$as_echo_n "checking whether stripping libraries is possible... " >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac +fi -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_GCJ -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_GCJ -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_GCJ -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_GCJ -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_GCJ" -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_GCJ + # Report which library types will actually be built + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +$as_echo_n "checking if libtool supports shared libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +$as_echo "$can_build_shared" >&6; } -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_GCJ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +$as_echo_n "checking whether to build shared libraries... " >&6; } + test "$can_build_shared" = "no" && enable_shared=no -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_GCJ + aix[4-9]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +$as_echo "$enable_shared" >&6; } -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_GCJ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +$as_echo_n "checking whether to build static libraries... " >&6; } + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +$as_echo "$enable_static" >&6; } -# ### END LIBTOOL TAG CONFIG: $tagname -__EOF__ -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi fi - - ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -12058,654 +13704,395 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" - else - tagname="" - fi - ;; - - RC) - - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -objext_RC=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${RC-"windres"} -compiler=$CC -compiler_RC=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - -lt_cv_prog_compiler_c_o_RC=yes - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_RC \ - CC_RC \ - LD_RC \ - lt_prog_compiler_wl_RC \ - lt_prog_compiler_pic_RC \ - lt_prog_compiler_static_RC \ - lt_prog_compiler_no_builtin_flag_RC \ - export_dynamic_flag_spec_RC \ - thread_safe_flag_spec_RC \ - whole_archive_flag_spec_RC \ - enable_shared_with_static_runtimes_RC \ - old_archive_cmds_RC \ - old_archive_from_new_cmds_RC \ - predep_objects_RC \ - postdep_objects_RC \ - predeps_RC \ - postdeps_RC \ - compiler_lib_search_path_RC \ - archive_cmds_RC \ - archive_expsym_cmds_RC \ - postinstall_cmds_RC \ - postuninstall_cmds_RC \ - old_archive_from_expsyms_cmds_RC \ - allow_undefined_flag_RC \ - no_undefined_flag_RC \ - export_symbols_cmds_RC \ - hardcode_libdir_flag_spec_RC \ - hardcode_libdir_flag_spec_ld_RC \ - hardcode_libdir_separator_RC \ - hardcode_automatic_RC \ - module_cmds_RC \ - module_expsym_cmds_RC \ - lt_cv_prog_compiler_c_o_RC \ - exclude_expsyms_RC \ - include_expsyms_RC; do - - case $var in - old_archive_cmds_RC | \ - old_archive_from_new_cmds_RC | \ - archive_cmds_RC | \ - archive_expsym_cmds_RC | \ - module_cmds_RC | \ - module_expsym_cmds_RC | \ - old_archive_from_expsyms_cmds_RC | \ - export_symbols_cmds_RC | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_RC - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_RC - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_RC - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_RC - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_RC -# Object file suffix (normally "o"). -objext="$ac_objext" -# Old archive suffix (normally "a"). -libext="$libext" -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' -# Executable file suffix (normally ""). -exeext="$exeext" -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_RC -pic_mode=$pic_mode -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version -# Whether dlopen is supported. -dlopen_support=$enable_dlopen -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_RC -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC + ac_config_commands="$ac_config_commands libtool" -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC -# Library versioning type. -version_type=$version_type -# Format of library name prefix. -libname_spec=$lt_libname_spec +# Only expand once: -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_RC -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_RC -archive_expsym_cmds=$lt_archive_expsym_cmds_RC -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_RC -module_expsym_cmds=$lt_module_expsym_cmds_RC - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_RC - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_RC - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_RC - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_RC - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_RC - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_RC - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_RC - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_RC - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_RC - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_RC - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_RC - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_RC - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_RC - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_RC" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_RC - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_RC - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_RC - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_RC - -# ### END LIBTOOL TAG CONFIG: $tagname +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for directory path separator" >&5 +$as_echo_n "checking for directory path separator... " >&6; } +if ${ntp_cv_dir_sep+:} false; then : + $as_echo_n "(cached) " >&6 +else -__EOF__ + case "$ntp_cv_dir_sep" in + '') + case "$target_os" in + *djgpp | *mingw32* | *emx*) + ntp_cv_dir_sep="'\\'" + ;; + *) + ntp_cv_dir_sep="'/'" + ;; + esac + esac -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_cv_dir_sep" >&5 +$as_echo "$ntp_cv_dir_sep" >&6; } +cat >>confdefs.h <<_ACEOF +#define DIR_SEP $ntp_cv_dir_sep +_ACEOF -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 - -CC="$lt_save_CC" - ;; - *) - as_fn_error "Unsupported tag name: $tagname" "$LINENO" 5 - ;; - esac +# Checks for libraries. - # Append the new tag name to the list of available tags. - if test -n "$tagname" ; then - available_tags="$available_tags $tagname" - fi - fi - done - IFS="$lt_save_ifs" +LIBM= +case "$host" in + *-*-darwin*) + ;; + *) + _libs=$LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing cos" >&5 +$as_echo_n "checking for library containing cos... " >&6; } +if ${ac_cv_search_cos+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - # Now substitute the updated list of available tags. - if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then - mv "${ofile}T" "$ofile" - chmod +x "$ofile" +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char cos (); +int +main () +{ +return cos (); + ; + return 0; +} +_ACEOF +for ac_lib in '' m; do + if test -z "$ac_lib"; then + ac_res="none required" else - rm -f "${ofile}T" - as_fn_error "unable to update list of available tagged configurations." "$LINENO" 5 + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_cos=$ac_res fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_cos+:} false; then : + break +fi +done +if ${ac_cv_search_cos+:} false; then : +else + ac_cv_search_cos=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_cos" >&5 +$as_echo "$ac_cv_search_cos" >&6; } +ac_res=$ac_cv_search_cos +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + LIBM="-lm" +fi + LIBS=$_libs + ;; +esac -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - -# Prevent multiple expansion - - - - - - - - +{ _libs=; unset _libs;} -# NTP has (so far) been relying on leading-edge autogen. -# Therefore, by default: -# - use the version we ship with -# - do not install it -# - build a static copy (AC_DISABLE_SHARED - done earlier) -case "${enable_local_libopts+set}" in - set) ;; - *) enable_local_libopts=yes ;; -esac -case "${enable_libopts_install+set}" in - set) ;; - *) enable_libopts_install=no ;; +case "$GCC" in + yes) + CFLAGS="$CFLAGS -Wall" + # CFLAGS="$CFLAGS -Wcast-align" + CFLAGS="$CFLAGS -Wcast-qual" + # CFLAGS="$CFLAGS -Wconversion" + # CFLAGS="$CFLAGS -Werror" + # CFLAGS="$CFLAGS -Wextra" + # CFLAGS="$CFLAGS -Wfloat-equal" + CFLAGS="$CFLAGS -Wmissing-prototypes" + CFLAGS="$CFLAGS -Wpointer-arith" + CFLAGS="$CFLAGS -Wshadow" + # CFLAGS="$CFLAGS -Wtraditional" + # CFLAGS="$CFLAGS -Wwrite-strings" + case "$ntp_cv_gcc_Winit_self" in + yes) + CFLAGS="$CFLAGS -Winit-self" + esac + case "$ntp_cv_gcc_Wstrict_overflow" in + yes) + CFLAGS="$CFLAGS -Wstrict-overflow" + esac + # -W[no-]strict-prototypes is added later depending on OpenSSL esac - NEED_LIBOPTS_DIR='' +ac_fn_c_check_func "$LINENO" "gethostent" "ac_cv_func_gethostent" +if test "x$ac_cv_func_gethostent" = xyes; then : - LIBOPTS_DIR=libopts +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostent" >&5 +$as_echo_n "checking for library containing gethostent... " >&6; } +if ${ac_cv_search_gethostent+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - # Check whether --enable-local-libopts was given. -if test "${enable_local_libopts+set}" = set; then : - enableval=$enable_local_libopts; - if test x$enableval = xyes ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Using supplied libopts tearoff" >&5 -$as_echo "$as_me: Using supplied libopts tearoff" >&6;} - LIBOPTS_LDADD='$(top_builddir)/libopts/libopts.la' - LIBOPTS_CFLAGS='-I$(top_srcdir)/libopts' - NEED_LIBOPTS_DIR=true - fi +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char gethostent (); +int +main () +{ +return gethostent (); + ; + return 0; +} +_ACEOF +for ac_lib in '' nsl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $libxnet -lsocket $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_gethostent=$ac_res fi - - - # Check whether --enable-libopts-install was given. -if test "${enable_libopts_install+set}" = set; then : - enableval=$enable_libopts_install; +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_gethostent+:} false; then : + break fi +done +if ${ac_cv_search_gethostent+:} false; then : - if test "X${enable_libopts_install}" != Xno; then - INSTALL_LIBOPTS_TRUE= - INSTALL_LIBOPTS_FALSE='#' else - INSTALL_LIBOPTS_TRUE='#' - INSTALL_LIBOPTS_FALSE= + ac_cv_search_gethostent=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostent" >&5 +$as_echo "$ac_cv_search_gethostent" >&6; } +ac_res=$ac_cv_search_gethostent +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" +fi - if test -z "${NEED_LIBOPTS_DIR}" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether autoopts-config can be found" >&5 -$as_echo_n "checking whether autoopts-config can be found... " >&6; } +fi + +ac_fn_c_check_func "$LINENO" "openlog" "ac_cv_func_openlog" +if test "x$ac_cv_func_openlog" = xyes; then : -# Check whether --with-autoopts-config was given. -if test "${with_autoopts_config+set}" = set; then : - withval=$with_autoopts_config; lo_cv_with_autoopts_config=${with_autoopts_config} else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether autoopts-config is specified" >&5 -$as_echo_n "checking whether autoopts-config is specified... " >&6; } -if test "${lo_cv_with_autoopts_config+set}" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing openlog" >&5 +$as_echo_n "checking for library containing openlog... " >&6; } +if ${ac_cv_search_openlog+:} false; then : $as_echo_n "(cached) " >&6 else - if autoopts-config --help 2>/dev/null 1>&2 - then lo_cv_with_autoopts_config=autoopts-config - elif libopts-config --help 2>/dev/null 1>&2 - then lo_cv_with_autoopts_config=libopts-config - else lo_cv_with_autoopts_config=no ; fi + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char openlog (); +int +main () +{ +return openlog (); + ; + return 0; +} +_ACEOF +for ac_lib in '' gen; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_openlog=$ac_res fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lo_cv_with_autoopts_config" >&5 -$as_echo "$lo_cv_with_autoopts_config" >&6; } +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_openlog+:} false; then : + break +fi +done +if ${ac_cv_search_openlog+:} false; then : +else + ac_cv_search_openlog=no fi - # end of AC_ARG_WITH +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_openlog" >&5 +$as_echo "$ac_cv_search_openlog" >&6; } +ac_res=$ac_cv_search_openlog +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - if test "${lo_cv_test_autoopts+set}" = set; then : +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing openlog" >&5 +$as_echo_n "checking for library containing openlog... " >&6; } +if ${ac_cv_search_openlog+:} false; then : $as_echo_n "(cached) " >&6 else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - if test -z "${lo_cv_with_autoopts_config}" \ - -o X"${lo_cv_with_autoopts_config}" = Xno - then - if autoopts-config --help 2>/dev/null 1>&2 - then lo_cv_with_autoopts_config=autoopts-config - elif libopts-config --help 2>/dev/null 1>&2 - then lo_cv_with_autoopts_config=libopts-config - else lo_cv_with_autoopts_config=false ; fi - fi - lo_cv_test_autoopts=` - ${lo_cv_with_autoopts_config} --libs` 2> /dev/null - if test $? -ne 0 -o -z "${lo_cv_test_autoopts}" - then lo_cv_test_autoopts=no ; fi - +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char openlog (); +int +main () +{ +return openlog (); + ; + return 0; +} +_ACEOF +for ac_lib in '' syslog; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $libxnet -lsocket $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_openlog=$ac_res fi - # end of CACHE_VAL - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lo_cv_test_autoopts}" >&5 -$as_echo "${lo_cv_test_autoopts}" >&6; } - - if test "X${lo_cv_test_autoopts}" != Xno - then - LIBOPTS_LDADD="${lo_cv_test_autoopts}" - LIBOPTS_CFLAGS="`${lo_cv_with_autoopts_config} --cflags`" - else - LIBOPTS_LDADD='$(top_builddir)/libopts/libopts.la' - LIBOPTS_CFLAGS='-I$(top_srcdir)/libopts' - NEED_LIBOPTS_DIR=true - fi - fi # end of if test -z "${NEED_LIBOPTS_DIR}" +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_openlog+:} false; then : + break +fi +done +if ${ac_cv_search_openlog+:} false; then : - if test -n "${NEED_LIBOPTS_DIR}"; then - NEED_LIBOPTS_TRUE= - NEED_LIBOPTS_FALSE='#' else - NEED_LIBOPTS_TRUE='#' - NEED_LIBOPTS_FALSE= + ac_cv_search_openlog=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_openlog" >&5 +$as_echo "$ac_cv_search_openlog" >&6; } +ac_res=$ac_cv_search_openlog +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" +fi +fi - LIBOPTS_DIR=libopts +fi - ac_config_files="$ac_config_files libopts/Makefile" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing setsockopt" >&5 +$as_echo_n "checking for library containing setsockopt... " >&6; } +if ${ac_cv_search_setsockopt+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char setsockopt (); +int +main () +{ +return setsockopt (); + ; + return 0; +} +_ACEOF +for ac_lib in '' socket xnet; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_setsockopt=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_setsockopt+:} false; then : + break +fi +done +if ${ac_cv_search_setsockopt+:} false; then : +else + ac_cv_search_setsockopt=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_setsockopt" >&5 +$as_echo "$ac_cv_search_setsockopt" >&6; } +ac_res=$ac_cv_search_setsockopt +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - if test -n "${NEED_LIBOPTS_DIR}" ; then +fi -if test X${INVOKE_LIBOPTS_MACROS_FIRST_done} != Xyes ; then - # ================= - # AC_HEADER_STDC - # ================= - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +# Checks for header files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -12815,413 +14202,446 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi - # ================= - # AC_HEADER_DIRENT - # ================= - ac_header_dirent=no -for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do - as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 -$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <sys/types.h> -#include <$ac_hdr> -int -main () -{ -if ((DIR *) 0) -return 0; - ; - return 0; -} +# +case "$host" in + *-hp-hpux*) + for ac_header in net/netmp.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "net/netmp.h" "ac_cv_header_net_netmp_h" "$ac_includes_default" +if test "x$ac_cv_header_net_netmp_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_NET_NETMP_H 1 _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$as_ac_Header=yes" + netmp_h_works=yes else - eval "$as_ac_Header=no" + netmp_h_works=no + fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +done + + case "$netmp_h_works" in + no) + cat >>confdefs.h <<_ACEOF +#ifndef MPINFOU_PREDECLARED +# define MPINFOU_PREDECLARED +typedef union mpinfou { /* For lint */ + struct pdk_mpinfo *pdkptr; + struct mpinfo *pikptr; +} mpinfou_t; +#endif +_ACEOF + + ;; + esac + ;; +esac + +for ac_header in netdb.h netinet/in.h stdlib.h string.h strings.h syslog.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + fi -eval ac_res=\$$as_ac_Header - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : + +done + +for ac_header in sys/socket.h sys/time.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF -ac_header_dirent=$ac_hdr; break fi done -# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. -if test $ac_header_dirent = dirent.h; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 -$as_echo_n "checking for library containing opendir... " >&6; } -if test "${ac_cv_search_opendir+set}" = set; then : + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 +$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } +if ${ac_cv_header_time+:} false; then : $as_echo_n "(cached) " >&6 else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include <sys/types.h> +#include <sys/time.h> +#include <time.h> -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char opendir (); int main () { -return opendir (); +if ((struct tm *) 0) +return 0; ; return 0; } _ACEOF -for ac_lib in '' dir; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_opendir=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if test "${ac_cv_search_opendir+set}" = set; then : - break -fi -done -if test "${ac_cv_search_opendir+set}" = set; then : - +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_time=yes else - ac_cv_search_opendir=no + ac_cv_header_time=no fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 -$as_echo "$ac_cv_search_opendir" >&6; } -ac_res=$ac_cv_search_opendir -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 +$as_echo "$ac_cv_header_time" >&6; } +if test $ac_cv_header_time = yes; then + +$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 -$as_echo_n "checking for library containing opendir... " >&6; } -if test "${ac_cv_search_opendir+set}" = set; then : + +# Checks for typedefs, structures, and compiler characteristics. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 +$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } +if ${ac_cv_header_stdbool_h+:} false; then : $as_echo_n "(cached) " >&6 else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" +#include <stdbool.h> +#ifndef bool + "error: bool is not defined" #endif -char opendir (); +#ifndef false + "error: false is not defined" +#endif +#if false + "error: false is not 0" +#endif +#ifndef true + "error: true is not defined" +#endif +#if true != 1 + "error: true is not 1" +#endif +#ifndef __bool_true_false_are_defined + "error: __bool_true_false_are_defined is not defined" +#endif + + struct s { _Bool s: 1; _Bool t; } s; + + char a[true == 1 ? 1 : -1]; + char b[false == 0 ? 1 : -1]; + char c[__bool_true_false_are_defined == 1 ? 1 : -1]; + char d[(bool) 0.5 == true ? 1 : -1]; + /* See body of main program for 'e'. */ + char f[(_Bool) 0.0 == false ? 1 : -1]; + char g[true]; + char h[sizeof (_Bool)]; + char i[sizeof s.t]; + enum { j = false, k = true, l = false * true, m = true * 256 }; + /* The following fails for + HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ + _Bool n[m]; + char o[sizeof n == m * sizeof n[0] ? 1 : -1]; + char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; + /* Catch a bug in an HP-UX C compiler. See + http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html + */ + _Bool q = true; + _Bool *pq = &q; + int main () { -return opendir (); + + bool e = &s; + *pq |= q; + *pq |= ! q; + /* Refer to every declared value, to avoid compiler optimizations. */ + return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + + !m + !n + !o + !p + !q + !pq); + ; return 0; } _ACEOF -for ac_lib in '' x; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_opendir=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if test "${ac_cv_search_opendir+set}" = set; then : - break -fi -done -if test "${ac_cv_search_opendir+set}" = set; then : - +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdbool_h=yes else - ac_cv_search_opendir=no + ac_cv_header_stdbool_h=no fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 -$as_echo "$ac_cv_search_opendir" >&6; } -ac_res=$ac_cv_search_opendir -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 +$as_echo "$ac_cv_header_stdbool_h" >&6; } +ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" +if test "x$ac_cv_type__Bool" = xyes; then : - - # ================= - # AC_CHECK_HEADERS - # ================= - for ac_header in dlfcn.h errno.h fcntl.h libgen.h memory.h netinet/in.h \ - setjmp.h sys/mman.h sys/param.h sys/poll.h sys/procset.h sys/select.h \ - sys/socket.h sys/stropts.h sys/time.h sys/un.h sys/wait.h unistd.h \ - utime.h sysexits.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +cat >>confdefs.h <<_ACEOF +#define HAVE__BOOL 1 _ACEOF -fi - -done - - # -------------------------------------------- - # Verify certain entries from AC_CHECK_HEADERS - # -------------------------------------------- - for f in sys_types sys_mman sys_param sys_stat sys_wait \ - string errno stdlib memory setjmp - do eval as_ac_var=\${ac_cv_header_${f}_h+set} - test "${as_ac_var}" = set || \ - as_fn_error "You must have ${f}.h on your system" "$LINENO" 5 - done - - # ================================================ - # AC_CHECK_HEADERS: stdarg.h is present define HAVE_STDARG_H, otherwise - # if varargs.h is present define HAVE_VARARGS_H. - # ================================================ - for ac_header in stdarg.h varargs.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - break fi -done +if test $ac_cv_header_stdbool_h = yes; then - if test `eval echo '${'$as_ac_Header'}'` != yes; then - as_fn_error "You must have stdarg.h or varargs.h on your system" "$LINENO" 5 - fi +$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h - # ================================================ - # Similarly for the string.h and strings.h headers - # ================================================ - for ac_header in string.h strings.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - break fi -done +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +if ${ac_cv_c_const+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - if test `eval echo '${'$as_ac_Header'}'` != yes; then - as_fn_error "You must have string.h or strings.h on your system" "$LINENO" 5 - fi +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset cs; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *pcpcc; + char **ppc; + /* 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"; + pcpcc = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; - # ===================== - # ...and limits headers - # ===================== - for ac_header in limits.h sys/limits.h values.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 + *t++ = 0; + if (s) return 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; + if (!foo) return 0; + } + return !cs[0] && !zero.x; +#endif + + ; + return 0; +} _ACEOF - break +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_const=yes +else + ac_cv_c_const=no fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +$as_echo "$ac_cv_c_const" >&6; } +if test $ac_cv_c_const = no; then -done - - if test `eval echo '${'$as_ac_Header'}'` != yes; then - as_fn_error "You must have one of limits.h, sys/limits.h or values.h" "$LINENO" 5 - fi +$as_echo "#define const /**/" >>confdefs.h - # ======================== - # ...and int types headers - # ======================== - for ac_header in stdint.h inttypes.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - break fi -done +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes; then : - ac_fn_c_check_type "$LINENO" "int8_t" "ac_cv_type_int8_t" "$ac_includes_default" -if test "x$ac_cv_type_int8_t" = x""yes; then : +else cat >>confdefs.h <<_ACEOF -#define HAVE_INT8_T 1 +#define size_t unsigned int _ACEOF - fi -ac_fn_c_check_type "$LINENO" "uint8_t" "ac_cv_type_uint8_t" "$ac_includes_default" -if test "x$ac_cv_type_uint8_t" = x""yes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_UINT8_T 1 -_ACEOF +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of time_t" >&5 +$as_echo_n "checking size of time_t... " >&6; } +if ${ac_cv_sizeof_time_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (time_t))" "ac_cv_sizeof_time_t" "$ac_includes_default"; then : +else + if test "$ac_cv_type_time_t" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (time_t) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_time_t=0 + fi fi -ac_fn_c_check_type "$LINENO" "int16_t" "ac_cv_type_int16_t" "$ac_includes_default" -if test "x$ac_cv_type_int16_t" = x""yes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_INT16_T 1 -_ACEOF - fi -ac_fn_c_check_type "$LINENO" "uint16_t" "ac_cv_type_uint16_t" "$ac_includes_default" -if test "x$ac_cv_type_uint16_t" = x""yes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_UINT16_T 1 -_ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_time_t" >&5 +$as_echo "$ac_cv_sizeof_time_t" >&6; } -fi -ac_fn_c_check_type "$LINENO" "int32_t" "ac_cv_type_int32_t" "$ac_includes_default" -if test "x$ac_cv_type_int32_t" = x""yes; then : cat >>confdefs.h <<_ACEOF -#define HAVE_INT32_T 1 +#define SIZEOF_TIME_T $ac_cv_sizeof_time_t _ACEOF -fi -ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "$ac_includes_default" -if test "x$ac_cv_type_uint32_t" = x""yes; then : -cat >>confdefs.h <<_ACEOF -#define HAVE_UINT32_T 1 -_ACEOF - - -fi -ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "$ac_includes_default" -if test "x$ac_cv_type_intptr_t" = x""yes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if ${ac_cv_c_inline+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif -cat >>confdefs.h <<_ACEOF -#define HAVE_INTPTR_T 1 _ACEOF - +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_inline=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done fi -ac_fn_c_check_type "$LINENO" "uint_t" "ac_cv_type_uint_t" "$ac_includes_default" -if test "x$ac_cv_type_uint_t" = x""yes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } -cat >>confdefs.h <<_ACEOF -#define HAVE_UINT_T 1 +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif _ACEOF + ;; +esac -fi - +case "$ac_cv_c_inline" in + '') + ;; + *) - # ==================== - # uintptr type & sizes - # ==================== - ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "$ac_includes_default" -if test "x$ac_cv_type_uintptr_t" = x""yes; then : +$as_echo "#define HAVE_INLINE 1" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define HAVE_UINTPTR_T 1 -_ACEOF +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether char is unsigned" >&5 +$as_echo_n "checking whether char is unsigned... " >&6; } +if ${ac_cv_c_char_unsigned+:} false; then : + $as_echo_n "(cached) " >&6 else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((char) -1) < 0)]; +test_array [0] = 0 -$as_echo "#define uintptr_t unsigned long" >>confdefs.h - + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_char_unsigned=no +else + ac_cv_c_char_unsigned=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_char_unsigned" >&5 +$as_echo "$ac_cv_c_char_unsigned" >&6; } +if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then + $as_echo "#define __CHAR_UNSIGNED__ 1" >>confdefs.h - # The cast to long int works around a bug in the HP C Compiler +fi + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of char*" >&5 -$as_echo_n "checking size of char*... " >&6; } -if test "${ac_cv_sizeof_charp+set}" = set; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of signed char" >&5 +$as_echo_n "checking size of signed char... " >&6; } +if ${ac_cv_sizeof_signed_char+:} false; then : $as_echo_n "(cached) " >&6 else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (char*))" "ac_cv_sizeof_charp" "$ac_includes_default"; then : + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (signed char))" "ac_cv_sizeof_signed_char" "$ac_includes_default"; then : else - if test "$ac_cv_type_charp" = yes; then + if test "$ac_cv_type_signed_char" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (char*) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (signed char) +See \`config.log' for more details" "$LINENO" 5; } else - ac_cv_sizeof_charp=0 + ac_cv_sizeof_signed_char=0 fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_charp" >&5 -$as_echo "$ac_cv_sizeof_charp" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_signed_char" >&5 +$as_echo "$ac_cv_sizeof_signed_char" >&6; } cat >>confdefs.h <<_ACEOF -#define SIZEOF_CHARP $ac_cv_sizeof_charp +#define SIZEOF_SIGNED_CHAR $ac_cv_sizeof_signed_char _ACEOF - # The cast to long int works around a bug in the HP C Compiler +# The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 $as_echo_n "checking size of int... " >&6; } -if test "${ac_cv_sizeof_int+set}" = set; then : +if ${ac_cv_sizeof_int+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : @@ -13230,9 +14650,8 @@ else if test "$ac_cv_type_int" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (int) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (int) +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_int=0 fi @@ -13249,13 +14668,13 @@ cat >>confdefs.h <<_ACEOF _ACEOF - # The cast to long int works around a bug in the HP C Compiler +# The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 $as_echo_n "checking size of long... " >&6; } -if test "${ac_cv_sizeof_long+set}" = set; then : +if ${ac_cv_sizeof_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : @@ -13264,9 +14683,8 @@ else if test "$ac_cv_type_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (long) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (long) +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long=0 fi @@ -13283,785 +14701,830 @@ cat >>confdefs.h <<_ACEOF _ACEOF - # The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 -$as_echo_n "checking size of short... " >&6; } -if test "${ac_cv_sizeof_short+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : -else - if test "$ac_cv_type_short" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (short) -See \`config.log' for more details." "$LINENO" 5; }; } - else - ac_cv_sizeof_short=0 - fi -fi +ac_fn_c_check_type "$LINENO" "s_char" "ac_cv_type_s_char" "$ac_includes_default" +if test "x$ac_cv_type_s_char" = xyes; then : -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5 -$as_echo "$ac_cv_sizeof_short" >&6; } +cat >>confdefs.h <<_ACEOF +#define HAVE_S_CHAR 1 +_ACEOF +fi -cat >>confdefs.h <<_ACEOF -#define SIZEOF_SHORT $ac_cv_sizeof_short -_ACEOF +case "$ac_cv_c_char_unsigned$ac_cv_sizeof_signed_char$ac_cv_type_s_char" in + *yes) + # We have a typedef for s_char. Might as well believe it... + ;; + no0no) + # We have signed chars, can't say 'signed char', no s_char typedef. +$as_echo "#define NEED_S_CHAR_TYPEDEF 1" >>confdefs.h + ;; + no1no) + # We have signed chars, can say 'signed char', no s_char typedef. + $as_echo "#define NEED_S_CHAR_TYPEDEF 1" >>confdefs.h - # ---------------------------------------------------------------------- - # AC_CHECK_LIB for SVR4 libgen, and use it if it defines pathfind. - # ---------------------------------------------------------------------- - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pathfind in -lgen" >&5 -$as_echo_n "checking for pathfind in -lgen... " >&6; } -if test "${ac_cv_lib_gen_pathfind+set}" = set; then : + ;; + yes0no) + # We have unsigned chars, can't say 'signed char', no s_char typedef. + as_fn_error $? "No way to specify a signed character!" "$LINENO" 5 + ;; + yes1no) + # We have unsigned chars, can say 'signed char', no s_char typedef. + $as_echo "#define NEED_S_CHAR_TYPEDEF 1" >>confdefs.h + + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 +$as_echo_n "checking for uid_t in sys/types.h... " >&6; } +if ${ac_cv_type_uid_t+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgen $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include <sys/types.h> -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pathfind (); -int -main () -{ -return pathfind (); - ; - return 0; -} _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gen_pathfind=yes +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "uid_t" >/dev/null 2>&1; then : + ac_cv_type_uid_t=yes else - ac_cv_lib_gen_pathfind=no + ac_cv_type_uid_t=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gen_pathfind" >&5 -$as_echo "$ac_cv_lib_gen_pathfind" >&6; } -if test "x$ac_cv_lib_gen_pathfind" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBGEN 1 -_ACEOF - - LIBS="-lgen $LIBS" +rm -f conftest* fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 +$as_echo "$ac_cv_type_uid_t" >&6; } +if test $ac_cv_type_uid_t = no; then - for ac_func in vprintf -do : - ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf" -if test "x$ac_cv_func_vprintf" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_VPRINTF 1 -_ACEOF - -ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt" -if test "x$ac_cv_func__doprnt" = x""yes; then : +$as_echo "#define uid_t int" >>confdefs.h -$as_echo "#define HAVE_DOPRNT 1" >>confdefs.h -fi +$as_echo "#define gid_t int" >>confdefs.h fi -done - for ac_func in mmap canonicalize_file_name snprintf strdup strchr strrchr -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - INVOKE_LIBOPTS_MACROS_FIRST_done=yes -fi - # Check to see if a reg expr header is specified. -# Check whether --with-regex-header was given. -if test "${with_regex_header+set}" = set; then : - withval=$with_regex_header; libopts_cv_with_regex_header=${with_regex_header} -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a reg expr header is specified" >&5 -$as_echo_n "checking whether a reg expr header is specified... " >&6; } -if test "${libopts_cv_with_regex_header+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - libopts_cv_with_regex_header=no -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libopts_cv_with_regex_header" >&5 -$as_echo "$libopts_cv_with_regex_header" >&6; } -fi - # end of AC_ARG_WITH - if test "X${libopts_cv_with_regex_header}" != Xno - then - cat >>confdefs.h <<_ACEOF -#define REGEX_HEADER <${libopts_cv_with_regex_header}> -_ACEOF - else +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for openssl library directory" >&5 +$as_echo_n "checking for openssl library directory... " >&6; } -$as_echo "#define REGEX_HEADER <regex.h>" >>confdefs.h +# Check whether --with-openssl-libdir was given. +if test "${with_openssl_libdir+set}" = set; then : + withval=$with_openssl_libdir; ans=$withval +else - fi + case "$build" in + $host) ans=yes ;; + *) ans=no ;; + esac +fi - # Check to see if a working libregex can be found. +case "$ans" in + no) + ;; + yes) # Look in: + ans="/usr/lib /usr/lib/openssl /usr/sfw/lib /usr/local/lib /usr/local/ssl/lib /lib" + ;; + *) # Look where they said + ;; +esac +case "$ans" in + no) + ;; + *) # Look for libcrypto.a and libssl.a: + for i in $ans no + do + case "$host" in + *-*-darwin*) + test -f $i/libcrypto.dylib -a -f $i/libssl.dylib && break + ;; + *) + test -f $i/libcrypto.so -a -f $i/libssl.so && break + test -f $i/libcrypto.a -a -f $i/libssl.a && break + ;; + esac + done + case "$i" in + no) + ans=no + OPENSSL_LIB= + ;; + *) ans=$i + OPENSSL_LIB=$ans + ;; + esac + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ans" >&5 +$as_echo "$ans" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for openssl include directory" >&5 +$as_echo_n "checking for openssl include directory... " >&6; } -# Check whether --with-libregex was given. -if test "${with_libregex+set}" = set; then : - withval=$with_libregex; libopts_cv_with_libregex_root=${with_libregex} +# Check whether --with-openssl-incdir was given. +if test "${with_openssl_incdir+set}" = set; then : + withval=$with_openssl_incdir; ans=$withval else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether with-libregex was specified" >&5 -$as_echo_n "checking whether with-libregex was specified... " >&6; } -if test "${libopts_cv_with_libregex_root+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - libopts_cv_with_libregex_root=no -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libopts_cv_with_libregex_root" >&5 -$as_echo "$libopts_cv_with_libregex_root" >&6; } -fi - # end of AC_ARG_WITH libregex - - if test "${with_libguile+set}" = set && \ - test "${withval}" = no - then ## disabled by request - libopts_cv_with_libregex_root=no - libopts_cv_with_libregex_cflags=no - libopts_cv_with_libregex_libs=no - else + case "$build" in + $host) ans=yes ;; + *) ans=no ;; + esac -# Check whether --with-libregex-cflags was given. -if test "${with_libregex_cflags+set}" = set; then : - withval=$with_libregex_cflags; libopts_cv_with_libregex_cflags=${with_regex_cflags} -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether with-libregex-cflags was specified" >&5 -$as_echo_n "checking whether with-libregex-cflags was specified... " >&6; } -if test "${libopts_cv_with_libregex_cflags+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - libopts_cv_with_libregex_cflags=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libopts_cv_with_libregex_cflags" >&5 -$as_echo "$libopts_cv_with_libregex_cflags" >&6; } -fi - # end of AC_ARG_WITH libregex-cflags +case "$ans" in + no) + ;; + yes) # look in: + ans="/usr/include /usr/sfw/include /usr/local/include /usr/local/ssl/include" + ;; + *) # Look where they said + ;; +esac +case "$ans" in + no) + ;; + *) # look for openssl/opensslconf.h: + for i in $ans no + do + test -f $i/openssl/opensslconf.h && break + done + case "$i" in + no) + ans=no + OPENSSL_INC= + ;; + *) ans=$i + OPENSSL_INC=$ans + ;; + esac + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ans" >&5 +$as_echo "$ans" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we will use crypto" >&5 +$as_echo_n "checking if we will use crypto... " >&6; } -# Check whether --with-libregex-libs was given. -if test "${with_libregex_libs+set}" = set; then : - withval=$with_libregex_libs; libopts_cv_with_libregex_libs=${with_regex_libs} +# Check whether --with-crypto was given. +if test "${with_crypto+set}" = set; then : + withval=$with_crypto; ans=$withval else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether with-libregex-libs was specified" >&5 -$as_echo_n "checking whether with-libregex-libs was specified... " >&6; } -if test "${libopts_cv_with_libregex_libs+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - libopts_cv_with_libregex_libs=no -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libopts_cv_with_libregex_libs" >&5 -$as_echo "$libopts_cv_with_libregex_libs" >&6; } + ans=yes fi - # end of AC_ARG_WITH libregex-libs - case "X${libopts_cv_with_libregex_cflags}" in - Xyes|Xno|X ) - case "X${libopts_cv_with_libregex_root}" in - Xyes|Xno|X ) libopts_cv_with_libregex_cflags=no ;; - * ) libopts_cv_with_libregex_cflags=-I${libopts_cv_with_libregex_root}/include ;; +case "$ans" in + no) + ;; + yes|openssl) + if test -z "$OPENSSL_LIB" -o -z "$OPENSSL_INC" + then + ans=no + else + ans=yes + fi +esac +ntp_openssl=$ans +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ans" >&5 +$as_echo "$ans" >&6; } + +case "$ntp_openssl" in + yes) + # We have OpenSSL inc/lib - use them. + case "$OPENSSL_INC" in + /usr/include) + ;; + *) + CPPFLAGS="$CPPFLAGS -I$OPENSSL_INC" + ;; esac - esac - case "X${libopts_cv_with_libregex_libs}" in - Xyes|Xno|X ) - case "X${libopts_cv_with_libregex_root}" in - Xyes|Xno|X ) libopts_cv_with_libregex_libs=no ;; - * ) libopts_cv_with_libregex_libs="-L${libopts_cv_with_libregex_root}/lib -lregex";; + case "$OPENSSL_LIB" in + /usr/lib) + ;; + *) + LDFLAGS="$LDFLAGS -L$OPENSSL_LIB" + case "$need_dash_r" in + 1) + LDFLAGS="$LDFLAGS -R$OPENSSL_LIB" + esac + ;; esac - esac - libopts_save_CPPFLAGS="${CPPFLAGS}" - libopts_save_LIBS="${LIBS}" - fi ## disabled by request + LCRYPTO=-lcrypto - case "X${libopts_cv_with_libregex_cflags}" in - Xyes|Xno|X ) - libopts_cv_with_libregex_cflags="" ;; - * ) CPPFLAGS="${CPPFLAGS} ${libopts_cv_with_libregex_cflags}" ;; - esac - case "X${libopts_cv_with_libregex_libs}" in - Xyes|Xno|X ) - libopts_cv_with_libregex_libs="" ;; - * ) - LIBS="${LIBS} ${libopts_cv_with_libregex_libs}" ;; - esac - LIBREGEX_CFLAGS="" - LIBREGEX_LIBS="" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libregex functions properly" >&5 -$as_echo_n "checking whether libregex functions properly... " >&6; } - if test "${libopts_cv_with_libregex+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - libopts_cv_with_libregex=no +$as_echo "#define OPENSSL 1" >>confdefs.h + +esac + +# +# check for linking with -lcrypto failure, and try -lz -lcrypto. +# Helps m68k-atari-mint +# +case "$ntp_openssl" in + yes) + NTPO_SAVED_LIBS="$LIBS" + LIBS="$NTPO_SAVED_LIBS $LCRYPTO" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if linking with $LCRYPTO alone works" >&5 +$as_echo_n "checking if linking with $LCRYPTO alone works... " >&6; } +if ${ntp_cv_bare_lcrypto+:} false; then : + $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <stdio.h> -#include <stdlib.h> -#include <sys/types.h> -#include REGEX_HEADER -static regex_t re; -void comp_re( char const* pzPat ) { - int res = regcomp( &re, pzPat, REG_EXTENDED|REG_ICASE|REG_NEWLINE ); - if (res == 0) return; - exit( res ); } -int main() { - regmatch_t m[2]; - comp_re( "^.*\$" ); - comp_re( "()|no.*" ); - comp_re( "." ); - if (regexec( &re, "X", 2, m, 0 ) != 0) return 1; - if ((m[0].rm_so != 0) || (m[0].rm_eo != 1)) { - fputs( "error: regex -->.<-- did not match\n", stderr ); - return 1; - } - return 0; } -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - libopts_cv_with_libregex=yes -else - libopts_cv_with_libregex=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - # end of AC_TRY_RUN - -fi - # end of AC_CACHE_VAL for libopts_cv_with_libregex - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${libopts_cv_with_libregex}" >&5 -$as_echo "${libopts_cv_with_libregex}" >&6; } - - if test "X${libopts_cv_with_libregex}" != Xno - then -$as_echo "#define WITH_LIBREGEX 1" >>confdefs.h - - else - CPPFLAGS="${libopts_save_CPPFLAGS}" - LIBS="${libopts_save_LIBS}" - fi + #include "openssl/err.h" + #include "openssl/evp.h" +int +main () +{ + ERR_load_crypto_strings(); + OpenSSL_add_all_algorithms(); - # Check to see if pathfind(3) works. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pathfind(3) works" >&5 -$as_echo_n "checking whether pathfind(3) works... " >&6; } - if test "${libopts_cv_run_pathfind+set}" = set; then : - $as_echo_n "(cached) " >&6 + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ntp_cv_bare_lcrypto=yes else + ntp_cv_bare_lcrypto=no - if test "$cross_compiling" = yes; then : - libopts_cv_run_pathfind=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_cv_bare_lcrypto" >&5 +$as_echo "$ntp_cv_bare_lcrypto" >&6; } + case "$ntp_cv_bare_lcrypto" in + no) + LIBS="$NTPO_SAVED_LIBS $LCRYPTO -lz" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if linking with $LCRYPTO -lz works" >&5 +$as_echo_n "checking if linking with $LCRYPTO -lz works... " >&6; } +if ${ntp_cv_lcrypto_lz+:} false; then : + $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <string.h> -#include <stdlib.h> -int main (int argc, char** argv) { - char* pz = pathfind( getenv( "PATH" ), "sh", "x" ); - return (pz == 0) ? 1 : 0; + + #include "openssl/err.h" + #include "openssl/evp.h" + +int +main () +{ + + ERR_load_crypto_strings(); + OpenSSL_add_all_algorithms(); + + + ; + return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - libopts_cv_run_pathfind=yes +if ac_fn_c_try_link "$LINENO"; then : + ntp_cv_lcrypto_lz=yes else - libopts_cv_run_pathfind=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext + ntp_cv_lcrypto_lz=no + fi - # end of TRY_RUN +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi - # end of AC_CACHE_VAL for libopts_cv_run_pathfind - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${libopts_cv_run_pathfind}" >&5 -$as_echo "${libopts_cv_run_pathfind}" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_cv_lcrypto_lz" >&5 +$as_echo "$ntp_cv_lcrypto_lz" >&6; } + case "$ntp_cv_lcrypto_lz" in + yes) + LCRYPTO="$LCRYPTO -lz" + esac + esac + LIBS="$NTPO_SAVED_LIBS" + { NTPO_SAVED_LIBS=; unset NTPO_SAVED_LIBS;} +esac - if test "X${libopts_cv_run_pathfind}" != Xno - then +# +# Older OpenSSL headers have a number of callback prototypes inside +# other function prototypes which trigger copious warnings with gcc's +# -Wstrict-prototypes, which is included in -Wall. +# +# An example: +# +# int i2d_RSA_NET(const RSA *a, unsigned char **pp, +# int (*cb)(), int sgckey); +# ^^^^^^^^^^^ +# +# +# +openssl_triggers_warnings=unknown +SAVED_CFLAGS="$CFLAGS" -$as_echo "#define HAVE_PATHFIND 1" >>confdefs.h +case "$GCC$ntp_openssl" in + yesyes) + CFLAGS="$CFLAGS -Werror" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - fi +int +main () +{ + /* see if -Werror breaks gcc */ - # Check to see if /dev/zero is readable device. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether /dev/zero is readable device" >&5 -$as_echo_n "checking whether /dev/zero is readable device... " >&6; } - if test "${libopts_cv_test_dev_zero+set}" = set; then : - $as_echo_n "(cached) " >&6 + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gcc_handles_Werror=yes else - - libopts_cv_test_dev_zero=`exec 2> /dev/null -dzero=\`ls -lL /dev/zero | egrep ^c......r\` -test -z "${dzero}" && exit 1 -echo ${dzero}` - if test $? -ne 0 - then libopts_cv_test_dev_zero=no - elif test -z "$libopts_cv_test_dev_zero" - then libopts_cv_test_dev_zero=no - fi + gcc_handles_Werror=no fi - # end of CACHE_VAL of libopts_cv_test_dev_zero - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${libopts_cv_test_dev_zero}" >&5 -$as_echo "${libopts_cv_test_dev_zero}" >&6; } - - if test "X${libopts_cv_test_dev_zero}" != Xno - then - -$as_echo "#define HAVE_DEV_ZERO 1" >>confdefs.h - - fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + case "$gcc_handles_Werror" in + no) + # if this gcc doesn't do -Werror go ahead and use + # -Wstrict-prototypes. + openssl_triggers_warnings=yes + ;; + yes) + CFLAGS="$CFLAGS -Wstrict-prototypes" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + #include "openssl/asn1_mac.h" + #include "openssl/bn.h" + #include "openssl/err.h" + #include "openssl/evp.h" + #include "openssl/pem.h" + #include "openssl/rand.h" + #include "openssl/x509v3.h" +int +main () +{ - # Check to see if we have a functional realpath(3C). + /* empty body */ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we have a functional realpath(3C)" >&5 -$as_echo_n "checking whether we have a functional realpath(3C)... " >&6; } - if test "${libopts_cv_run_realpath+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - - if test "$cross_compiling" = yes; then : - libopts_cv_run_realpath=no -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <limits.h> -#include <stdlib.h> -int main (int argc, char** argv) { -#ifndef PATH_MAX -choke me!! -#else - char zPath[PATH_MAX+1]; -#endif - char *pz = realpath(argv[0], zPath); - return (pz == zPath) ? 0 : 1; + ; + return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - libopts_cv_run_realpath=yes +if ac_fn_c_try_compile "$LINENO"; then : + openssl_triggers_warnings=no else - libopts_cv_run_realpath=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - # end of TRY_RUN + openssl_triggers_warnings=yes fi - # end of AC_CACHE_VAL for libopts_cv_run_realpath - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${libopts_cv_run_realpath}" >&5 -$as_echo "${libopts_cv_run_realpath}" >&6; } - - if test "X${libopts_cv_run_realpath}" != Xno - then - -$as_echo "#define HAVE_REALPATH 1" >>confdefs.h - - fi - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + esac + case "$openssl_triggers_warnings" in + yes) + CFLAGS="$SAVED_CFLAGS -Wno-strict-prototypes" + ;; + *) + CFLAGS="$SAVED_CFLAGS -Wstrict-prototypes" + esac + ;; + yesno) + # gcc without OpenSSL + CFLAGS="$SAVED_CFLAGS -Wstrict-prototypes" +esac - # Check to see if strftime() works. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strftime() works" >&5 -$as_echo_n "checking whether strftime() works... " >&6; } - if test "${libopts_cv_run_strftime+set}" = set; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking type of socklen arg for getsockname()" >&5 +$as_echo_n "checking type of socklen arg for getsockname()... " >&6; } +if ${ntp_cv_getsockname_socklen_type+:} false; then : $as_echo_n "(cached) " >&6 else - if test "$cross_compiling" = yes; then : - libopts_cv_run_strftime=no - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + getsockname_socklen_type_found=no + for getsockname_arg2 in 'struct sockaddr *' 'void *'; do + for ntp_cv_getsockname_socklen_type in 'socklen_t' 'size_t' 'unsigned int' 'int'; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <time.h> -#include <string.h> -char t_buf[ 64 ]; -int main() { - static char const z[] = "Thursday Aug 28 240"; - struct tm tm; - tm.tm_sec = 36; /* seconds after the minute [0, 61] */ - tm.tm_min = 44; /* minutes after the hour [0, 59] */ - tm.tm_hour = 12; /* hour since midnight [0, 23] */ - tm.tm_mday = 28; /* day of the month [1, 31] */ - tm.tm_mon = 7; /* months since January [0, 11] */ - tm.tm_year = 86; /* years since 1900 */ - tm.tm_wday = 4; /* days since Sunday [0, 6] */ - tm.tm_yday = 239; /* days since January 1 [0, 365] */ - tm.tm_isdst = 1; /* flag for daylight savings time */ - strftime( t_buf, sizeof( t_buf ), "%A %b %d %j", &tm ); - return (strcmp( t_buf, z ) != 0); } -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - libopts_cv_run_strftime=yes -else - libopts_cv_run_strftime=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - # end of TRY_RUN -fi - # end of AC_CACHE_VAL for libopts_cv_run_strftime - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${libopts_cv_run_strftime}" >&5 -$as_echo "${libopts_cv_run_strftime}" >&6; } + #ifdef HAVE_SYS_TYPES_H + # include <sys/types.h> + #endif + #ifdef HAVE_SYS_SOCKET_H + # include <sys/socket.h> + #endif - if test "X${libopts_cv_run_strftime}" != Xno - then +int +main () +{ -$as_echo "#define HAVE_STRFTIME 1" >>confdefs.h + extern + getsockname(int, $getsockname_arg2, + $ntp_cv_getsockname_socklen_type *); - fi + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + getsockname_socklen_type_found=yes ; break 2 +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done + done + case "$getsockname_socklen_type_found" in + no) + ntp_cv_getsockname_socklen_type='socklen_t' + esac + { getsockname_arg2=; unset getsockname_arg2;} + { getsockname_socklen_type_found=; unset getsockname_socklen_type_found;} - # Check to see if fopen accepts "b" mode. +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_cv_getsockname_socklen_type" >&5 +$as_echo "$ntp_cv_getsockname_socklen_type" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fopen accepts \"b\" mode" >&5 -$as_echo_n "checking whether fopen accepts \"b\" mode... " >&6; } - if test "${libopts_cv_run_fopen_binary+set}" = set; then : - $as_echo_n "(cached) " >&6 -else +cat >>confdefs.h <<_ACEOF +#define GETSOCKNAME_SOCKLEN_TYPE $ntp_cv_getsockname_socklen_type +_ACEOF - if test "$cross_compiling" = yes; then : - libopts_cv_run_fopen_binary=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct sockaddr_storage" >&5 +$as_echo_n "checking for struct sockaddr_storage... " >&6; } +if ${ntp_cv_sockaddr_storage+:} false; then : + $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <stdio.h> -int main (int argc, char** argv) { -FILE* fp = fopen("conftest.$ac_ext", "rb"); -return (fp == NULL) ? 1 : fclose(fp); } -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - libopts_cv_run_fopen_binary=yes -else - libopts_cv_run_fopen_binary=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - # end of TRY_RUN -fi - # end of AC_CACHE_VAL for libopts_cv_run_fopen_binary - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${libopts_cv_run_fopen_binary}" >&5 -$as_echo "${libopts_cv_run_fopen_binary}" >&6; } + #ifdef HAVE_SYS_TYPES_H + # include <sys/types.h> + #endif + #ifdef HAVE_SYS_SOCKET_H + # include <sys/socket.h> + #endif + #ifdef HAVE_NETINET_IN_H + # include <netinet/in.h> + #endif - if test "X${libopts_cv_run_fopen_binary}" != Xno - then +int +main () +{ -$as_echo "#define FOPEN_BINARY_FLAG \"b\"" >>confdefs.h + struct sockaddr_storage n; - else -$as_echo "#define FOPEN_BINARY_FLAG \"\"" >>confdefs.h + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ntp_cv_sockaddr_storage=yes +else + ntp_cv_sockaddr_storage=no - fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_cv_sockaddr_storage" >&5 +$as_echo "$ntp_cv_sockaddr_storage" >&6; } +case "$ntp_cv_sockaddr_storage" in + yes) +$as_echo "#define HAVE_STRUCT_SOCKADDR_STORAGE 1" >>confdefs.h - # Check to see if fopen accepts "t" mode. +esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fopen accepts \"t\" mode" >&5 -$as_echo_n "checking whether fopen accepts \"t\" mode... " >&6; } - if test "${libopts_cv_run_fopen_text+set}" = set; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sockaddr_storage.ss_family" >&5 +$as_echo_n "checking for sockaddr_storage.ss_family... " >&6; } +if ${ntp_cv_have_ss_family+:} false; then : $as_echo_n "(cached) " >&6 else - - if test "$cross_compiling" = yes; then : - libopts_cv_run_fopen_text=no - -else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <stdio.h> -int main (int argc, char** argv) { -FILE* fp = fopen("conftest.$ac_ext", "rt"); -return (fp == NULL) ? 1 : fclose(fp); } + + #ifdef HAVE_SYS_TYPES_H + # include <sys/types.h> + #endif + #ifdef HAVE_SYS_SOCKET_H + # include <sys/socket.h> + #endif + #ifdef HAVE_NETINET_IN_H + # include <netinet/in.h> + #endif + +int +main () +{ + + struct sockaddr_storage s; + s.ss_family = 1; + + + ; + return 0; +} _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - libopts_cv_run_fopen_text=yes +if ac_fn_c_try_compile "$LINENO"; then : + ntp_cv_have_ss_family=yes else - libopts_cv_run_fopen_text=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - # end of TRY_RUN + ntp_cv_have_ss_family=no fi - # end of AC_CACHE_VAL for libopts_cv_run_fopen_text - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${libopts_cv_run_fopen_text}" >&5 -$as_echo "${libopts_cv_run_fopen_text}" >&6; } - - if test "X${libopts_cv_run_fopen_text}" != Xno - then - -$as_echo "#define FOPEN_TEXT_FLAG \"t\"" >>confdefs.h +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - else +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_cv_have_ss_family" >&5 +$as_echo "$ntp_cv_have_ss_family" >&6; } -$as_echo "#define FOPEN_TEXT_FLAG \"\"" >>confdefs.h +case "$ntp_cv_have_ss_family" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sockaddr_storage.__ss_family" >&5 +$as_echo_n "checking for sockaddr_storage.__ss_family... " >&6; } +if ${ntp_cv_have___ss_family+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - fi + #ifdef HAVE_SYS_TYPES_H + # include <sys/types.h> + #endif + #ifdef HAVE_SYS_SOCKET_H + # include <sys/socket.h> + #endif + #ifdef HAVE_NETINET_IN_H + # include <netinet/in.h> + #endif +int +main () +{ + struct sockaddr_storage s; + s.__ss_family = 1; - # Check to see if not wanting optional option args. - # Check whether --enable-optional-args was given. -if test "${enable_optional_args+set}" = set; then : - enableval=$enable_optional_args; libopts_cv_enable_optional_args=${enable_optional_args} -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether not wanting optional option args" >&5 -$as_echo_n "checking whether not wanting optional option args... " >&6; } -if test "${libopts_cv_enable_optional_args+set}" = set; then : - $as_echo_n "(cached) " >&6 + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ntp_cv_have___ss_family=yes else - libopts_cv_enable_optional_args=yes -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libopts_cv_enable_optional_args" >&5 -$as_echo "$libopts_cv_enable_optional_args" >&6; } + ntp_cv_have___ss_family=no fi - # end of AC_ARG_ENABLE - - if test "X${libopts_cv_enable_optional_args}" = Xno - then - -$as_echo "#define NO_OPTIONAL_OPT_ARGS 1" >>confdefs.h +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_cv_have___ss_family" >&5 +$as_echo "$ntp_cv_have___ss_family" >&6; } + case "$ntp_cv_have___ss_family" in + yes) +$as_echo "#define HAVE___SS_FAMILY_IN_SS 1" >>confdefs.h + esac +esac - else -if test X${INVOKE_LIBOPTS_MACROS_FIRST_done} != Xyes ; then - # ================= - # AC_HEADER_STDC - # ================= - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sockaddr_storage.ss_len" >&5 +$as_echo_n "checking for sockaddr_storage.ss_len... " >&6; } +if ${ntp_cv_have_ss_len+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <float.h> + + #ifdef HAVE_SYS_TYPES_H + # include <sys/types.h> + #endif + #ifdef HAVE_SYS_SOCKET_H + # include <sys/socket.h> + #endif + #ifdef HAVE_NETINET_IN_H + # include <netinet/in.h> + #endif int main () { + struct sockaddr_storage s; + s.ss_len = 1; + + ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes + ntp_cv_have_ss_len=yes else - ac_cv_header_stdc=no + ntp_cv_have_ss_len=no + fi rm -f core 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. +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_cv_have_ss_len" >&5 +$as_echo "$ntp_cv_have_ss_len" >&6; } + +case "$ntp_cv_have_ss_len" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sockaddr_storage.__ss_len" >&5 +$as_echo_n "checking for sockaddr_storage.__ss_len... " >&6; } +if ${ntp_cv_have___ss_len+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <string.h> -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : + #ifdef HAVE_SYS_TYPES_H + # include <sys/types.h> + #endif + #ifdef HAVE_SYS_SOCKET_H + # include <sys/socket.h> + #endif + #ifdef HAVE_NETINET_IN_H + # include <netinet/in.h> + #endif -else - ac_cv_header_stdc=no -fi -rm -f conftest* +int +main () +{ -fi + struct sockaddr_storage s; + s.__ss_len = 1; -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <stdlib.h> + ; + return 0; +} _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - +if ac_fn_c_try_compile "$LINENO"; then : + ntp_cv_have___ss_len=yes else - ac_cv_header_stdc=no + ntp_cv_have___ss_len=no + fi -rm -f conftest* +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_cv_have___ss_len" >&5 +$as_echo "$ntp_cv_have___ss_len" >&6; } + case "$ntp_cv_have___ss_len" in + yes) -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 : - : +$as_echo "#define HAVE___SS_LEN_IN_SS 1" >>confdefs.h + + esac +esac + + + +# +# Look for in_port_t. +# +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for in_port_t" >&5 +$as_echo_n "checking for in_port_t... " >&6; } +if ${isc_cv_have_in_port_t+:} false; then : + $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <ctype.h> -#include <stdlib.h> -#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 -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) + #include <sys/types.h> + #include <netinet/in.h> + int main () { - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; + + in_port_t port = 25; + return (0); + + + ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - +if ac_fn_c_try_compile "$LINENO"; then : + isc_cv_have_in_port_t=yes else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi + isc_cv_have_in_port_t=no fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $isc_cv_have_in_port_t" >&5 +$as_echo "$isc_cv_have_in_port_t" >&6; } +case "$isc_cv_have_in_port_t" in + no) -$as_echo "#define STDC_HEADERS 1" >>confdefs.h +$as_echo "#define ISC_PLATFORM_NEEDPORTT 1" >>confdefs.h -fi +esac - # ================= - # AC_HEADER_DIRENT - # ================= - ac_header_dirent=no -for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do - as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 -$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for multicast IP support" >&5 +$as_echo_n "checking for multicast IP support... " >&6; } +if ${ntp_cv_multicast+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + ntp_cv_multicast=no + case "$host" in + i386-sequent-sysv4) + ;; + *) + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <sys/types.h> -#include <$ac_hdr> + + #ifdef HAVE_NETINET_IN_H + #include <netinet/in.h> + #endif int main () { -if ((DIR *) 0) -return 0; + + struct ip_mreq ipmr; + ipmr.imr_interface.s_addr = 0; + + ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - eval "$as_ac_Header=yes" -else - eval "$as_ac_Header=no" + ntp_cv_multicast=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + esac + + fi -eval ac_res=\$$as_ac_Header - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 -_ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_cv_multicast" >&5 +$as_echo "$ntp_cv_multicast" >&6; } +case "$ntp_cv_multicast" in + yes) + +$as_echo "#define MCAST 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking arg type needed for setsockopt() IP*_MULTICAST_LOOP" >&5 +$as_echo_n "checking arg type needed for setsockopt() IP*_MULTICAST_LOOP... " >&6; } +if ${ntp_cv_typeof_ip_multicast_loop+:} false; then : + $as_echo_n "(cached) " >&6 +else + + case "$host" in + *-*-netbsd*|*-*-*linux*) + ntp_cv_typeof_ip_multicast_loop=u_int + ;; + *) + ntp_cv_typeof_ip_multicast_loop=u_char + esac + -ac_header_dirent=$ac_hdr; break fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_cv_typeof_ip_multicast_loop" >&5 +$as_echo "$ntp_cv_typeof_ip_multicast_loop" >&6; } -done -# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. -if test $ac_header_dirent = dirent.h; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 -$as_echo_n "checking for library containing opendir... " >&6; } -if test "${ac_cv_search_opendir+set}" = set; then : +cat >>confdefs.h <<_ACEOF +#define TYPEOF_IP_MULTICAST_LOOP $ntp_cv_typeof_ip_multicast_loop +_ACEOF + +esac + +# HMS: We don't need res_init, but since we may be using cached +# values from ntpd we need to test the same way +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing res_init" >&5 +$as_echo_n "checking for library containing res_init... " >&6; } +if ${ac_cv_search_res_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -14074,51 +15537,50 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char opendir (); +char res_init (); int main () { -return opendir (); +return res_init (); ; return 0; } _ACEOF -for ac_lib in '' dir; do +for ac_lib in '' resolv; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" + LIBS="-l$ac_lib -lsocket -lnsl $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_opendir=$ac_res + ac_cv_search_res_init=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_opendir+set}" = set; then : + if ${ac_cv_search_res_init+:} false; then : break fi done -if test "${ac_cv_search_opendir+set}" = set; then : +if ${ac_cv_search_res_init+:} false; then : else - ac_cv_search_opendir=no + ac_cv_search_res_init=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 -$as_echo "$ac_cv_search_opendir" >&6; } -ac_res=$ac_cv_search_opendir +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_res_init" >&5 +$as_echo "$ac_cv_search_res_init" >&6; } +ac_res=$ac_cv_search_res_init if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 -$as_echo_n "checking for library containing opendir... " >&6; } -if test "${ac_cv_search_opendir+set}" = set; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_ntop" >&5 +$as_echo_n "checking for library containing inet_ntop... " >&6; } +if ${ac_cv_search_inet_ntop+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -14131,1240 +15593,509 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char opendir (); +char inet_ntop (); int main () { -return opendir (); +return inet_ntop (); ; return 0; } _ACEOF -for ac_lib in '' x; do +for ac_lib in '' resolv; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" + LIBS="-l$ac_lib -lsocket -lnsl $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_opendir=$ac_res + ac_cv_search_inet_ntop=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_opendir+set}" = set; then : + if ${ac_cv_search_inet_ntop+:} false; then : break fi done -if test "${ac_cv_search_opendir+set}" = set; then : +if ${ac_cv_search_inet_ntop+:} false; then : else - ac_cv_search_opendir=no + ac_cv_search_inet_ntop=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 -$as_echo "$ac_cv_search_opendir" >&6; } -ac_res=$ac_cv_search_opendir +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inet_ntop" >&5 +$as_echo "$ac_cv_search_inet_ntop" >&6; } +ac_res=$ac_cv_search_inet_ntop if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi -fi - - - # ================= - # AC_CHECK_HEADERS - # ================= - for ac_header in dlfcn.h errno.h fcntl.h libgen.h memory.h netinet/in.h \ - setjmp.h sys/mman.h sys/param.h sys/poll.h sys/procset.h sys/select.h \ - sys/socket.h sys/stropts.h sys/time.h sys/un.h sys/wait.h unistd.h \ - utime.h sysexits.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - # -------------------------------------------- - # Verify certain entries from AC_CHECK_HEADERS - # -------------------------------------------- - for f in sys_types sys_mman sys_param sys_stat sys_wait \ - string errno stdlib memory setjmp - do eval as_ac_var=\${ac_cv_header_${f}_h+set} - test "${as_ac_var}" = set || \ - as_fn_error "You must have ${f}.h on your system" "$LINENO" 5 - done - - # ================================================ - # AC_CHECK_HEADERS: stdarg.h is present define HAVE_STDARG_H, otherwise - # if varargs.h is present define HAVE_VARARGS_H. - # ================================================ - for ac_header in stdarg.h varargs.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - break -fi - -done - - if test `eval echo '${'$as_ac_Header'}'` != yes; then - as_fn_error "You must have stdarg.h or varargs.h on your system" "$LINENO" 5 - fi - - # ================================================ - # Similarly for the string.h and strings.h headers - # ================================================ - for ac_header in string.h strings.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - break -fi - -done - - if test `eval echo '${'$as_ac_Header'}'` != yes; then - as_fn_error "You must have string.h or strings.h on your system" "$LINENO" 5 - fi - - # ===================== - # ...and limits headers - # ===================== - for ac_header in limits.h sys/limits.h values.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - break -fi - -done - - if test `eval echo '${'$as_ac_Header'}'` != yes; then - as_fn_error "You must have one of limits.h, sys/limits.h or values.h" "$LINENO" 5 - fi - - # ======================== - # ...and int types headers - # ======================== - for ac_header in stdint.h inttypes.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - break -fi - -done - - ac_fn_c_check_type "$LINENO" "int8_t" "ac_cv_type_int8_t" "$ac_includes_default" -if test "x$ac_cv_type_int8_t" = x""yes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_INT8_T 1 -_ACEOF - - -fi -ac_fn_c_check_type "$LINENO" "uint8_t" "ac_cv_type_uint8_t" "$ac_includes_default" -if test "x$ac_cv_type_uint8_t" = x""yes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_UINT8_T 1 -_ACEOF - - -fi -ac_fn_c_check_type "$LINENO" "int16_t" "ac_cv_type_int16_t" "$ac_includes_default" -if test "x$ac_cv_type_int16_t" = x""yes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_INT16_T 1 -_ACEOF - - -fi -ac_fn_c_check_type "$LINENO" "uint16_t" "ac_cv_type_uint16_t" "$ac_includes_default" -if test "x$ac_cv_type_uint16_t" = x""yes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_UINT16_T 1 -_ACEOF - - -fi -ac_fn_c_check_type "$LINENO" "int32_t" "ac_cv_type_int32_t" "$ac_includes_default" -if test "x$ac_cv_type_int32_t" = x""yes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_INT32_T 1 -_ACEOF - - -fi -ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "$ac_includes_default" -if test "x$ac_cv_type_uint32_t" = x""yes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_UINT32_T 1 -_ACEOF - - -fi -ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "$ac_includes_default" -if test "x$ac_cv_type_intptr_t" = x""yes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_INTPTR_T 1 -_ACEOF - - -fi -ac_fn_c_check_type "$LINENO" "uint_t" "ac_cv_type_uint_t" "$ac_includes_default" -if test "x$ac_cv_type_uint_t" = x""yes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_UINT_T 1 -_ACEOF - - -fi - - - # ==================== - # uintptr type & sizes - # ==================== - ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "$ac_includes_default" -if test "x$ac_cv_type_uintptr_t" = x""yes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_UINTPTR_T 1 -_ACEOF - - -else - -$as_echo "#define uintptr_t unsigned long" >>confdefs.h - -fi - - # The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of char*" >&5 -$as_echo_n "checking size of char*... " >&6; } -if test "${ac_cv_sizeof_charp+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (char*))" "ac_cv_sizeof_charp" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_charp" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (char*) -See \`config.log' for more details." "$LINENO" 5; }; } - else - ac_cv_sizeof_charp=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_charp" >&5 -$as_echo "$ac_cv_sizeof_charp" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_CHARP $ac_cv_sizeof_charp -_ACEOF - - - # The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 -$as_echo_n "checking size of int... " >&6; } -if test "${ac_cv_sizeof_int+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_int" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (int) -See \`config.log' for more details." "$LINENO" 5; }; } - else - ac_cv_sizeof_int=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 -$as_echo "$ac_cv_sizeof_int" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_INT $ac_cv_sizeof_int -_ACEOF - +ac_fn_c_check_func "$LINENO" "inet_ntop" "ac_cv_func_inet_ntop" +if test "x$ac_cv_func_inet_ntop" = xyes; then : - # The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 -$as_echo_n "checking size of long... " >&6; } -if test "${ac_cv_sizeof_long+set}" = set; then : - $as_echo_n "(cached) " >&6 else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : -else - if test "$ac_cv_type_long" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (long) -See \`config.log' for more details." "$LINENO" 5; }; } - else - ac_cv_sizeof_long=0 - fi -fi +$as_echo "#define ISC_PLATFORM_NEEDNTOP 1" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 -$as_echo "$ac_cv_sizeof_long" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_LONG $ac_cv_sizeof_long -_ACEOF +ac_fn_c_check_func "$LINENO" "inet_pton" "ac_cv_func_inet_pton" +if test "x$ac_cv_func_inet_pton" = xyes; then : - # The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 -$as_echo_n "checking size of short... " >&6; } -if test "${ac_cv_sizeof_short+set}" = set; then : - $as_echo_n "(cached) " >&6 else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : -else - if test "$ac_cv_type_short" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (short) -See \`config.log' for more details." "$LINENO" 5; }; } - else - ac_cv_sizeof_short=0 - fi -fi +$as_echo "#define ISC_PLATFORM_NEEDPTON 1" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5 -$as_echo "$ac_cv_sizeof_short" >&6; } - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_SHORT $ac_cv_sizeof_short -_ACEOF - - - - # ---------------------------------------------------------------------- - # AC_CHECK_LIB for SVR4 libgen, and use it if it defines pathfind. - # ---------------------------------------------------------------------- - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pathfind in -lgen" >&5 -$as_echo_n "checking for pathfind in -lgen... " >&6; } -if test "${ac_cv_lib_gen_pathfind+set}" = set; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking struct sockaddr for sa_len" >&5 +$as_echo_n "checking struct sockaddr for sa_len... " >&6; } +if ${isc_cv_platform_havesalen+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgen $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pathfind (); + #include <sys/types.h> + #include <sys/socket.h> + int main () { -return pathfind (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gen_pathfind=yes -else - ac_cv_lib_gen_pathfind=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gen_pathfind" >&5 -$as_echo "$ac_cv_lib_gen_pathfind" >&6; } -if test "x$ac_cv_lib_gen_pathfind" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBGEN 1 -_ACEOF - - LIBS="-lgen $LIBS" - -fi - - for ac_func in vprintf -do : - ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf" -if test "x$ac_cv_func_vprintf" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_VPRINTF 1 -_ACEOF - -ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt" -if test "x$ac_cv_func__doprnt" = x""yes; then : - -$as_echo "#define HAVE_DOPRNT 1" >>confdefs.h - -fi - -fi -done + extern struct sockaddr *ps; + return ps->sa_len; - for ac_func in mmap canonicalize_file_name snprintf strdup strchr strrchr -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF -fi -done - - INVOKE_LIBOPTS_MACROS_FIRST_done=yes -fi - fi -# end of AC_DEFUN of LIBOPTS_CHECK - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC can handle #warning" >&5 -$as_echo_n "checking if $CC can handle #warning... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#warning foo ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_cpp_warning=yes + isc_cv_platform_havesalen=yes else - ac_cv_cpp_warning=no + isc_cv_platform_havesalen=no + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cpp_warning" >&5 -$as_echo "$ac_cv_cpp_warning" >&6; } -case "$ac_cv_cpp_warning" in - no) +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $isc_cv_platform_havesalen" >&5 +$as_echo "$isc_cv_platform_havesalen" >&6; } +case "$isc_cv_platform_havesalen" in + yes) -$as_echo "#define NO_OPTION_NAME_WARNINGS 1" >>confdefs.h +$as_echo "#define ISC_PLATFORM_HAVESALEN 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Enabling NO_OPTION_NAME_WARNINGS as #warning does not work" >&5 -$as_echo "Enabling NO_OPTION_NAME_WARNINGS as #warning does not work" >&6; } - ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 -$as_echo_n "checking for inline... " >&6; } -if test "${ac_cv_c_inline+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __cplusplus -typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } -#endif - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_inline=$ac_kw +# Check whether --enable-ipv6 was given. +if test "${enable_ipv6+set}" = set; then : + enableval=$enable_ipv6; fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_inline" != no && break -done -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 -$as_echo "$ac_cv_c_inline" >&6; } -case $ac_cv_c_inline in - inline | yes) ;; - *) - case $ac_cv_c_inline in - no) ac_val=;; - *) ac_val=$ac_cv_c_inline;; +case "$enable_ipv6" in + yes|''|autodetect) + case "$host" in + powerpc-ibm-aix4*) + ;; + *) + +$as_echo "#define WANT_IPV6 1" >>confdefs.h + + ;; esac - cat >>confdefs.h <<_ACEOF -#ifndef __cplusplus -#define inline $ac_val -#endif -_ACEOF + ;; + no) ;; esac -case "$ac_cv_c_inline" in - '') - ;; - *) - -$as_echo "#define HAVE_INLINE 1" >>confdefs.h +case "$host" in + *-*-darwin*) +$as_echo "#define __APPLE_USE_RFC_3542 1" >>confdefs.h esac -# Checks for libraries. - -# Checks for header files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for IPv6 structures" >&5 +$as_echo_n "checking for IPv6 structures... " >&6; } +if ${isc_cv_found_ipv6+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <float.h> + + #include <sys/types.h> + #include <sys/socket.h> + #include <netinet/in.h> int main () { + struct sockaddr_in6 sin6; + + ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes + isc_cv_found_ipv6=yes else - ac_cv_header_stdc=no + isc_cv_found_ipv6=no + fi rm -f core 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 confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <string.h> +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $isc_cv_found_ipv6" >&5 +$as_echo "$isc_cv_found_ipv6" >&6; } -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : +# +# See whether IPv6 support is provided via a Kame add-on. +# This is done before other IPv6 linking tests so LIBS is properly set. +# +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Kame IPv6 support" >&5 +$as_echo_n "checking for Kame IPv6 support... " >&6; } +# Check whether --with-kame was given. +if test "${with_kame+set}" = set; then : + withval=$with_kame; use_kame="$withval" else - ac_cv_header_stdc=no -fi -rm -f conftest* + use_kame="no" fi -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <stdlib.h> - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* +case "$use_kame" in + no) + ;; + yes) + kame_path=/usr/local/v6 + ;; + *) + kame_path="$use_kame" + ;; +esac +case "$use_kame" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + *) + if test -f $kame_path/lib/libinet6.a; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $kame_path/lib/libinet6.a" >&5 +$as_echo "$kame_path/lib/libinet6.a" >&6; } + LIBS="-L$kame_path/lib -linet6 $LIBS" + else + as_fn_error $? "$kame_path/lib/libinet6.a not found. -fi +Please choose the proper path with the following command: -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 : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <ctype.h> -#include <stdlib.h> -#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 + configure --with-kame=PATH +" "$LINENO" 5 + fi + ;; +esac -#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)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : +# +# Whether netinet6/in6.h is needed has to be defined in isc/platform.h. +# Including it on Kame-using platforms is very bad, though, because +# Kame uses #error against direct inclusion. So include it on only +# the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1. +# This is done before the in6_pktinfo check because that's what +# netinet6/in6.h is needed for. +# +case "$host" in + *-bsdi4.[01]*) -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi +$as_echo "#define ISC_PLATFORM_NEEDNETINET6IN6H 1" >>confdefs.h -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then + isc_netinet6in6_hack="#include <netinet6/in6.h>" + ;; + *) + isc_netinet6in6_hack="" + ;; +esac -$as_echo "#define STDC_HEADERS 1" >>confdefs.h +# +# This is similar to the netinet6/in6.h issue. +# +case "$host" in + *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*) -fi +$as_echo "#define ISC_PLATFORM_FIXIN6ISADDR 1" >>confdefs.h -for ac_header in arpa/inet.h fcntl.h float.h limits.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h syslog.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF + isc_netinetin6_hack="#include <netinet/in6.h>" + ;; + *) + isc_netinetin6_hack="" + ;; +esac -fi -done +case "$isc_cv_found_ipv6" in + yes) +$as_echo "#define ISC_PLATFORM_HAVEIPV6 1" >>confdefs.h -# Checks for typedefs, structures, and compiler characteristics. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 -$as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if test "${ac_cv_c_const+set}" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for in6_pktinfo" >&5 +$as_echo_n "checking for in6_pktinfo... " >&6; } +if ${isc_cv_have_in6_pktinfo+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ + #include <sys/types.h> + #include <sys/socket.h> + #include <netinet/in.h> + $isc_netinetin6_hack + $isc_netinet6in6_hack + int main () { -/* FIXME: Include the comments suggested by Paul. */ -#ifndef __cplusplus - /* Ultrix mips cc rejects this. */ - typedef int charset[2]; - const charset cs; - /* SunOS 4.1.1 cc rejects this. */ - char const *const *pcpcc; - char **ppc; - /* 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"; - pcpcc = &g + (g ? g-g : 0); - /* HPUX 7.0 cc rejects these. */ - ++pcpcc; - ppc = (char**) pcpcc; - pcpcc = (char const *const *) ppc; - { /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; - *t++ = 0; - if (s) return 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; - if (!foo) return 0; - } - return !cs[0] && !zero.x; -#endif + struct in6_pktinfo xyzzy; + ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_const=yes + isc_cv_have_in6_pktinfo=yes else - ac_cv_c_const=no + isc_cv_have_in6_pktinfo=no + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 -$as_echo "$ac_cv_c_const" >&6; } -if test $ac_cv_c_const = no; then - -$as_echo "#define const /**/" >>confdefs.h fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $isc_cv_have_in6_pktinfo" >&5 +$as_echo "$isc_cv_have_in6_pktinfo" >&6; } + case "$isc_cv_have_in6_pktinfo" in + yes) -ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = x""yes; then : - -else +$as_echo "#define ISC_PLATFORM_HAVEIN6PKTINFO 1" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int -_ACEOF + esac -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 -$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } -if test "${ac_cv_header_time+set}" = set; then : + # HMS: Use HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID instead? + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sockaddr_in6.sin6_scope_id" >&5 +$as_echo_n "checking for sockaddr_in6.sin6_scope_id... " >&6; } +if ${isc_cv_have_sin6_scope_id+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <sys/types.h> -#include <sys/time.h> -#include <time.h> + + #include <sys/types.h> + #include <sys/socket.h> + #include <netinet/in.h> + $isc_netinetin6_hack + $isc_netinet6in6_hack int main () { -if ((struct tm *) 0) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_time=yes -else - ac_cv_header_time=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 -$as_echo "$ac_cv_header_time" >&6; } -if test $ac_cv_header_time = yes; then - -$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h -fi + struct sockaddr_in6 xyzzy; + xyzzy.sin6_scope_id = 0; -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 -$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } -if test "${ac_cv_struct_tm+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <sys/types.h> -#include <time.h> -int -main () -{ -struct tm tm; - int *p = &tm.tm_sec; - return !p; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_struct_tm=time.h + isc_cv_have_sin6_scope_id=yes else - ac_cv_struct_tm=sys/time.h + isc_cv_have_sin6_scope_id=no + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5 -$as_echo "$ac_cv_struct_tm" >&6; } -if test $ac_cv_struct_tm = sys/time.h; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $isc_cv_have_sin6_scope_id" >&5 +$as_echo "$isc_cv_have_sin6_scope_id" >&6; } -$as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h + case "$isc_cv_have_sin6_scope_id" in + yes) -fi +$as_echo "#define ISC_PLATFORM_HAVESCOPEID 1" >>confdefs.h + + esac +esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ss_family field in struct sockaddr_storage" >&5 -$as_echo_n "checking for ss_family field in struct sockaddr_storage... " >&6; } -if test "${ac_cv_have_ss_family_in_struct_ss+set}" = set; then : +# We need this check run even without isc_cv_found_ipv6=yes + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for in6addr_any" >&5 +$as_echo_n "checking for in6addr_any... " >&6; } +if ${isc_cv_have_in6addr_any+:} false; then : $as_echo_n "(cached) " >&6 else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <sys/types.h> -#include <sys/socket.h> + #include <sys/types.h> + #include <sys/socket.h> + #include <netinet/in.h> + $isc_netinetin6_hack + $isc_netinet6in6_hack int main () { - struct sockaddr_storage s; s.ss_family = 1; + + struct in6_addr in6; + in6 = in6addr_any; + + ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_have_ss_family_in_struct_ss="yes" +if ac_fn_c_try_link "$LINENO"; then : + isc_cv_have_in6addr_any=yes else - ac_cv_have_ss_family_in_struct_ss="no" + isc_cv_have_in6addr_any=no + fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_ss_family_in_struct_ss" >&5 -$as_echo "$ac_cv_have_ss_family_in_struct_ss" >&6; } -case "$ac_cv_have_ss_family_in_struct_ss" in - yes) +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $isc_cv_have_in6addr_any" >&5 +$as_echo "$isc_cv_have_in6addr_any" >&6; } + +case "$isc_cv_have_in6addr_any" in + no) -$as_echo "#define HAVE_SS_FAMILY_IN_SS 1" >>confdefs.h +$as_echo "#define ISC_PLATFORM_NEEDIN6ADDRANY 1" >>confdefs.h - ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __ss_family field in struct sockaddr_storage" >&5 -$as_echo_n "checking for __ss_family field in struct sockaddr_storage... " >&6; } -if test "${ac_cv_have___ss_family_in_struct_ss+set}" = set; then : + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct if_laddrconf" >&5 +$as_echo_n "checking for struct if_laddrconf... " >&6; } +if ${isc_cv_struct_if_laddrconf+:} false; then : $as_echo_n "(cached) " >&6 else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <sys/types.h> -#include <sys/socket.h> + #include <sys/types.h> + #include <net/if6.h> int main () { - struct sockaddr_storage s; s.__ss_family = 1; + + struct if_laddrconf a; + + ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_have___ss_family_in_struct_ss="yes" + isc_cv_struct_if_laddrconf=yes else - ac_cv_have___ss_family_in_struct_ss="no" + isc_cv_struct_if_laddrconf=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have___ss_family_in_struct_ss" >&5 -$as_echo "$ac_cv_have___ss_family_in_struct_ss" >&6; } -case "$ac_cv_have___ss_family_in_struct_ss" in - yes) - -$as_echo "#define HAVE___SS_FAMILY_IN_SS 1" >>confdefs.h - - ;; -esac - -case "$ac_cv_have_ss_family_in_struct_ss$ac_cv_have___ss_family_in_struct_ss" in - noyes) - -cat >>confdefs.h <<_ACEOF -#define ss_family __ss_family -_ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $isc_cv_struct_if_laddrconf" >&5 +$as_echo "$isc_cv_struct_if_laddrconf" >&6; } +case "$isc_cv_struct_if_laddrconf" in + yes) -cat >>confdefs.h <<_ACEOF -#define ss_len __ss_len -_ACEOF +$as_echo "#define ISC_PLATFORM_HAVEIF_LADDRCONF 1" >>confdefs.h - ;; esac -# Checks for library functions. -#AC_FUNC_MEMCMP dnl HMS: we don't have a memcmp.c to use here, so why bother? -if test "${ac_cv_func_setvbuf_reversed+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_func_setvbuf_reversed=no -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 -$as_echo_n "checking return type of signal handlers... " >&6; } -if test "${ac_cv_type_signal+set}" = set; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct if_laddrreq" >&5 +$as_echo_n "checking for struct if_laddrreq... " >&6; } +if ${isc_cv_struct_if_laddrreq+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <sys/types.h> -#include <signal.h> + + #include <sys/types.h> + #include <net/if6.h> int main () { -return *(signal (0, 0)) (0) == 1; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_type_signal=int -else - ac_cv_type_signal=void -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 -$as_echo "$ac_cv_type_signal" >&6; } - -cat >>confdefs.h <<_ACEOF -#define RETSIGTYPE $ac_cv_type_signal -_ACEOF - - -for ac_func in alarm -do : - ac_fn_c_check_func "$LINENO" "alarm" "ac_cv_func_alarm" -if test "x$ac_cv_func_alarm" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_ALARM 1 -_ACEOF -fi -done + struct if_laddrreq a; -ac_fn_c_check_func "$LINENO" "gethostent" "ac_cv_func_gethostent" -if test "x$ac_cv_func_gethostent" = x""yes; then : -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostent" >&5 -$as_echo_n "checking for library containing gethostent... " >&6; } -if test "${ac_cv_search_gethostent+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gethostent (); -int -main () -{ -return gethostent (); ; return 0; } _ACEOF -for ac_lib in '' nsl; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib -lsocket $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_gethostent=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if test "${ac_cv_search_gethostent+set}" = set; then : - break -fi -done -if test "${ac_cv_search_gethostent+set}" = set; then : - +if ac_fn_c_try_compile "$LINENO"; then : + isc_cv_struct_if_laddrreq=yes else - ac_cv_search_gethostent=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostent" >&5 -$as_echo "$ac_cv_search_gethostent" >&6; } -ac_res=$ac_cv_search_gethostent -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi + isc_cv_struct_if_laddrreq=no fi - -for ac_func in gettimeofday inet_ntoa memset -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -done - -for ac_func in socket -do : - ac_fn_c_check_func "$LINENO" "socket" "ac_cv_func_socket" -if test "x$ac_cv_func_socket" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SOCKET 1 -_ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $isc_cv_struct_if_laddrreq" >&5 +$as_echo "$isc_cv_struct_if_laddrreq" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 -$as_echo_n "checking for library containing socket... " >&6; } -if test "${ac_cv_search_socket+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +case "$isc_cv_struct_if_laddrreq" in + yes) -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char socket (); -int -main () -{ -return socket (); - ; - return 0; -} -_ACEOF -for ac_lib in '' socket; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_socket=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if test "${ac_cv_search_socket+set}" = set; then : - break -fi -done -if test "${ac_cv_search_socket+set}" = set; then : +$as_echo "#define ISC_PLATFORM_HAVEIF_LADDRREQ 1" >>confdefs.h -else - ac_cv_search_socket=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5 -$as_echo "$ac_cv_search_socket" >&6; } -ac_res=$ac_cv_search_socket -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" +esac -fi -fi -done +### -for ac_func in sqrt -do : - ac_fn_c_check_func "$LINENO" "sqrt" "ac_cv_func_sqrt" -if test "x$ac_cv_func_sqrt" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SQRT 1 -_ACEOF +# Hacks +# these need work if we're to move libntp under sntp -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sqrt" >&5 -$as_echo_n "checking for library containing sqrt... " >&6; } -if test "${ac_cv_search_sqrt+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +$as_echo "#define HAVE_NO_NICE 1" >>confdefs.h -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char sqrt (); -int -main () -{ -return sqrt (); - ; - return 0; -} -_ACEOF -for ac_lib in '' m; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_sqrt=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if test "${ac_cv_search_sqrt+set}" = set; then : - break -fi -done -if test "${ac_cv_search_sqrt+set}" = set; then : -else - ac_cv_search_sqrt=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sqrt" >&5 -$as_echo "$ac_cv_search_sqrt" >&6; } -ac_res=$ac_cv_search_sqrt -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" +$as_echo "#define HAVE_TERMIOS 1" >>confdefs.h -fi -fi -done - -for ac_func in strrchr +# Checks for library functions. +for ac_func in socket vsnprintf vsprintf do : - ac_fn_c_check_func "$LINENO" "strrchr" "ac_cv_func_strrchr" -if test "x$ac_cv_func_strrchr" = x""yes; then : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF -#define HAVE_STRRCHR 1 +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done -case "$host" in - *-*-hpux10.*) # at least for hppa2.0-hp-hpux10.20 - case "$GCC" in - yes) - ;; - *) CFLAGS="$CFLAGS -Wp,-H18816" - ;; - esac - ;; - *-*-linux*) - CFLAGS="$CFLAGS -DADJTIME_MISSING" - ;; - *-*-sunos*) - CFLAGS="$CFLAGS -DNONBLOCK_BROKEN" - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bin subdirectory" >&5 $as_echo_n "checking for bin subdirectory... " >&6; } @@ -15373,8 +16104,8 @@ if test "${with_binsubdir+set}" = set; then : withval=$with_binsubdir; use_binsubdir="$withval" else use_binsubdir="bin" -fi +fi case "$use_binsubdir" in bin) @@ -15382,13 +16113,22 @@ case "$use_binsubdir" in sbin) ;; *) - as_fn_error "<$use_binsubdir> is illegal - must be \"bin\" or \"sbin\"" "$LINENO" 5 + as_fn_error $? "<$use_binsubdir> is illegal - must be \"bin\" or \"sbin\"" "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_binsubdir" >&5 $as_echo "$use_binsubdir" >&6; } + BINSUBDIR=$use_binsubdir + if test "bin" = "$BINSUBDIR"; then + NTP_BINSUBDIR_IS_BIN_TRUE= + NTP_BINSUBDIR_IS_BIN_FALSE='#' +else + NTP_BINSUBDIR_IS_BIN_TRUE='#' + NTP_BINSUBDIR_IS_BIN_FALSE= +fi + ac_config_files="$ac_config_files Makefile" @@ -15456,10 +16196,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && + if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} @@ -15475,6 +16226,7 @@ DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= +U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' @@ -15498,23 +16250,27 @@ else fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error "conditional \"AMDEP\" was never defined. + as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error "conditional \"am__fastdepCC\" was never defined. + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${INSTALL_LIBOPTS_TRUE}" && test -z "${INSTALL_LIBOPTS_FALSE}"; then - as_fn_error "conditional \"INSTALL_LIBOPTS\" was never defined. + as_fn_error $? "conditional \"INSTALL_LIBOPTS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${NEED_LIBOPTS_TRUE}" && test -z "${NEED_LIBOPTS_FALSE}"; then - as_fn_error "conditional \"NEED_LIBOPTS\" was never defined. + as_fn_error $? "conditional \"NEED_LIBOPTS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${NTP_BINSUBDIR_IS_BIN_TRUE}" && test -z "${NTP_BINSUBDIR_IS_BIN_FALSE}"; then + as_fn_error $? "conditional \"NTP_BINSUBDIR_IS_BIN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -: ${CONFIG_STATUS=./config.status} +: "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" @@ -15615,6 +16371,7 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -15660,19 +16417,19 @@ export LANGUAGE (unset CDPATH) >/dev/null 2>&1 && unset CDPATH -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. +# script with STATUS, using 1 if that was 0. as_fn_error () { - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $1" >&2 + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -15868,7 +16625,7 @@ $as_echo X"$as_dir" | test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p @@ -15921,8 +16678,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by $as_me, which was -generated by GNU Autoconf 2.65. Invocation command line was +This file was extended by sntp $as_me 4.2.6p5, which was +generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -15987,11 +16744,11 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.65, +sntp config.status 4.2.6p5 +configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" -Copyright (C) 2009 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -16009,11 +16766,16 @@ 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=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; *) ac_option=$1 ac_optarg=$2 @@ -16035,6 +16797,7 @@ do $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; @@ -16047,7 +16810,7 @@ do ac_need_defaults=false;; --he | --h) # Conflict between --help and --header - as_fn_error "ambiguous option: \`$1' + as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; @@ -16056,7 +16819,7 @@ Try \`$0 --help' for more information.";; ac_cs_silent=: ;; # This is an error. - -*) as_fn_error "unrecognized option: \`$1' + -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" @@ -16102,6 +16865,283 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' +macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' +macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' +pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' +ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' +host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' +host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' +host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' +build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' +build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' +build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' +SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' +Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' +GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' +EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' +FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' +LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' +NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' +LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' +ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' +exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' +lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' +lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' +reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' +file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' +want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' +DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' +sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' +AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' +archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' +STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' +RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' +lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' +CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' +compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' +GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' +nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' +lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' +objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' +need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' +MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' +LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' +OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' +libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' +module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' +postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' +need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' +version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' +runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' +libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' +soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' +install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' +finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' +old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' +striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in SHELL \ +ECHO \ +SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +OBJDUMP \ +deplibs_check_method \ +file_magic_cmd \ +file_magic_glob \ +want_nocaseglob \ +DLLTOOL \ +sharedlib_from_linklib_cmd \ +AR \ +AR_FLAGS \ +archiver_list_spec \ +STRIP \ +RANLIB \ +CC \ +CFLAGS \ +compiler \ +lt_cv_sys_global_symbol_pipe \ +lt_cv_sys_global_symbol_to_cdecl \ +lt_cv_sys_global_symbol_to_c_name_address \ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +nm_file_list_spec \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_pic \ +lt_prog_compiler_wl \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +MANIFEST_TOOL \ +DSYMUTIL \ +NMEDIT \ +LIPO \ +OTOOL \ +OTOOL64 \ +shrext_cmds \ +export_dynamic_flag_spec \ +whole_archive_flag_spec \ +compiler_needs_object \ +with_gnu_ld \ +allow_undefined_flag \ +no_undefined_flag \ +hardcode_libdir_flag_spec \ +hardcode_libdir_flag_spec_ld \ +hardcode_libdir_separator \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +install_override_mode \ +finish_eval \ +old_striplib \ +striplib; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in reload_cmds \ +old_postinstall_cmds \ +old_postuninstall_cmds \ +old_archive_cmds \ +extract_expsyms_cmds \ +old_archive_from_new_cmds \ +old_archive_from_expsyms_cmds \ +archive_cmds \ +archive_expsym_cmds \ +module_cmds \ +module_expsym_cmds \ +export_symbols_cmds \ +prelink_cmds \ +postlink_cmds \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +sys_lib_dlsearch_path_spec; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +ac_aux_dir='$ac_aux_dir' +xsi_shell='$xsi_shell' +lt_shell_append='$lt_shell_append' + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + + + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile' + + + + _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 @@ -16113,9 +17153,10 @@ do "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libopts/Makefile") CONFIG_FILES="$CONFIG_FILES libopts/Makefile" ;; + "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -16138,9 +17179,10 @@ fi # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= + tmp= ac_tmp= trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } @@ -16148,12 +17190,13 @@ $debug || { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" + test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") -} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -16170,12 +17213,12 @@ if test "x$ac_cr" = x; then fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\r' + ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi -echo 'BEGIN {' >"$tmp/subs1.awk" && +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF @@ -16184,18 +17227,18 @@ _ACEOF echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -16203,7 +17246,7 @@ done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h @@ -16251,7 +17294,7 @@ t delim rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" @@ -16283,21 +17326,29 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat -fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || as_fn_error "could not setup config files machinery" "$LINENO" 5 +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries 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[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// s/^[^=]*=[ ]*$// }' fi @@ -16309,7 +17360,7 @@ fi # test -n "$CONFIG_FILES" # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then -cat >"$tmp/defines.awk" <<\_ACAWK || +cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF @@ -16321,11 +17372,11 @@ _ACEOF # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do - ac_t=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_t"; then + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then break elif $ac_last_try; then - as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -16410,7 +17461,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error "could not setup config headers machinery" "$LINENO" 5 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" @@ -16423,7 +17474,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -16442,7 +17493,7 @@ do for ac_f do case $ac_f in - -) ac_f="$tmp/stdin";; + -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -16451,7 +17502,7 @@ do [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -16477,8 +17528,8 @@ $as_echo "$as_me: creating $ac_file" >&6;} esac case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -16614,23 +17665,24 @@ s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 +which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} +which seems to be undefined. Please make sure it is defined" >&2;} - rm -f "$tmp/stdin" + rm -f "$ac_tmp/stdin" case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # @@ -16639,21 +17691,21 @@ which seems to be undefined. Please make sure it is defined." >&2;} if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" - } >"$tmp/config.h" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" - mv "$tmp/config.h" "$ac_file" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error "could not create -" "$LINENO" 5 + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" @@ -16793,6 +17845,637 @@ $as_echo X"$file" | done } ;; + "libtool":C) + + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, +# Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool 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. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +# The names of the tagged configurations supported by this script. +available_tags="" + +# ### BEGIN LIBTOOL CONFIG + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that protects backslashes. +ECHO=$lt_ECHO + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="\$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP=$lt_GREP + +# An ERE matcher. +EGREP=$lt_EGREP + +# A literal string matcher. +FGREP=$lt_FGREP + +# A BSD- or MS-compatible name lister. +NM=$lt_NM + +# Whether we need soft or hard links. +LN_S=$lt_LN_S + +# What is the maximum length of a command? +max_cmd_len=$max_cmd_len + +# Object file suffix (normally "o"). +objext=$ac_objext + +# Executable file suffix (normally ""). +exeext=$exeext + +# whether the shell understands "unset". +lt_unset=$lt_unset + +# turn spaces into newlines. +SP2NL=$lt_lt_SP2NL + +# turn newlines into spaces. +NL2SP=$lt_lt_NL2SP + +# convert \$build file names to \$host format. +to_host_file_cmd=$lt_cv_to_host_file_cmd + +# convert \$build files to toolchain format. +to_tool_file_cmd=$lt_cv_to_tool_file_cmd + +# An object symbol dumper. +OBJDUMP=$lt_OBJDUMP + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method = "file_magic". +file_magic_cmd=$lt_file_magic_cmd + +# How to find potential files when deplibs_check_method = "file_magic". +file_magic_glob=$lt_file_magic_glob + +# Find potential files using nocaseglob when deplibs_check_method = "file_magic". +want_nocaseglob=$lt_want_nocaseglob + +# DLL creation program. +DLLTOOL=$lt_DLLTOOL + +# Command to associate shared and link libraries. +sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd + +# The archiver. +AR=$lt_AR + +# Flags to create an archive. +AR_FLAGS=$lt_AR_FLAGS + +# How to feed a file listing to the archiver. +archiver_list_spec=$lt_archiver_list_spec + +# A symbol stripping program. +STRIP=$lt_STRIP + +# Commands used to install an old-style archive. +RANLIB=$lt_RANLIB +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Whether to use a lock for old archive extraction. +lock_old_archive_extraction=$lock_old_archive_extraction + +# A C compiler. +LTCC=$lt_CC + +# LTCC compiler flags. +LTCFLAGS=$lt_CFLAGS + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix + +# Specify filename containing input files for \$NM. +nm_file_list_spec=$lt_nm_file_list_spec + +# The root where to search for dependent libraries,and in which our libraries should be installed. +lt_sysroot=$lt_sysroot + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=$MAGIC_CMD + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Manifest tool. +MANIFEST_TOOL=$lt_MANIFEST_TOOL + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL=$lt_DSYMUTIL + +# Tool to change global to local symbols on Mac OS X. +NMEDIT=$lt_NMEDIT + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO=$lt_LIPO + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL=$lt_OTOOL + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64=$lt_OTOOL64 + +# Old archive suffix (normally "a"). +libext=$libext + +# Shared library suffix (normally ".so"). +shrext_cmds=$lt_shrext_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink=$lt_variables_saved_for_relink + +# Do we need the "lib" prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Library versioning type. +version_type=$version_type + +# Shared library runtime path variable. +runpath_var=$runpath_var + +# Shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Permission mode override for installation of shared libraries. +install_override_mode=$lt_install_override_mode + +# Command to use after installation of a shared archive. +postinstall_cmds=$lt_postinstall_cmds + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval=$lt_finish_eval + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Compile-time system search path for libraries. +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + + +# The linker used to build libraries. +LD=$lt_LD + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds + +# A language specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU compiler? +with_gcc=$GCC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# If ld is used when linking, flag to hardcode \$libdir into a binary +# during linking. This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + +ltmain="$ac_aux_dir/ltmain.sh" + + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + if test x"$xsi_shell" = xyes; then + sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ +func_dirname ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_basename ()$/,/^} # func_basename /c\ +func_basename ()\ +{\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ +func_dirname_and_basename ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ +func_stripname ()\ +{\ +\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ +\ # positional parameters, so assign one to ordinary parameter first.\ +\ func_stripname_result=${3}\ +\ func_stripname_result=${func_stripname_result#"${1}"}\ +\ func_stripname_result=${func_stripname_result%"${2}"}\ +} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ +func_split_long_opt ()\ +{\ +\ func_split_long_opt_name=${1%%=*}\ +\ func_split_long_opt_arg=${1#*=}\ +} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ +func_split_short_opt ()\ +{\ +\ func_split_short_opt_arg=${1#??}\ +\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ +} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ +func_lo2o ()\ +{\ +\ case ${1} in\ +\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ +\ *) func_lo2o_result=${1} ;;\ +\ esac\ +} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_xform ()$/,/^} # func_xform /c\ +func_xform ()\ +{\ + func_xform_result=${1%.*}.lo\ +} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_arith ()$/,/^} # func_arith /c\ +func_arith ()\ +{\ + func_arith_result=$(( $* ))\ +} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_len ()$/,/^} # func_len /c\ +func_len ()\ +{\ + func_len_result=${#1}\ +} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + +fi + +if test x"$lt_shell_append" = xyes; then + sed -e '/^func_append ()$/,/^} # func_append /c\ +func_append ()\ +{\ + eval "${1}+=\\${2}"\ +} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ +func_append_quoted ()\ +{\ +\ func_quote_for_eval "${2}"\ +\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ +} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 +$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} +fi + + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + ;; esac done # for ac_tag @@ -16803,7 +18486,7 @@ _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || - as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. @@ -16824,7 +18507,7 @@ if test "$no_create" != yes; then 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 || as_fn_exit $? + $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 diff --git a/sntp/configure.ac b/sntp/configure.ac index be6943f..63db09d 100644 --- a/sntp/configure.ac +++ b/sntp/configure.ac @@ -1,21 +1,130 @@ +# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_INIT(main.c) -AM_INIT_AUTOMAKE([msntp],[1.6]) -AC_CONFIG_SRCDIR([header.h]) +m4_include([../version.m4]) +AC_PREREQ([2.61]) +AC_INIT([sntp], [VERSION_NUMBER]) +AC_CONFIG_MACRO_DIR([../m4]) +AC_CONFIG_AUX_DIR([.]) + +# Increment sntp_configure_cache_version by one for each change to +# configure.ac or .m4 files which invalidates cached values from +# previous versions. +# +# If the change affects cache variables used only by the main NTP +# configure.ac, then only its version number should be bumped, while +# the subdir configure.ac version numbers should be unchanged. The +# same is true for a test/variable that is used only by one subdir +# being changed incompatibly; only that subdir's cache version needs +# bumping. +# +# If a change affects variables shared by all NTP configure scripts, +# please bump the version numbers of all three. If you are not sure, +# the safe choice is to bump all three on any cache-invalidating change. +# +# In order to avoid the risk of version stamp collision between -stable +# and -dev branches, do not simply increment the version, instead use +# the date YYYYMMDD optionally with -HHMM if there is more than one +# bump in a day. + +sntp_configure_cache_version=20091117 + +# When the version of config.cache and configure do not +# match, NTP_CACHEVERSION will flush the cache. + +NTP_CACHEVERSION([sntp], [$sntp_configure_cache_version]) + +AM_INIT_AUTOMAKE +AC_CANONICAL_BUILD AC_CANONICAL_HOST -AM_CONFIG_HEADER(config.h) +dnl the 'build' machine is where we run configure and compile +dnl the 'host' machine is where the resulting stuff runs. +AC_DEFINE_UNQUOTED([STR_SYSTEM], "$host", [canonical system (cpu-vendor-os) of where we should run]) +AC_CONFIG_HEADER([config.h]) +dnl AC_ARG_PROGRAM # Checks for programs. -AC_PROG_CC +AM_PROG_CC_C_O +AC_PROG_CPP -# So far, the only shared library we might use is libopts. -# It's a small library - we might as well use a static version of it. -AC_DISABLE_SHARED +# AC_PROG_CC_STDC has two functions. It attempts to find a compiler +# capable of C99, or failing that, for C89. CC is set afterward with +# the selected invocation, such as "gcc --std=gnu99". Also, the +# ac_cv_prog_cc_stdc variable is no if the compiler selected for CC +# does not accept C89. -m4_defun([_LT_AC_LANG_CXX_CONFIG], [:]) -m4_defun([_LT_AC_LANG_F77_CONFIG], [:]) +AC_PROG_CC_STDC -AC_PROG_LIBTOOL +case "$ac_cv_prog_cc_stdc" in + no) + AC_MSG_WARN([ANSI C89/ISO C90 is the minimum to compile SNTP ] + [version 4.2.5 and higher.]) +esac + +AC_CACHE_CHECK( + [if $CC can handle @%:@warning], + [ntp_cv_cpp_warning], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[]], [[#warning foo]])], + [ntp_cv_cpp_warning=yes], + [ntp_cv_cpp_warning=no] + )] +) +case "$ntp_cv_cpp_warning" in + no) + AC_DEFINE([NO_OPTION_NAME_WARNINGS], [1], + [Should we avoid @%:@warning on option name collisions?]) +esac + +case "$GCC" in + yes) + SAVED_CFLAGS_NTP="$CFLAGS" + CFLAGS="$CFLAGS -Wstrict-overflow" + AC_CACHE_CHECK( + [if $CC can handle -Wstrict-overflow], + [ntp_cv_gcc_Wstrict_overflow], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[]], [[]])], + [ntp_cv_gcc_Wstrict_overflow=yes], + [ntp_cv_gcc_Wstrict_overflow=no] + ) ] + ) + # + # $ntp_cv_gcc_Wstrict_overflow is tested later to add the + # flag to CFLAGS. + # + CFLAGS="$SAVED_CFLAGS_NTP -Winit-self" + AC_CACHE_CHECK( + [if $CC can handle -Winit-self], + [ntp_cv_gcc_Winit_self], + [ + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[]], [[]])], + [ntp_cv_gcc_Winit_self=yes], + [ntp_cv_gcc_Winit_self=no] + ) + ] + ) + CFLAGS="$SAVED_CFLAGS_NTP" + AS_UNSET([SAVED_CFLAGS_NTP]) + # + # $ntp_cv_gcc_Winit_self is tested later to add the + # flag to CFLAGS. + # +esac + +# HMS: These need to be moved to AM_CPPFLAGS and/or AM_CFLAGS +case "$host" in + *-*-solaris*) + # see "man standards". + # -D_XOPEN_SOURCE=500 is probably OK for c89 and before + # -D_XOPEN_SOURCE=600 seems OK for c99 + #CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500 -D__EXTENSIONS__" + CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__" + libxnet=-lxnet + ;; +esac + +AC_DISABLE_SHARED # NTP has (so far) been relying on leading-edge autogen. # Therefore, by default: @@ -32,17 +141,104 @@ case "${enable_libopts_install+set}" in esac LIBOPTS_CHECK -AC_MSG_CHECKING([[if $CC can handle #warning]]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[#warning foo]])],[ac_cv_cpp_warning=yes],[ac_cv_cpp_warning=no]) -AC_MSG_RESULT([$ac_cv_cpp_warning]) +AC_PROG_LIBTOOL +NTP_DIR_SEP -case "$ac_cv_cpp_warning" in - no) - AC_DEFINE([NO_OPTION_NAME_WARNINGS], [1], [Should we avoid #warning on option name collisions?]) - AC_MSG_RESULT([[Enabling NO_OPTION_NAME_WARNINGS as #warning does not work]]) +# Checks for libraries. +NTP_LIB_M + +case "$GCC" in + yes) + CFLAGS="$CFLAGS -Wall" + # CFLAGS="$CFLAGS -Wcast-align" + CFLAGS="$CFLAGS -Wcast-qual" + # CFLAGS="$CFLAGS -Wconversion" + # CFLAGS="$CFLAGS -Werror" + # CFLAGS="$CFLAGS -Wextra" + # CFLAGS="$CFLAGS -Wfloat-equal" + CFLAGS="$CFLAGS -Wmissing-prototypes" + CFLAGS="$CFLAGS -Wpointer-arith" + CFLAGS="$CFLAGS -Wshadow" + # CFLAGS="$CFLAGS -Wtraditional" + # CFLAGS="$CFLAGS -Wwrite-strings" + case "$ntp_cv_gcc_Winit_self" in + yes) + CFLAGS="$CFLAGS -Winit-self" + esac + case "$ntp_cv_gcc_Wstrict_overflow" in + yes) + CFLAGS="$CFLAGS -Wstrict-overflow" + esac + # -W[no-]strict-prototypes is added later depending on OpenSSL +esac + +AC_CHECK_FUNC([gethostent], , + [AC_SEARCH_LIBS([gethostent], [nsl], , , [$libxnet -lsocket])]) +AC_CHECK_FUNC([openlog], , + [AC_SEARCH_LIBS([openlog], [gen], , + [AC_SEARCH_LIBS([openlog], [syslog], , , [$libxnet -lsocket])])]) + +AC_SEARCH_LIBS([setsockopt], [socket xnet]) + +# Checks for header files. +AC_HEADER_STDC + +dnl HP-UX 11.31 on HPPA has a net/if.h that can't be compiled with gcc4 +dnl due to an incomplete type (a union) mpinfou used in an array. gcc3 +dnl compiles it without complaint. The mpinfou union is defined later +dnl in the resulting preprocessed source than the spu_info array in +dnl /usr/include/machine/sys/getppdp.h: +dnl extern union mpinfou spu_info[]; +dnl triggering the error. Our strategy is on HP-UX only, test for +dnl net/netmp.h, which is the file included by net/if.h that leads to +dnl getppdp.h. If it is present but can't be compiled, try adding +dnl a duplicate definition of mpinfou, which should then allow the +dnl following net/if.h and net/if6.h tests to proceed normally. +dnl Using net/netmp.h allows us to avoid polluting test results for +dnl net/if.h. +# +case "$host" in + *-hp-hpux*) + AC_CHECK_HEADERS( + [net/netmp.h], + [netmp_h_works=yes], + [netmp_h_works=no] + ) + case "$netmp_h_works" in + no) + cat >>confdefs.h <<_ACEOF +#ifndef MPINFOU_PREDECLARED +# define MPINFOU_PREDECLARED +typedef union mpinfou { /* For lint */ + struct pdk_mpinfo *pdkptr; + struct mpinfo *pikptr; +} mpinfou_t; +#endif +_ACEOF + AH_BOTTOM([ +#ifndef MPINFOU_PREDECLARED +# define MPINFOU_PREDECLARED +typedef union mpinfou { /* For lint */ + struct pdk_mpinfo *pdkptr; + struct mpinfo *pikptr; +} mpinfou_t; +#endif +]) + ;; + esac ;; esac +AC_CHECK_HEADERS([netdb.h netinet/in.h stdlib.h string.h strings.h syslog.h]) +AC_CHECK_HEADERS([sys/socket.h sys/time.h]) +AC_HEADER_TIME + +# Checks for typedefs, structures, and compiler characteristics. +AC_HEADER_STDBOOL +AC_C_CONST +AC_TYPE_SIZE_T +AC_CHECK_SIZEOF([time_t]) + AC_C_INLINE case "$ac_cv_c_inline" in @@ -53,95 +249,639 @@ case "$ac_cv_c_inline" in AC_SUBST(HAVE_INLINE) esac +AC_C_CHAR_UNSIGNED dnl CROSS_COMPILE? +AC_CHECK_SIZEOF([signed char]) +AC_CHECK_SIZEOF([int]) +AC_CHECK_SIZEOF([long]) -# Checks for libraries. +AC_CHECK_TYPES([s_char]) +case "$ac_cv_c_char_unsigned$ac_cv_sizeof_signed_char$ac_cv_type_s_char" in + *yes) + # We have a typedef for s_char. Might as well believe it... + ;; + no0no) + # We have signed chars, can't say 'signed char', no s_char typedef. + AC_DEFINE([NEED_S_CHAR_TYPEDEF], 1, [Do we need an s_char typedef?]) + ;; + no1no) + # We have signed chars, can say 'signed char', no s_char typedef. + AC_DEFINE([NEED_S_CHAR_TYPEDEF]) + ;; + yes0no) + # We have unsigned chars, can't say 'signed char', no s_char typedef. + AC_MSG_ERROR([No way to specify a signed character!]) + ;; + yes1no) + # We have unsigned chars, can say 'signed char', no s_char typedef. + AC_DEFINE([NEED_S_CHAR_TYPEDEF]) + ;; +esac +AC_TYPE_UID_T -# Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h limits.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h syslog.h unistd.h]) +NTP_OPENSSL -# Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_TYPE_SIZE_T -AC_HEADER_TIME -AC_STRUCT_TM - -AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage], - ac_cv_have_ss_family_in_struct_ss, [ - AC_TRY_COMPILE( - [ -#include <sys/types.h> -#include <sys/socket.h> - ], - [ struct sockaddr_storage s; s.ss_family = 1; ], - [ ac_cv_have_ss_family_in_struct_ss="yes" ], - [ ac_cv_have_ss_family_in_struct_ss="no" ], - ) -]) -case "$ac_cv_have_ss_family_in_struct_ss" in +AC_CACHE_CHECK( + [type of socklen arg for getsockname()], + [ntp_cv_getsockname_socklen_type], + [ + getsockname_socklen_type_found=no + for getsockname_arg2 in 'struct sockaddr *' 'void *'; do + for ntp_cv_getsockname_socklen_type in 'socklen_t' 'size_t' 'unsigned int' 'int'; do + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #ifdef HAVE_SYS_TYPES_H + # include <sys/types.h> + #endif + #ifdef HAVE_SYS_SOCKET_H + # include <sys/socket.h> + #endif + ]], [[ + extern + getsockname(int, $getsockname_arg2, + $ntp_cv_getsockname_socklen_type *); + ]] + )], + [getsockname_socklen_type_found=yes ; break 2], + [] + ) + done + done + case "$getsockname_socklen_type_found" in + no) + ntp_cv_getsockname_socklen_type='socklen_t' + esac + AS_UNSET([getsockname_arg2]) + AS_UNSET([getsockname_socklen_type_found]) + ] +) +AC_DEFINE_UNQUOTED([GETSOCKNAME_SOCKLEN_TYPE], + $ntp_cv_getsockname_socklen_type, + [What is getsockname()'s socklen type?]) + +AC_CACHE_CHECK( + [for struct sockaddr_storage], + [ntp_cv_sockaddr_storage], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #ifdef HAVE_SYS_TYPES_H + # include <sys/types.h> + #endif + #ifdef HAVE_SYS_SOCKET_H + # include <sys/socket.h> + #endif + #ifdef HAVE_NETINET_IN_H + # include <netinet/in.h> + #endif + ]], + [[ + struct sockaddr_storage n; + ]] + )], + [ntp_cv_sockaddr_storage=yes], + [ntp_cv_sockaddr_storage=no] + )] +) +case "$ntp_cv_sockaddr_storage" in yes) - AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Does struct sockaddr_storage have ss_family?]) - ;; + AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1], + [Does a system header define struct sockaddr_storage?]) esac -AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage], - ac_cv_have___ss_family_in_struct_ss, [ - AC_TRY_COMPILE( - [ -#include <sys/types.h> -#include <sys/socket.h> - ], - [ struct sockaddr_storage s; s.__ss_family = 1; ], - [ ac_cv_have___ss_family_in_struct_ss="yes" ], - [ ac_cv_have___ss_family_in_struct_ss="no" ] - ) -]) -case "$ac_cv_have___ss_family_in_struct_ss" in +AC_CACHE_CHECK( + [for sockaddr_storage.ss_family], + [ntp_cv_have_ss_family], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #ifdef HAVE_SYS_TYPES_H + # include <sys/types.h> + #endif + #ifdef HAVE_SYS_SOCKET_H + # include <sys/socket.h> + #endif + #ifdef HAVE_NETINET_IN_H + # include <netinet/in.h> + #endif + ]], + [[ + struct sockaddr_storage s; + s.ss_family = 1; + ]] + )], + [ntp_cv_have_ss_family=yes], + [ntp_cv_have_ss_family=no] + )] +) + +case "$ntp_cv_have_ss_family" in + no) + AC_CACHE_CHECK( + [for sockaddr_storage.__ss_family], + [ntp_cv_have___ss_family], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #ifdef HAVE_SYS_TYPES_H + # include <sys/types.h> + #endif + #ifdef HAVE_SYS_SOCKET_H + # include <sys/socket.h> + #endif + #ifdef HAVE_NETINET_IN_H + # include <netinet/in.h> + #endif + ]], + [[ + struct sockaddr_storage s; + s.__ss_family = 1; + ]] + )], + [ntp_cv_have___ss_family=yes], + [ntp_cv_have___ss_family=no] + )] + ) + case "$ntp_cv_have___ss_family" in + yes) + AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1], + [Does struct sockaddr_storage have __ss_family?]) + esac +esac + +AH_VERBATIM( + [HAVE___SS_FAMILY_IN_SS_VERBATIM], + [ + /* Handle sockaddr_storage.__ss_family */ + #ifdef HAVE___SS_FAMILY_IN_SS + # define ss_family __ss_family + #endif /* HAVE___SS_FAMILY_IN_SS */ + ] +) + +AC_CACHE_CHECK( + [for sockaddr_storage.ss_len], + [ntp_cv_have_ss_len], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #ifdef HAVE_SYS_TYPES_H + # include <sys/types.h> + #endif + #ifdef HAVE_SYS_SOCKET_H + # include <sys/socket.h> + #endif + #ifdef HAVE_NETINET_IN_H + # include <netinet/in.h> + #endif + ]], + [[ + struct sockaddr_storage s; + s.ss_len = 1; + ]] + )], + [ntp_cv_have_ss_len=yes], + [ntp_cv_have_ss_len=no] + )] +) + +case "$ntp_cv_have_ss_len" in + no) + AC_CACHE_CHECK( + [for sockaddr_storage.__ss_len], + [ntp_cv_have___ss_len], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #ifdef HAVE_SYS_TYPES_H + # include <sys/types.h> + #endif + #ifdef HAVE_SYS_SOCKET_H + # include <sys/socket.h> + #endif + #ifdef HAVE_NETINET_IN_H + # include <netinet/in.h> + #endif + ]], + [[ + struct sockaddr_storage s; + s.__ss_len = 1; + ]] + )], + [ntp_cv_have___ss_len=yes], + [ntp_cv_have___ss_len=no] + )] + ) + case "$ntp_cv_have___ss_len" in + yes) + AC_DEFINE([HAVE___SS_LEN_IN_SS], [1], + [Does struct sockaddr_storage have __ss_len?]) + esac +esac + +AH_VERBATIM( + [HAVE___SS_LEN_IN_SS_VERBATIM], + [ + /* Handle sockaddr_storage.__ss_len */ + #ifdef HAVE___SS_LEN_IN_SS + # define ss_len __ss_len + #endif /* HAVE___SS_LEN_IN_SS */ + ] +) + +# +# Look for in_port_t. +# +AC_CACHE_CHECK( + [for in_port_t], + [isc_cv_have_in_port_t], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include <sys/types.h> + #include <netinet/in.h> + ]], + [[ + in_port_t port = 25; + return (0); + ]] + )], + [isc_cv_have_in_port_t=yes], + [isc_cv_have_in_port_t=no] + )] +) +case "$isc_cv_have_in_port_t" in + no) + AC_DEFINE([ISC_PLATFORM_NEEDPORTT], [1], + [Declare in_port_t?]) +esac + +AC_CACHE_CHECK( + [for multicast IP support], + [ntp_cv_multicast], + [ + ntp_cv_multicast=no + case "$host" in + i386-sequent-sysv4) + ;; + *) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #ifdef HAVE_NETINET_IN_H + #include <netinet/in.h> + #endif + ]], + [[ + struct ip_mreq ipmr; + ipmr.imr_interface.s_addr = 0; + ]] + )], + [ntp_cv_multicast=yes], + [] + ) + esac + ] +) +case "$ntp_cv_multicast" in yes) - AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1, [Does struct sockaddr_storage have __ss_family?]) - ;; + AC_DEFINE([MCAST], [1], [Does the target support multicast IP?]) + AC_CACHE_CHECK( + [arg type needed for setsockopt() IP*_MULTICAST_LOOP], + [ntp_cv_typeof_ip_multicast_loop], + [ + case "$host" in + *-*-netbsd*|*-*-*linux*) + ntp_cv_typeof_ip_multicast_loop=u_int + ;; + *) + ntp_cv_typeof_ip_multicast_loop=u_char + esac + ] + ) + AC_DEFINE_UNQUOTED([TYPEOF_IP_MULTICAST_LOOP], + $ntp_cv_typeof_ip_multicast_loop, + [What type to use for setsockopt]) esac -case "$ac_cv_have_ss_family_in_struct_ss$ac_cv_have___ss_family_in_struct_ss" in - noyes) - AC_DEFINE_UNQUOTED([ss_family], [__ss_family], [normalize ss_family access]) - AC_DEFINE_UNQUOTED([ss_len], [__ss_len], [normalize ss_len access]) - ;; +# HMS: We don't need res_init, but since we may be using cached +# values from ntpd we need to test the same way +AC_SEARCH_LIBS([res_init], [resolv], , , [-lsocket -lnsl]) +AC_SEARCH_LIBS([inet_ntop], [resolv], , , [-lsocket -lnsl]) +AC_CHECK_FUNC([inet_ntop], [], + [AC_DEFINE([ISC_PLATFORM_NEEDNTOP], [1], [ISC: provide inet_ntop()])]) +AC_CHECK_FUNC([inet_pton], [], + [AC_DEFINE([ISC_PLATFORM_NEEDPTON], [1], [ISC: provide inet_pton()])]) + +AC_CACHE_CHECK( + [struct sockaddr for sa_len], + [isc_cv_platform_havesalen], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include <sys/types.h> + #include <sys/socket.h> + ]], + [[ + extern struct sockaddr *ps; + return ps->sa_len; + ]] + )], + [isc_cv_platform_havesalen=yes], + [isc_cv_platform_havesalen=no] + )] +) +case "$isc_cv_platform_havesalen" in + yes) + AC_DEFINE([ISC_PLATFORM_HAVESALEN], [1], + [struct sockaddr has sa_len?]) esac -# Checks for library functions. -#AC_FUNC_MEMCMP dnl HMS: we don't have a memcmp.c to use here, so why bother? -AC_FUNC_SETVBUF_REVERSED -AC_TYPE_SIGNAL -AC_CHECK_FUNCS([alarm]) -AC_CHECK_FUNC([gethostent], , AC_SEARCH_LIBS([gethostent], [nsl], , , [-lsocket])) -AC_CHECK_FUNCS([gettimeofday inet_ntoa memset]) -AC_CHECK_FUNCS([socket], , AC_SEARCH_LIBS([socket], [socket])) -AC_CHECK_FUNCS([sqrt], , AC_SEARCH_LIBS([sqrt], [m])) -AC_CHECK_FUNCS([strrchr]) +AC_ARG_ENABLE( + [ipv6], + [AS_HELP_STRING( + [--enable-ipv6], + [s use IPv6?] + )] +) -case "$host" in - *-*-hpux10.*) # at least for hppa2.0-hp-hpux10.20 - case "$GCC" in - yes) +case "$enable_ipv6" in + yes|''|autodetect) + case "$host" in + powerpc-ibm-aix4*) ;; - *) CFLAGS="$CFLAGS -Wp,-H18816" + *) + AC_DEFINE([WANT_IPV6], [1], [configure --enable-ipv6]) ;; esac ;; - *-*-linux*) - CFLAGS="$CFLAGS -DADJTIME_MISSING" + no) ;; - *-*-sunos*) - CFLAGS="$CFLAGS -DNONBLOCK_BROKEN" +esac + + +dnl [Bug 1984] ntp/libisc fails to compile on OS X 10.7 (Lion) +case "$host" in + *-*-darwin*) + AC_DEFINE([__APPLE_USE_RFC_3542], [1], [Are we _special_?]) +esac + + +AC_CACHE_CHECK( + [for IPv6 structures], + [isc_cv_found_ipv6], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include <sys/types.h> + #include <sys/socket.h> + #include <netinet/in.h> + ]], + [[ + struct sockaddr_in6 sin6; + ]] + )], + [isc_cv_found_ipv6=yes], + [isc_cv_found_ipv6=no] + )] +) + +# +# See whether IPv6 support is provided via a Kame add-on. +# This is done before other IPv6 linking tests so LIBS is properly set. +# +AC_MSG_CHECKING([for Kame IPv6 support]) +AC_ARG_WITH( + [kame], + [AS_HELP_STRING( + [--with-kame], + [- =/usr/local/v6] + )], + [use_kame="$withval"], + [use_kame="no"] +) +case "$use_kame" in + no) + ;; + yes) + kame_path=/usr/local/v6 + ;; + *) + kame_path="$use_kame" ;; esac +case "$use_kame" in + no) + AC_MSG_RESULT([no]) + ;; + *) + if test -f $kame_path/lib/libinet6.a; then + AC_MSG_RESULT([$kame_path/lib/libinet6.a]) + LIBS="-L$kame_path/lib -linet6 $LIBS" + else + AC_MSG_ERROR([$kame_path/lib/libinet6.a not found. + +Please choose the proper path with the following command: -AC_MSG_CHECKING(for bin subdirectory) -AC_ARG_WITH(binsubdir, - AC_HELP_STRING([--with-binsubdir], [bin ={bin,sbin}]), - use_binsubdir="$withval", use_binsubdir="bin") + configure --with-kame=PATH +]) + fi + ;; +esac + +# +# Whether netinet6/in6.h is needed has to be defined in isc/platform.h. +# Including it on Kame-using platforms is very bad, though, because +# Kame uses #error against direct inclusion. So include it on only +# the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1. +# This is done before the in6_pktinfo check because that's what +# netinet6/in6.h is needed for. +# +case "$host" in + *-bsdi4.[[01]]*) + AC_DEFINE([ISC_PLATFORM_NEEDNETINET6IN6H], [1], + [Do we need netinet6/in6.h?]) + isc_netinet6in6_hack="#include <netinet6/in6.h>" + ;; + *) + isc_netinet6in6_hack="" + ;; +esac +# +# This is similar to the netinet6/in6.h issue. +# +case "$host" in + *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*) + AC_DEFINE([ISC_PLATFORM_FIXIN6ISADDR], [1], + [Do we need to fix in6isaddr?]) + isc_netinetin6_hack="#include <netinet/in6.h>" + ;; + *) + isc_netinetin6_hack="" + ;; +esac + + +case "$isc_cv_found_ipv6" in + yes) + AC_DEFINE([ISC_PLATFORM_HAVEIPV6], [1], [have IPv6?]) + AC_CACHE_CHECK( + [for in6_pktinfo], + [isc_cv_have_in6_pktinfo], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include <sys/types.h> + #include <sys/socket.h> + #include <netinet/in.h> + $isc_netinetin6_hack + $isc_netinet6in6_hack + ]], + [[ + struct in6_pktinfo xyzzy; + ]] + )], + [isc_cv_have_in6_pktinfo=yes], + [isc_cv_have_in6_pktinfo=no] + )] + ) + case "$isc_cv_have_in6_pktinfo" in + yes) + AC_DEFINE([ISC_PLATFORM_HAVEIN6PKTINFO], [1], + [have struct in6_pktinfo?]) + esac + + + # HMS: Use HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID instead? + AC_CACHE_CHECK( + [for sockaddr_in6.sin6_scope_id], + [isc_cv_have_sin6_scope_id], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include <sys/types.h> + #include <sys/socket.h> + #include <netinet/in.h> + $isc_netinetin6_hack + $isc_netinet6in6_hack + ]], + [[ + struct sockaddr_in6 xyzzy; + xyzzy.sin6_scope_id = 0; + ]] + )], + [isc_cv_have_sin6_scope_id=yes], + [isc_cv_have_sin6_scope_id=no] + )] + ) + + case "$isc_cv_have_sin6_scope_id" in + yes) + AC_DEFINE([ISC_PLATFORM_HAVESCOPEID], [1], [sin6_scope_id?]) + esac +esac + + +# We need this check run even without isc_cv_found_ipv6=yes + +AC_CACHE_CHECK( + [for in6addr_any], + [isc_cv_have_in6addr_any], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include <sys/types.h> + #include <sys/socket.h> + #include <netinet/in.h> + $isc_netinetin6_hack + $isc_netinet6in6_hack + ]], + [[ + struct in6_addr in6; + in6 = in6addr_any; + ]] + )], + [isc_cv_have_in6addr_any=yes], + [isc_cv_have_in6addr_any=no] + )] +) + +case "$isc_cv_have_in6addr_any" in + no) + AC_DEFINE([ISC_PLATFORM_NEEDIN6ADDRANY], [1], [missing in6addr_any?]) +esac + + +AC_CACHE_CHECK( + [for struct if_laddrconf], + [isc_cv_struct_if_laddrconf], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include <sys/types.h> + #include <net/if6.h> + ]], + [[ + struct if_laddrconf a; + ]] + )], + [isc_cv_struct_if_laddrconf=yes], + [isc_cv_struct_if_laddrconf=no] + )] +) + +case "$isc_cv_struct_if_laddrconf" in + yes) + AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRCONF], [1], + [have struct if_laddrconf?]) +esac + +AC_CACHE_CHECK( + [for struct if_laddrreq], + isc_cv_struct_if_laddrreq, + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include <sys/types.h> + #include <net/if6.h> + ]], + [[ + struct if_laddrreq a; + ]] + )], + [isc_cv_struct_if_laddrreq=yes], + [isc_cv_struct_if_laddrreq=no] + )] +) + +case "$isc_cv_struct_if_laddrreq" in + yes) + AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRREQ], [1], + [have struct if_laddrreq?]) +esac + + +### + +# Hacks +# these need work if we're to move libntp under sntp +AC_DEFINE([HAVE_NO_NICE], 1, [sntp does not care about 'nice']) +AC_DEFINE([HAVE_TERMIOS], 1, [sntp does not care about TTY stuff]) + +# Checks for library functions. +AC_CHECK_FUNCS([socket vsnprintf vsprintf]) + +AC_MSG_CHECKING([for bin subdirectory]) +AC_ARG_WITH( + [binsubdir], + [AS_HELP_STRING( + [--with-binsubdir], + [bin ={bin,sbin}] + )], + [use_binsubdir="$withval"], + [use_binsubdir="bin"] +) case "$use_binsubdir" in bin) ;; @@ -151,9 +891,11 @@ case "$use_binsubdir" in AC_MSG_ERROR([<$use_binsubdir> is illegal - must be "bin" or "sbin"]) ;; esac -AC_MSG_RESULT($use_binsubdir) +AC_MSG_RESULT([$use_binsubdir]) + BINSUBDIR=$use_binsubdir -AC_SUBST(BINSUBDIR) +AC_SUBST([BINSUBDIR]) +AM_CONDITIONAL([NTP_BINSUBDIR_IS_BIN], [test "bin" = "$BINSUBDIR"]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/sntp/crypto.c b/sntp/crypto.c new file mode 100644 index 0000000..7a46232 --- /dev/null +++ b/sntp/crypto.c @@ -0,0 +1,191 @@ +#include <config.h> +#include "crypto.h" +#include <ctype.h> + +struct key *key_ptr; +int key_cnt = 0; + +int +make_mac( + char *pkt_data, + int pkt_size, + int mac_size, + struct key *cmp_key, + char * digest + ) +{ + u_int len = mac_size; + int key_type; + EVP_MD_CTX ctx; + + if (cmp_key->key_len > 64) + return 0; + if (pkt_size % 4 != 0) + return 0; + + INIT_SSL(); + key_type = keytype_from_text(cmp_key->type, NULL); + EVP_DigestInit(&ctx, EVP_get_digestbynid(key_type)); + EVP_DigestUpdate(&ctx, (u_char *)cmp_key->key_seq, (u_int)cmp_key->key_len); + EVP_DigestUpdate(&ctx, (u_char *)pkt_data, (u_int)pkt_size); + EVP_DigestFinal(&ctx, (u_char *)digest, &len); + + return (int)len; +} + + +/* Generates a md5 digest of the key specified in keyid concatinated with the + * ntp packet (exluding the MAC) and compares this digest to the digest in + * the packet's MAC. If they're equal this function returns 1 (packet is + * authentic) or else 0 (not authentic). + */ +int +auth_md5( + char *pkt_data, + int pkt_size, + int mac_size, + struct key *cmp_key + ) +{ + int hash_len; + int authentic; + char digest[20]; + + if (mac_size > sizeof(digest)) + return 0; + hash_len = make_mac(pkt_data, pkt_size, sizeof(digest), cmp_key, + digest); + if (!hash_len) + authentic = FALSE; + else + authentic = !memcmp(digest, pkt_data + pkt_size + 4, + hash_len); + return authentic; +} + +static int +hex_val( + unsigned char x + ) +{ + int val; + + if ('0' <= x && x <= '9') + val = x - '0'; + else if ('a' <= x && x <= 'f') + val = x - 'a' + 0xa; + else if ('A' <= x && x <= 'F') + val = x - 'A' + 0xA; + else + val = -1; + + return val; +} + +/* Load keys from the specified keyfile into the key structures. + * Returns -1 if the reading failed, otherwise it returns the + * number of keys it read + */ +int +auth_init( + const char *keyfile, + struct key **keys + ) +{ + FILE *keyf = fopen(keyfile, "r"); + struct key *prev = NULL; + int scan_cnt, line_cnt = 0; + char kbuf[200]; + char keystring[129]; + + if (keyf == NULL) { + if (ENABLED_OPT(NORMALVERBOSE)) + printf("sntp auth_init: Couldn't open key file %s for reading!\n", keyfile); + return -1; + } + if (feof(keyf)) { + if (ENABLED_OPT(NORMALVERBOSE)) + printf("sntp auth_init: Key file %s is empty!\n", keyfile); + fclose(keyf); + return -1; + } + key_cnt = 0; + while (!feof(keyf)) { + char * octothorpe; + struct key *act = emalloc(sizeof(struct key)); + int goodline = 0; + + if (NULL == fgets(kbuf, sizeof(kbuf), keyf)) + continue; + + kbuf[sizeof(kbuf) - 1] = '\0'; + octothorpe = strchr(kbuf, '#'); + if (octothorpe) + *octothorpe = '\0'; + scan_cnt = sscanf(kbuf, "%d %9s %128s", &act->key_id, act->type, keystring); + if (scan_cnt == 3) { + int len = strlen(keystring); + if (len <= 20) { + act->key_len = len; + memcpy(act->key_seq, keystring, len + 1); + goodline = 1; + } else if ((len & 1) != 0) { + goodline = 0; /* it's bad */ + } else { + int j; + goodline = 1; + act->key_len = len >> 1; + for (j = 0; j < len; j+=2) { + int val; + val = (hex_val(keystring[j]) << 4) | + hex_val(keystring[j+1]); + if (val < 0) { + goodline = 0; /* it's bad */ + break; + } + act->key_seq[j>>1] = (char)val; + } + } + } + if (goodline) { + act->next = NULL; + if (NULL == prev) + *keys = act; + else + prev->next = act; + prev = act; + key_cnt++; + } else { + msyslog(LOG_DEBUG, "auth_init: scanf %d items, skipping line %d.", + scan_cnt, line_cnt); + free(act); + } + line_cnt++; + } + fclose(keyf); + + key_ptr = *keys; + return key_cnt; +} + +/* Looks for the key with keyid key_id and sets the d_key pointer to the + * address of the key. If no matching key is found the pointer is not touched. + */ +void +get_key( + int key_id, + struct key **d_key + ) +{ + struct key *itr_key; + + if (key_cnt == 0) + return; + for (itr_key = key_ptr; itr_key; itr_key = itr_key->next) { + if (itr_key->key_id == key_id) { + *d_key = itr_key; + break; + } + } + return; +} diff --git a/sntp/crypto.h b/sntp/crypto.h new file mode 100644 index 0000000..5f184b0 --- /dev/null +++ b/sntp/crypto.h @@ -0,0 +1,36 @@ +#ifndef CRYPTO_H +#define CRYPTO_H + +#include <string.h> +#include <stdio.h> +#include <stdlib.h> + +#include <ntp_fp.h> +#include <ntp.h> +#include <ntp_stdlib.h> +#ifdef OPENSSL +# include "openssl/evp.h" +#else +# include <ntp_md5.h> /* provides clone of OpenSSL MD5 API */ +#endif +#include "utilities.h" +#include "sntp-opts.h" + +#define LEN_PKT_MAC LEN_PKT_NOMAC + sizeof(u_int32) + +/* #include "sntp-opts.h" */ + +struct key { + struct key *next; + int key_id; + int key_len; + char type[10]; + char key_seq[64]; +}; + +int auth_init(const char *keyfile, struct key **keys); +void get_key(int key_id, struct key **d_key); +int make_mac(char *pkt_data, int pkt_size, int mac_size, struct key *cmp_key, char *digest); +int auth_md5(char *pkt_data, int pkt_size, int mac_size, struct key *cmp_key); + +#endif diff --git a/sntp/data_formats.h b/sntp/data_formats.h new file mode 100644 index 0000000..28848b2 --- /dev/null +++ b/sntp/data_formats.h @@ -0,0 +1,8 @@ +#ifndef DATA_FORMATS_H +#define DATA_FORMATS_H + +#include <ntp_machine.h> +#include <ntp_fp.h> +#include <ntp.h> + +#endif diff --git a/sntp/deps-ver b/sntp/deps-ver new file mode 100644 index 0000000..dd28e40 --- /dev/null +++ b/sntp/deps-ver @@ -0,0 +1 @@ +Fri Nov 13 17:21:31 UTC 2009 diff --git a/sntp/depsver.mf b/sntp/depsver.mf new file mode 100644 index 0000000..3e4a618 --- /dev/null +++ b/sntp/depsver.mf @@ -0,0 +1,67 @@ +$(DEPDIR)/deps-ver: $(top_srcdir)/deps-ver + @[ -f $@ ] || \ + cp $(top_srcdir)/deps-ver $@ + @[ -w $@ ] || \ + chmod ug+w $@ + @cmp $(top_srcdir)/deps-ver $@ > /dev/null || ( \ + $(MAKE) clean && \ + echo -n "Prior $(subdir)/$(DEPDIR) version " && \ + cat $@ && \ + rm -rf $(DEPDIR) && \ + mkdir $(DEPDIR) && \ + case "$(top_builddir)" in \ + .) \ + ./config.status Makefile depfiles \ + ;; \ + ..) \ + cd .. && \ + ./config.status $(subdir)/Makefile depfiles && \ + cd $(subdir) \ + ;; \ + *) \ + echo 'Fatal: depsver.mf Automake fragment limited' \ + 'to immediate subdirectories.' && \ + echo "top_builddir: $(top_builddir)" && \ + echo "subdir: $(subdir)" && \ + exit 1 \ + ;; \ + esac && \ + echo -n "Cleaned $(subdir)/$(DEPDIR) version " && \ + cat $(top_srcdir)/deps-ver \ + ) + cp $(top_srcdir)/deps-ver $@ + +.deps-ver: $(top_srcdir)/deps-ver + @[ ! -d $(DEPDIR) ] || $(MAKE) $(DEPDIR)/deps-ver + @touch $@ + +BUILT_SOURCES += .deps-ver +CLEANFILES += .deps-ver + +# +# depsver.mf included in Makefile.am for directories with .deps +# +# When building in the same directory with sources that change over +# time, such as when tracking using bk, the .deps files can become +# stale with respect to moved, deleted, or superceded headers. Most +# commonly, this would exhibit as make reporting a failure to make a +# header file which is no longer in the location given. To address +# this issue, we use a deps-ver file which is updated with each change +# that breaks old .deps files. A copy of deps-ver is made into +# $(DEPDIR) if not already present. If $(DEPDIR)/deps-ver is present +# with different contents than deps-ver, we make clean to ensure all +# .o files built before the incompatible change are rebuilt along with +# their updated .deps files, then remove $(DEPDIR) and recreate it as +# empty stubs. +# +# It is normal when configured with --disable-dependency-tracking for +# the DEPDIR to not have been created. For this reason, we use the +# intermediate target .deps-ver, which invokes make recursively if +# DEPDIR exists. +# +# If you modify depsver.mf, please make the changes to the master +# copy, the one in sntp is copied by the bootstrap script from it. +# +# This comment block follows rather than leads the related code so that +# it stays with it in the generated Makefile.in and Makefile. +# diff --git a/sntp/header.h b/sntp/header.h index c752d15..21805f1 100644 --- a/sntp/header.h +++ b/sntp/header.h @@ -15,7 +15,6 @@ No changes should be needed for any system that is even remotely like Unix. */ -#define VERSION "1.6" /* Just the version string */ #define MAX_SOCKETS 10 /* Maximum number of addresses */ #ifndef LOCKNAME @@ -25,6 +24,8 @@ No changes should be needed for any system that is even remotely like Unix. */ # define SAVENAME "/etc/sntp.state" /* Stores the recovery state */ #endif +//#define DEBUG + /* Defined in main.c */ @@ -32,7 +33,7 @@ No changes should be needed for any system that is even remotely like Unix. */ #define op_client 1 /* Behave as a challenge client */ #define op_listen 2 /* Behave as a listening client */ -extern const char *argv0; +/* extern const char *argv0; extern int verbose, operation; @@ -42,7 +43,7 @@ extern void fatal (int syserr, const char *message, const char *insert); -/* Defined in unix.c */ + Defined in unix.c */ extern void do_nothing (int seconds); @@ -74,7 +75,7 @@ extern int read_socket (int which, void *packet, int length, int waiting); extern int flush_socket (int which); -extern void close_socket (int which); +/* extern void close_socket (int which); */ diff --git a/sntp/internet.c b/sntp/internet.c deleted file mode 100644 index a1040f1..0000000 --- a/sntp/internet.c +++ /dev/null @@ -1,207 +0,0 @@ -/* Copyright (C) 1996 N.M. Maclaren - Copyright (C) 1996 The University of Cambridge - -This includes all of the code needed to handle Internet addressing. It is way -outside current POSIX, unfortunately. It should be easy to convert to a system -that uses another mechanism. The signal handling is not necessary for its -function, but is an attempt to avoid the program hanging when the name server -is inaccessible. */ - - - -#include "header.h" -#include "internet.h" - -#include <netdb.h> -#include <arpa/inet.h> - -#define INTERNET -#include "kludges.h" -#undef INTERNET - - -/* Used to force dns resolving to ipv4 or ipv6 addresses. */ -static int pref_family; - -/* There needs to be some disgusting grobble for handling timeouts, which is -identical to the grobble in socket.c. */ - -static jmp_buf jump_buffer; - -static void jump_handler (int sig) { - longjmp(jump_buffer,1); -} - -static void clear_alarm (void) { - int k; - - k = errno; - alarm(0); - errno = 0; - if (signal(SIGALRM,SIG_DFL) == SIG_ERR) - fatal(1,"unable to reset signal handler",NULL); - errno = k; -} - -void preferred_family(int fam) { - switch(fam) { - case PREF_FAM_INET: - pref_family = AF_INET; - break; -#ifdef HAVE_IPV6 - case PREF_FAM_INET6: - pref_family = AF_INET6; - break; -#endif - default: - fatal(0,"unable to set the preferred family", NULL); - break; - } -} - -#ifdef HAVE_IPV6 - -void find_address (struct sockaddr_storage *address, - struct sockaddr_storage *anywhere, - int *port, char *hostname, int timespan) { - -/* Locate the specified NTP server and return its Internet address and port -number. */ - - int family, rval; - struct addrinfo hints; - struct addrinfo *res; - - res = NULL; - memset(address, 0, sizeof(struct sockaddr_storage)); - memset(anywhere, 0, sizeof(struct sockaddr_storage)); - - if (setjmp(jump_buffer)) - fatal(0,"unable to set up access to NTP server %s",hostname); - errno = 0; - if (signal(SIGALRM,jump_handler) == SIG_ERR) - fatal(1,"unable to set up signal handler",NULL); - alarm((unsigned int)timespan); - -/* Look up the Internet name or IP number. */ - memset(&hints, 0, sizeof(hints)); - hints.ai_socktype = SOCK_DGRAM; - hints.ai_family = pref_family; - rval = getaddrinfo(hostname, "ntp", &hints, &res); - if (rval != 0) - fatal(0, "getaddrinfo(hostname, ntp) failed with %s", - gai_strerror(rval)); - -/* Now clear the timer and check the result. */ - - clear_alarm(); - /* There can be more than one address in the list, but for now only - use the first. */ - memcpy(address, res->ai_addr, res->ai_addrlen); - family = res->ai_family; - freeaddrinfo(res); - - switch(family) { - case AF_INET: - hints.ai_family = AF_INET; - hints.ai_flags = AI_PASSIVE; - rval = getaddrinfo(NULL, "ntp", &hints, &res); - if (rval != 0) - fatal(0, "getaddrinfo(NULL, ntp) failed with %s", - gai_strerror(rval)); - memcpy(anywhere, res->ai_addr, res->ai_addrlen); - freeaddrinfo(res); - break; - case AF_INET6: - hints.ai_family = AF_INET6; - hints.ai_flags = AI_PASSIVE; - rval = getaddrinfo(NULL, "ntp", &hints, &res); - if (rval != 0) - fatal(0, "getaddrinfo(NULL, ntp, INET6, AI_PASSIVE) failed with %s", - gai_strerror(rval)); - memcpy(anywhere, res->ai_addr, res->ai_addrlen); - freeaddrinfo(res); - break; - } -} - -#else - -void find_address (struct in_addr *address, struct in_addr *anywhere, - int *port, char *hostname, int timespan) { - -/* Locate the specified NTP server and return its Internet address and port -number. */ - - unsigned long ipaddr; - struct in_addr nowhere[1]; - struct hostent *host; - struct servent *service; - -/* Set up the reserved Internet addresses, attempting not to assume that -addresses are 32 bits. */ - - local_to_address(nowhere,INADDR_LOOPBACK); - local_to_address(anywhere,INADDR_ANY); - -/* Check the address, if any. This assumes that the DNS is reliable, or is at -least checked by someone else. But it doesn't assume that it is accessible, so -it needs to set up a timeout. */ - - if (hostname == NULL) - *address = *anywhere; - else { - if (setjmp(jump_buffer)) - fatal(0,"unable to set up access to NTP server %s",hostname); - errno = 0; - if (signal(SIGALRM,jump_handler) == SIG_ERR) - fatal(1,"unable to set up signal handler",NULL); - alarm((unsigned int)timespan); - -/* Look up the Internet name or IP number. */ - - if (! isdigit(hostname[0])) { - errno = 0; - host = gethostbyname(hostname); - } else { - if ((ipaddr = inet_addr(hostname)) == (unsigned long)-1) - fatal(0,"invalid IP number %s",hostname); - network_to_address(address,ipaddr); - errno = 0; - host = gethostbyaddr((void *)address,sizeof(struct in_addr), - AF_INET); - } - -/* Now clear the timer and check the result. */ - - clear_alarm(); - if (host == NULL) fatal(1,"unable to locate IP address/number",NULL); - if (host->h_length != sizeof(struct in_addr)) - fatal(0,"the address does not seem to be an Internet one",NULL); - *address = *((struct in_addr **)host->h_addr_list)[0]; - if (memcmp(address,nowhere,sizeof(struct in_addr)) == 0 - || memcmp(address,anywhere,sizeof(struct in_addr)) == 0) - fatal(0,"reserved IP numbers cannot be used",NULL); - if (verbose) - fprintf(stderr, - "%s: using NTP server %s (%s)\n", - argv0,host->h_name,inet_ntoa(*address)); - } - -/* Find out the port number (usually from /etc/services), and leave it in -network format. This is assumed not to be obtained from a network service! -Note that a port number is not assumed to be 16 bits. */ - - if ((service = getservbyname("ntp","udp")) != NULL) { - *port = service->s_port; - if (verbose > 2) - fprintf(stderr,"Using port %d for NTP\n",port_to_integer(*port)); - } else { - *port = NTP_PORT; - if (verbose) - fprintf(stderr, - "%s: assuming port %d for NTP - check /etc/services\n", - argv0,port_to_integer(*port)); - } -} -#endif diff --git a/sntp/internet.h b/sntp/internet.h deleted file mode 100644 index 5241314..0000000 --- a/sntp/internet.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (C) 1996 N.M. Maclaren - Copyright (C) 1996 The University of Cambridge - -This includes all of the 'Internet' headers and definitions used across -modules, including those for handling timeouts. No changes should be needed -for any version of Unix with Internet (IP version 5) addressing, but would be -for other addressing domains. It needs <sys/socket.h> only because AF_INET is -needed by gethostbyaddr and is defined there rather than in <netdb.h>, for some -damn-fool reason. */ - - - -#include <setjmp.h> -#include <signal.h> - -#include <unistd.h> -#include <sys/types.h> -#include <netinet/in.h> -#include <sys/socket.h> - - - -/* It is most unclear whether these should be here or in kludges.h, as they are -kludges to keep 32-bit address dependencies out of the main body of internet.c, -to allow for the much heralded arrival of IP version 6. It will be interesting -to see whether the universal availability of 64-bit integers arrives first. */ - -#define local_to_address(x,y) ((x)->s_addr = htonl((unsigned long)y)) -#define network_to_address(x,y) ((x)->s_addr = (y)) - -#define NTP_PORT htons((unsigned short)123) /* If not in /etc/services */ -#define port_to_integer(x) (ntohs((unsigned short)(x))) - - -#if defined(_SS_MAXSIZE) || defined(_SS_SIZE) -#define HAVE_IPV6 -#endif - -/* Defined in internet.c */ -#ifdef HAVE_IPV6 -extern void find_address (struct sockaddr_storage *address, - struct sockaddr_storage *anywhere, - int *port, char *hostname, int timespan); -#else -extern void find_address (struct in_addr *address, struct in_addr *anywhere, - int *port, char *hostname, int timespan); -#endif diff --git a/sntp/kludges.h b/sntp/kludges.h deleted file mode 100644 index dc78c8d..0000000 --- a/sntp/kludges.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright (C) 1996, 2000 N.M. Maclaren - Copyright (C) 1996, 2000 The University of Cambridge - -This includes all of the kludges necessary for certain broken systems. It is -called after all other headers. All of the modules set a flag to say which -they are, but none of the current kludges critically need that information. */ - - - -/* stdlib.h is broken under SunOS4. */ - -#ifndef EXIT_SUCCESS -#define EXIT_SUCCESS 0 -#define EXIT_FAILURE 1 -#endif - - - -/* stdio.h is also broken under SunOS4. */ - -#ifndef SEEK_SET -#define SEEK_SET 0 -#endif - - - -/* netinet/in.h sometimes omits INADDR_LOOPBACK, or makes it conditional on -peculiar preprocessor symbols. */ - -#ifndef INADDR_LOOPBACK -#define INADDR_LOOPBACK 0x7f000001ul -#endif - - - -/* HP-UX up to version 9.x does not have adjtime, so make it fail. This needs -a flag setting in Makefile. */ - -#ifdef ADJTIME_MISSING -#define adjtime(x,y) 1 -#endif - - - -/* O_NONBLOCK doesn't work under Ultrix 4.3. This needs a flag setting in -Makefile. */ - -#ifdef NONBLOCK_BROKEN -#ifdef O_NONBLOCK -#undef O_NONBLOCK -#endif -#define O_NONBLOCK O_NDELAY -#endif - - - -/* Some older systems use EWOULDBLOCK rather than EAGAIN, but don't assume that -it is defined. The differences are not relevant to this program. */ - -#ifndef EWOULDBLOCK -#define EWOULDBLOCK EAGAIN -#endif diff --git a/sntp/kod_management.c b/sntp/kod_management.c new file mode 100644 index 0000000..a0cd23c --- /dev/null +++ b/sntp/kod_management.c @@ -0,0 +1,291 @@ +#include <config.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> + +#include "kod_management.h" +#include "log.h" +#include "sntp-opts.h" +#include "ntp_stdlib.h" +//#define DEBUG + +int kod_init = 0, kod_db_cnt = 0; +const char *kod_db_file; +struct kod_entry **kod_db; /* array of pointers to kod_entry */ + + +/* + * Search for a KOD entry + */ +int +search_entry ( + char *hostname, + struct kod_entry **dst + ) +{ + register int a, b, resc = 0; + + for (a = 0; a < kod_db_cnt; a++) + if (!strcmp(kod_db[a]->hostname, hostname)) + resc++; + + if (!resc) { + *dst = NULL; + return 0; + } + + *dst = emalloc(resc * sizeof(**dst)); + + b = 0; + for (a = 0; a < kod_db_cnt; a++) + if (!strcmp(kod_db[a]->hostname, hostname)) { + (*dst)[b] = *kod_db[a]; + b++; + } + + return resc; +} + + +void +add_entry( + char *hostname, + char *type /* 4 bytes not \0 terminated */ + ) +{ + int n; + struct kod_entry *pke; + + pke = emalloc(sizeof(*pke)); + pke->timestamp = time(NULL); + memcpy(pke->type, type, 4); + pke->type[sizeof(pke->type) - 1] = '\0'; + strncpy(pke->hostname, hostname, + sizeof(pke->hostname)); + pke->hostname[sizeof(pke->hostname) - 1] = '\0'; + + /* + * insert in address ("hostname") order to find duplicates + */ + for (n = 0; n < kod_db_cnt; n++) + if (strcmp(kod_db[n]->hostname, pke->hostname) >= 0) + break; + + if (n < kod_db_cnt && + 0 == strcmp(kod_db[n]->hostname, pke->hostname)) { + kod_db[n]->timestamp = pke->timestamp; + free(pke); + return; + } + + kod_db_cnt++; + kod_db = erealloc(kod_db, kod_db_cnt * sizeof(kod_db[0])); + if (n != kod_db_cnt - 1) + memmove(&kod_db[n + 1], &kod_db[n], + sizeof(kod_db[0]) * ((kod_db_cnt - 1) - n)); + kod_db[n] = pke; +} + + +void +delete_entry( + char *hostname, + char *type + ) +{ + register int a; + + for (a = 0; a < kod_db_cnt; a++) + if (!strcmp(kod_db[a]->hostname, hostname) + && !strcmp(kod_db[a]->type, type)) + break; + + if (a == kod_db_cnt) + return; + + free(kod_db[a]); + kod_db_cnt--; + + if (a < kod_db_cnt) + memmove(&kod_db[a], &kod_db[a + 1], + (kod_db_cnt - a) * sizeof(kod_db[0])); +} + + +void +write_kod_db(void) +{ + FILE *db_s; + char *pch; + int dirmode; + register int a; + + db_s = fopen(kod_db_file, "w"); + + /* + * If opening fails, blindly attempt to create each directory + * in the path first, then retry the open. + */ + if (NULL == db_s && strlen(kod_db_file)) { + dirmode = S_IRUSR | S_IWUSR | S_IXUSR + | S_IRGRP | S_IXGRP + | S_IROTH | S_IXOTH; + pch = strchr(kod_db_file + 1, DIR_SEP); + while (NULL != pch) { + *pch = '\0'; + mkdir(kod_db_file, dirmode); + *pch = DIR_SEP; + pch = strchr(pch + 1, DIR_SEP); + } + db_s = fopen(kod_db_file, "w"); + } + + if (NULL == db_s) { + msyslog(LOG_WARNING, "Can't open KOD db file %s for writing!", + kod_db_file); + + return; + } + + for (a = 0; a < kod_db_cnt; a++) { + fprintf(db_s, "%16.16llx %s %s\n", (unsigned long long) + kod_db[a]->timestamp, kod_db[a]->type, + kod_db[a]->hostname); + } + + fflush(db_s); + fclose(db_s); +} + + +void +kod_init_kod_db( + const char *db_file + ) +{ + /* + * Max. of 254 characters for hostname, 10 for timestamp, 4 for + * kisscode, 2 for spaces, 1 for \n, and 1 for \0 + */ + char fbuf[254+10+4+2+1+1]; + FILE *db_s; + int a, b, sepc, len; + unsigned long long ull; + char *str_ptr; + char error = 0; + + atexit(write_kod_db); + +#ifdef DEBUG + printf("Initializing KOD DB...\n"); +#endif + + kod_db_file = estrdup(db_file); + + + db_s = fopen(db_file, "r"); + + if (NULL == db_s) { + msyslog(LOG_WARNING, "kod_init_kod_db(): Cannot open KoD db file %s", + db_file); + + return; + } + + if (ENABLED_OPT(NORMALVERBOSE)) + printf("Starting to read KoD file %s...\n", db_file); + /* First let's see how many entries there are and check for right syntax */ + + while (!feof(db_s) && NULL != fgets(fbuf, sizeof(fbuf), db_s)) { + + /* ignore blank lines */ + if ('\n' == fbuf[0]) + continue; + + sepc = 0; + len = strlen(fbuf); + for (a = 0; a < len; a++) { + if (' ' == fbuf[a]) + sepc++; + + if ('\n' == fbuf[a]) { + if (sepc != 2) { + if (strcmp(db_file, "/dev/null")) + msyslog(LOG_DEBUG, + "Syntax error in KoD db file %s in line %i (missing space)", + db_file, + kod_db_cnt + 1); + fclose(db_s); + return; + } + sepc = 0; + kod_db_cnt++; + } + } + } + + if (0 == kod_db_cnt) { +#ifdef DEBUG + printf("KoD DB %s empty.\n", db_file); +#endif + fclose(db_s); + return; + } + +#ifdef DEBUG + printf("KoD DB %s contains %d entries, reading...\n", db_file, kod_db_cnt); +#endif + + rewind(db_s); + + kod_db = emalloc(sizeof(kod_db[0]) * kod_db_cnt); + + /* Read contents of file */ + for (b = 0; + !feof(db_s) && !ferror(db_s) && b < kod_db_cnt; + b++) { + + str_ptr = fgets(fbuf, sizeof(fbuf), db_s); + if (NULL == str_ptr) { + error = 1; + break; + } + + /* ignore blank lines */ + if ('\n' == fbuf[0]) { + b--; + continue; + } + + kod_db[b] = emalloc(sizeof(*kod_db[b])); + + if (3 != sscanf(fbuf, "%llx %4s %254s", &ull, + kod_db[b]->type, kod_db[b]->hostname)) { + + free(kod_db[b]); + kod_db[b] = NULL; + error = 1; + break; + } + + kod_db[b]->timestamp = (time_t)ull; + } + + if (ferror(db_s) || error) { + kod_db_cnt = b; + msyslog(LOG_WARNING, "An error occured while parsing the KoD db file %s", + db_file); + fclose(db_s); + + return; + } + + fclose(db_s); +#ifdef DEBUG + for (a = 0; a < kod_db_cnt; a++) + printf("KoD entry %d: %s at %llx type %s\n", a, + kod_db[a]->hostname, + (unsigned long long)kod_db[a]->timestamp, + kod_db[a]->type); +#endif +} diff --git a/sntp/kod_management.h b/sntp/kod_management.h new file mode 100644 index 0000000..70903a5 --- /dev/null +++ b/sntp/kod_management.h @@ -0,0 +1,20 @@ +#ifndef KOD_MANAGEMENT_H +#define KOD_MANAGEMENT_H + +#include <time.h> + +struct kod_entry { + char hostname[255]; + time_t timestamp; + char type[5]; +}; + +int search_entry(char *hostname, struct kod_entry **dst); + +void add_entry(char *hostname, char *type); +void delete_entry(char *hostname, char *type); +void kod_init_kod_db(const char *db_file); +void write_kod_db(void); + + +#endif diff --git a/sntp/libopts/COPYING.gplv3 b/sntp/libopts/COPYING.gplv3 new file mode 100644 index 0000000..6c1b848 --- /dev/null +++ b/sntp/libopts/COPYING.gplv3 @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (c) 1992-2011 by Bruce Korb - all rights reserved + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + copyright (c) by Bruce Korb - all rights reserved + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> copyright (c) by Bruce Korb - all rights reserved + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/sntp/libopts/COPYING.lgpl b/sntp/libopts/COPYING.lgpl deleted file mode 100644 index 129c5de..0000000 --- a/sntp/libopts/COPYING.lgpl +++ /dev/null @@ -1,502 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - <one line to give the library's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - <signature of Ty Coon>, 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/sntp/libopts/COPYING.lgplv3 b/sntp/libopts/COPYING.lgplv3 new file mode 100644 index 0000000..c7759a0 --- /dev/null +++ b/sntp/libopts/COPYING.lgplv3 @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (c) 1992-2011 by Bruce Korb - all rights reserved + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/sntp/libopts/Makefile.am b/sntp/libopts/Makefile.am index 5f138614..a94972e 100644 --- a/sntp/libopts/Makefile.am +++ b/sntp/libopts/Makefile.am @@ -7,18 +7,22 @@ noinst_LTLIBRARIES = libopts.la endif libopts_la_SOURCES = libopts.c libopts_la_CPPFLAGS = -I$(top_srcdir) -libopts_la_LDFLAGS = -version-info 29:0:4 +libopts_la_LDFLAGS = -version-info 35:0:10 EXTRA_DIST = \ - COPYING.lgpl COPYING.mbsd MakeDefs.inc \ - README autoopts/options.h autoopts/usage-txt.h \ + COPYING.gplv3 COPYING.lgplv3 COPYING.mbsd \ + MakeDefs.inc README ag-char-map.h \ + autoopts/usage-txt.h autoopts/options.h autoopts/project.h \ autoopts.c autoopts.h boolean.c \ - compat/windows-config.h compat/compat.h compat/pathfind.c \ - compat/snprintf.c compat/strdup.c compat/strchr.c \ + compat/strdup.c compat/compat.h compat/windows-config.h \ + compat/snprintf.c compat/strchr.c compat/pathfind.c \ configfile.c cook.c enumeration.c \ - environment.c genshell.c genshell.h \ - load.c m4/libopts.m4 m4/liboptschk.m4 \ - makeshell.c nested.c numeric.c \ + environment.c file.c genshell.c \ + genshell.h load.c m4/liboptschk.m4 \ + m4/libopts.m4 makeshell.c nested.c \ + numeric.c parse-duration.c parse-duration.h \ pgusage.c proto.h putshell.c \ - restore.c save.c sort.c \ - stack.c streqvcmp.c text_mmap.c \ - tokenize.c usage.c version.c + reset.c restore.c save.c \ + sort.c stack.c streqvcmp.c \ + text_mmap.c time.c tokenize.c \ + usage.c value-type.c value-type.h \ + version.c xat-attribute.c xat-attribute.h diff --git a/sntp/libopts/Makefile.in b/sntp/libopts/Makefile.in index b5f27c6..024399d 100644 --- a/sntp/libopts/Makefile.in +++ b/sntp/libopts/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -38,6 +38,15 @@ subdir = libopts DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/libopts/m4/libopts.m4 \ + $(top_srcdir)/../m4/libtool.m4 \ + $(top_srcdir)/../m4/ltoptions.m4 \ + $(top_srcdir)/../m4/ltsugar.m4 \ + $(top_srcdir)/../m4/ltversion.m4 \ + $(top_srcdir)/../m4/lt~obsolete.m4 \ + $(top_srcdir)/../m4/ntp_cacheversion.m4 \ + $(top_srcdir)/../m4/ntp_dir_sep.m4 \ + $(top_srcdir)/../m4/ntp_lib_m.m4 \ + $(top_srcdir)/../m4/ntp_openssl.m4 $(top_srcdir)/../version.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -110,12 +119,15 @@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -ECHO = @ECHO@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +FGREP = @FGREP@ GREP = @GREP@ HAVE_INLINE = @HAVE_INLINE@ INSTALL = @INSTALL@ @@ -123,18 +135,31 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LCRYPTO = @LCRYPTO@ +LD = @LD@ LDFLAGS = @LDFLAGS@ +LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBOPTS_CFLAGS = @LIBOPTS_CFLAGS@ LIBOPTS_DIR = @LIBOPTS_DIR@ LIBOPTS_LDADD = @LIBOPTS_LDADD@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OPENSSL = @OPENSSL@ +OPENSSL_INC = @OPENSSL_INC@ +OPENSSL_LIB = @OPENSSL_LIB@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -143,7 +168,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +POSIX_SHELL = @POSIX_SHELL@ RANLIB = @RANLIB@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -152,7 +179,9 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -203,21 +232,25 @@ MAINTAINERCLEANFILES = Makefile.in @INSTALL_LIBOPTS_FALSE@noinst_LTLIBRARIES = libopts.la libopts_la_SOURCES = libopts.c libopts_la_CPPFLAGS = -I$(top_srcdir) -libopts_la_LDFLAGS = -version-info 29:0:4 +libopts_la_LDFLAGS = -version-info 35:0:10 EXTRA_DIST = \ - COPYING.lgpl COPYING.mbsd MakeDefs.inc \ - README autoopts/options.h autoopts/usage-txt.h \ + COPYING.gplv3 COPYING.lgplv3 COPYING.mbsd \ + MakeDefs.inc README ag-char-map.h \ + autoopts/usage-txt.h autoopts/options.h autoopts/project.h \ autoopts.c autoopts.h boolean.c \ - compat/windows-config.h compat/compat.h compat/pathfind.c \ - compat/snprintf.c compat/strdup.c compat/strchr.c \ + compat/strdup.c compat/compat.h compat/windows-config.h \ + compat/snprintf.c compat/strchr.c compat/pathfind.c \ configfile.c cook.c enumeration.c \ - environment.c genshell.c genshell.h \ - load.c m4/libopts.m4 m4/liboptschk.m4 \ - makeshell.c nested.c numeric.c \ + environment.c file.c genshell.c \ + genshell.h load.c m4/liboptschk.m4 \ + m4/libopts.m4 makeshell.c nested.c \ + numeric.c parse-duration.c parse-duration.h \ pgusage.c proto.h putshell.c \ - restore.c save.c sort.c \ - stack.c streqvcmp.c text_mmap.c \ - tokenize.c usage.c version.c + reset.c restore.c save.c \ + sort.c stack.c streqvcmp.c \ + text_mmap.c time.c tokenize.c \ + usage.c value-type.c value-type.h \ + version.c xat-attribute.c xat-attribute.h all: all-am @@ -232,9 +265,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libopts/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libopts/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu libopts/Makefile + $(AUTOMAKE) --foreign libopts/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ diff --git a/sntp/libopts/README b/sntp/libopts/README index 7cbe0b0..afa5409 100644 --- a/sntp/libopts/README +++ b/sntp/libopts/README @@ -1,11 +1,11 @@ THIS TARBALL IS NOT A FULL DISTRIBUTION. The contents of this tarball is designed to be incorporated into -software packages that utilize the AutoOpts option automation -package and are intended to be installed on systems that may not -have libopts installed. It is redistributable under the terms -of either the LGPL (see COPYING.lgpl) or under the terms of -the advertising clause free BSD license (see COPYING.mbsd). +software packages that utilize the AutoOpts option automation package +and are intended to be installed on systems that may not have libopts +installed. It is redistributable under the terms of either the LGPL +(see COPYING.lgpl) or under the terms of the advertising clause free BSD +license (see COPYING.mbsd). Usage Instructions for autoconf/automake/libtoolized projects: @@ -28,20 +28,8 @@ Usage Instructions for autoconf/automake/libtoolized projects: This is one macro where you *MUST* remember to *NOT* quote the argument. If you do, automake will get lost. -2. Add the following to your ``configure.ac'' file: - - LIBOPTS_CHECK - - or: - - LIBOPTS_CHECK([relative/path/to/libopts]) - - This macro will automatically invoke - - AC_CONFIG_FILES( [relative/path/to/libopts/Makefile] ) - - The default ``relative/path/to/libopts'' is simply - ``libopts''. +2. Add an invocation of either LIBOPTS_CHECK or LIBOPTS_CHECK_NOBUILD + to your configure.ac file. See LIBOPTS_CHECK: below for details. 3. Add the following to your top level ``Makefile.am'' file: @@ -49,13 +37,13 @@ Usage Instructions for autoconf/automake/libtoolized projects: SUBDIRS += $(LIBOPTS_DIR) endif - where ``<...>'' can be whatever other files or directories - you may need. The SUBDIRS must be properly ordered. - *PLEASE NOTE* it is crucial that the SUBDIRS be set under the - control of an automake conditional. To work correctly, - automake has to know the range of possible values of SUBDIRS. - It's a magical name with magical properties. ``NEED_LIBOPTS'' - will be correctly set by the ``LIBOPTS_CHECK'' macro, above. + where ``<...>'' can be whatever other files or directories you may + need. The SUBDIRS must be properly ordered. *PLEASE NOTE* it is + crucial that the SUBDIRS be set under the control of an automake + conditional. To work correctly, automake has to know the range of + possible values of SUBDIRS. It's a magical name with magical + properties. ``NEED_LIBOPTS'' will be correctly set by the + ``LIBOPTS_CHECK'' macro, above. 4. Add ``$(LIBOPTS_CFLAGS)'' to relevant compiler flags and ``$(LIBOPTS_LDADD)'' to relevant link options whereever @@ -75,19 +63,60 @@ Usage Instructions for autoconf/automake/libtoolized projects: man_MANS = prog.1 prog.1 : prog-opts.def - autogen -Tagman1.tpl -bprog prog-opts.def + autogen -Tagman-cmd.tpl -bprog prog-opts.def - prog-invoke.texi : prog-opts.def - autogen -Taginfo.tpl -bprog-invoke prog-opts.def + invoke-prog.texi : prog-opts.def + autogen -Tagtexi-cmd.tpl prog-opts.def If your package does not utilize the auto* tools, then you will need to hand craft the rules for building the library. +LIBOPTS_CHECK: + +The arguments to both macro are a relative path to the directory with +the libopts source code. It is optional and defaults to "libopts". +These macros work as follows: + +1. LIBOPTS_CHECK([libopts/rel/path/optional]) + + Adds two command-line options to the generated configure script, + --enable-local-libopts and --disable-libopts-install. AC_SUBST's + LIBOPTS_CFLAGS, LIBOPTS_LDADD, and LIBOPTS_DIR for use in + Makefile.am files. Adds Automake conditional NEED_LIBOPTS which + will be true when the local copy of libopts should be built. Uses + AC_CONFIG_FILES([$libopts-dir/Makefile]) to cause the local libopts + into the package build. If the optional relative path to libopts is + not provided, it defaults to simply "libopts". + +2. LIBOPTS_CHECK_NOBUILD([libopts/rel/path/optional]) + + This variant of LIBOPTS_CHECK is useful when multiple configure.ac + files in a package make use of a single libopts tearoff. In that + case, only one of the configure.ac files should build libopts and + others should simply use it. Consider this package arrangment: + + all-tools/ + configure.ac + common-tools/ + configure.ac + libopts/ + + The parent package all-tools contains a subpackage common-tools + which can be torn off and used independently. Programs configured + by both configure.ac files link against the common-tools/libopts + tearoff, when not using the system's libopts. The top-level + configure.ac uses LIBOPTS_CHECK_NOBUILD([common-tools/libopts]), + while common-tools/configure.ac uses LIBOPTS_CHECK. The difference + is LIBOPTS_CHECK_NOBUILD will never build the libopts tearoff, + leaving that to the subpackage configure.ac's LIBOPTS_CHECK. + Specifically, LIBOPTS_CHECK_NOBUILD always results in the + NEED_LIBOPTS Automake conditional being false, and does not invoke + AC_CONFIG_FILES(path-to-libopts/Makefile). + LICENSING: -This material is copyright 1993-2007 by Bruce Korb. -You are licensed to use this under the terms of either -the GNU Lesser General Public License (see: COPYING.lgpl), or, -at your option, the modified Berkeley Software Distribution -License (see: COPYING.mbsd). Both of these files should be -included with this tarball. +This material is Copyright (c) 1992-2011 by Bruce Korb. You are +licensed to use this under the terms of either the GNU Lesser General +Public License (see: COPYING.lgpl), or, at your option, the modified +Berkeley Software Distribution License (see: COPYING.mbsd). Both of +these files should be included with this tarball. diff --git a/sntp/libopts/ag-char-map.h b/sntp/libopts/ag-char-map.h new file mode 100644 index 0000000..b4f088e --- /dev/null +++ b/sntp/libopts/ag-char-map.h @@ -0,0 +1,192 @@ +/* + * Character mapping generated 04/29/11 15:43:58 + * + * This file contains the character classifications + * used by AutoGen and AutoOpts for identifying tokens. + * This file is part of AutoGen. + * AutoGen Copyright (c) 1992-2011 by Bruce Korb - all rights reserved + * AutoGen is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later + * version. + * AutoGen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License for more details. + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#ifndef AG_CHAR_MAP_H_GUARD +#define AG_CHAR_MAP_H_GUARD 1 + +#ifdef HAVE_CONFIG_H +# if defined(HAVE_INTTYPES_H) +# include <inttypes.h> +# elif defined(HAVE_STDINT_H) +# include <stdint.h> + +# else +# ifndef HAVE_INT8_T + typedef signed char int8_t; +# endif +# ifndef HAVE_UINT8_T + typedef unsigned char uint8_t; +# endif +# ifndef HAVE_INT16_T + typedef signed short int16_t; +# endif +# ifndef HAVE_UINT16_T + typedef unsigned short uint16_t; +# endif +# ifndef HAVE_UINT_T + typedef unsigned int uint_t; +# endif + +# ifndef HAVE_INT32_T +# if SIZEOF_INT == 4 + typedef signed int int32_t; +# elif SIZEOF_LONG == 4 + typedef signed long int32_t; +# endif +# endif + +# ifndef HAVE_UINT32_T +# if SIZEOF_INT == 4 + typedef unsigned int uint32_t; +# elif SIZEOF_LONG == 4 + typedef unsigned long uint32_t; +# endif +# endif +# endif /* HAVE_*INT*_H header */ + +#else /* not HAVE_CONFIG_H -- */ +# ifdef __sun +# include <inttypes.h> +# else +# include <stdint.h> +# endif +#endif /* HAVE_CONFIG_H */ + +#if 0 /* mapping specification source (from autogen.map) */ +// +// %guard autoopts_internal +// %file ag-char-map.h +// %static-table option-char-category +// +// %comment +// This file contains the character classifications +// used by AutoGen and AutoOpts for identifying tokens. +// +// This file is part of AutoGen. +// AutoGen Copyright (c) 1992-2011 by Bruce Korb - all rights reserved +// +// AutoGen is free software: you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the Free Software +// Foundation, either version 3 of the License, or (at your option) any later +// version. +// +// AutoGen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +// A PARTICULAR PURPOSE. See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program. If not, see <http://www.gnu.org/licenses/>. +// % +// +// lower-case "a-z" +// upper-case "A-Z" +// alphabetic +lower-case +upper-case +// oct-digit "0-7" +// dec-digit "89" +oct-digit +// hex-digit "a-fA-F" +dec-digit +// alphanumeric +alphabetic +dec-digit +// var-first "_" +alphabetic +// variable-name +var-first +dec-digit +// option-name "^-" +variable-name +// value-name ":" +option-name +// horiz-white "\t " +// compound-name "[.]" +value-name +horiz-white +// whitespace "\v\f\r\n\b" +horiz-white +// unquotable "!-~" -"\"#(),;<=>[\\]`{}?*'" +// end-xml-token "/>" +whitespace +// graphic "!-~" +// plus-n-space "+" +whitespace +// punctuation "!-~" -alphanumeric -"_" +// suffix "-._" +alphanumeric +// suffix-fmt "%/" +suffix +// false-type "nNfF0\x00" +// file-name "/" +suffix +// end-token "\x00" +whitespace +// end-list-entry "," +end-token +// +#endif /* 0 -- mapping spec. source */ + +typedef uint32_t option_char_category_mask_t; +static option_char_category_mask_t const option_char_category[128]; + +static inline int is_option_char_category_char(char ch, option_char_category_mask_t mask) { + unsigned int ix = (unsigned char)ch; + return ((ix < 128) && ((option_char_category[ix] & mask) != 0)); } + +#define IS_LOWER_CASE_CHAR(_c) is_option_char_category_char((_c), 0x000001) +#define IS_UPPER_CASE_CHAR(_c) is_option_char_category_char((_c), 0x000002) +#define IS_ALPHABETIC_CHAR(_c) is_option_char_category_char((_c), 0x000003) +#define IS_OCT_DIGIT_CHAR(_c) is_option_char_category_char((_c), 0x000004) +#define IS_DEC_DIGIT_CHAR(_c) is_option_char_category_char((_c), 0x00000C) +#define IS_HEX_DIGIT_CHAR(_c) is_option_char_category_char((_c), 0x00001C) +#define IS_ALPHANUMERIC_CHAR(_c) is_option_char_category_char((_c), 0x00000F) +#define IS_VAR_FIRST_CHAR(_c) is_option_char_category_char((_c), 0x000023) +#define IS_VARIABLE_NAME_CHAR(_c) is_option_char_category_char((_c), 0x00002F) +#define IS_OPTION_NAME_CHAR(_c) is_option_char_category_char((_c), 0x00006F) +#define IS_VALUE_NAME_CHAR(_c) is_option_char_category_char((_c), 0x0000EF) +#define IS_HORIZ_WHITE_CHAR(_c) is_option_char_category_char((_c), 0x000100) +#define IS_COMPOUND_NAME_CHAR(_c) is_option_char_category_char((_c), 0x0003EF) +#define IS_WHITESPACE_CHAR(_c) is_option_char_category_char((_c), 0x000500) +#define IS_UNQUOTABLE_CHAR(_c) is_option_char_category_char((_c), 0x000800) +#define IS_END_XML_TOKEN_CHAR(_c) is_option_char_category_char((_c), 0x001500) +#define IS_GRAPHIC_CHAR(_c) is_option_char_category_char((_c), 0x002000) +#define IS_PLUS_N_SPACE_CHAR(_c) is_option_char_category_char((_c), 0x004500) +#define IS_PUNCTUATION_CHAR(_c) is_option_char_category_char((_c), 0x008000) +#define IS_SUFFIX_CHAR(_c) is_option_char_category_char((_c), 0x01000F) +#define IS_SUFFIX_FMT_CHAR(_c) is_option_char_category_char((_c), 0x03000F) +#define IS_FALSE_TYPE_CHAR(_c) is_option_char_category_char((_c), 0x040000) +#define IS_FILE_NAME_CHAR(_c) is_option_char_category_char((_c), 0x09000F) +#define IS_END_TOKEN_CHAR(_c) is_option_char_category_char((_c), 0x100500) +#define IS_END_LIST_ENTRY_CHAR(_c) is_option_char_category_char((_c), 0x300500) + +#if 1 /* def AUTOOPTS_INTERNAL */ +static option_char_category_mask_t const option_char_category[128] = { + /*x00*/ 0x140000, /*x01*/ 0x000000, /*x02*/ 0x000000, /*x03*/ 0x000000, + /*x04*/ 0x000000, /*x05*/ 0x000000, /*x06*/ 0x000000, /*\a */ 0x000000, + /*\b */ 0x000400, /*\t */ 0x000100, /*\n */ 0x000400, /*\v */ 0x000400, + /*\f */ 0x000400, /*\r */ 0x000400, /*x0E*/ 0x000000, /*x0F*/ 0x000000, + /*x10*/ 0x000000, /*x11*/ 0x000000, /*x12*/ 0x000000, /*x13*/ 0x000000, + /*x14*/ 0x000000, /*x15*/ 0x000000, /*x16*/ 0x000000, /*x17*/ 0x000000, + /*x18*/ 0x000000, /*x19*/ 0x000000, /*x1A*/ 0x000000, /*x1B*/ 0x000000, + /*x1C*/ 0x000000, /*x1D*/ 0x000000, /*x1E*/ 0x000000, /*x1F*/ 0x000000, + /* */ 0x000100, /* ! */ 0x00A800, /* " */ 0x00A000, /* # */ 0x00A000, + /* $ */ 0x00A800, /* % */ 0x02A800, /* & */ 0x00A800, /* ' */ 0x00A000, + /* ( */ 0x00A000, /* ) */ 0x00A000, /* * */ 0x00A000, /* + */ 0x00E800, + /* , */ 0x20A000, /* - */ 0x01A840, /* . */ 0x01AA00, /* / */ 0x0AB800, + /* 0 */ 0x042804, /* 1 */ 0x002804, /* 2 */ 0x002804, /* 3 */ 0x002804, + /* 4 */ 0x002804, /* 5 */ 0x002804, /* 6 */ 0x002804, /* 7 */ 0x002804, + /* 8 */ 0x002808, /* 9 */ 0x002808, /* : */ 0x00A880, /* ; */ 0x00A000, + /* < */ 0x00A000, /* = */ 0x00A000, /* > */ 0x00B000, /* ? */ 0x00A000, + /* @ */ 0x00A800, /* A */ 0x002812, /* B */ 0x002812, /* C */ 0x002812, + /* D */ 0x002812, /* E */ 0x002812, /* F */ 0x042812, /* G */ 0x002802, + /* H */ 0x002802, /* I */ 0x002802, /* J */ 0x002802, /* K */ 0x002802, + /* L */ 0x002802, /* M */ 0x002802, /* N */ 0x042802, /* O */ 0x002802, + /* P */ 0x002802, /* Q */ 0x002802, /* R */ 0x002802, /* S */ 0x002802, + /* T */ 0x002802, /* U */ 0x002802, /* V */ 0x002802, /* W */ 0x002802, + /* X */ 0x002802, /* Y */ 0x002802, /* Z */ 0x002802, /* [ */ 0x00A200, + /* \ */ 0x00A000, /* ] */ 0x00A200, /* ^ */ 0x00A840, /* _ */ 0x012820, + /* ` */ 0x00A000, /* a */ 0x002811, /* b */ 0x002811, /* c */ 0x002811, + /* d */ 0x002811, /* e */ 0x002811, /* f */ 0x042811, /* g */ 0x002801, + /* h */ 0x002801, /* i */ 0x002801, /* j */ 0x002801, /* k */ 0x002801, + /* l */ 0x002801, /* m */ 0x002801, /* n */ 0x042801, /* o */ 0x002801, + /* p */ 0x002801, /* q */ 0x002801, /* r */ 0x002801, /* s */ 0x002801, + /* t */ 0x002801, /* u */ 0x002801, /* v */ 0x002801, /* w */ 0x002801, + /* x */ 0x002801, /* y */ 0x002801, /* z */ 0x002801, /* { */ 0x00A000, + /* | */ 0x00A800, /* } */ 0x00A000, /* ~ */ 0x00A800, /*x7F*/ 0x000000 +}; +#endif /* AUTOOPTS_INTERNAL */ +#endif /* AG_CHAR_MAP_H_GUARD */ diff --git a/sntp/libopts/autoopts.c b/sntp/libopts/autoopts.c index 139841b..6578181 100644 --- a/sntp/libopts/autoopts.c +++ b/sntp/libopts/autoopts.c @@ -1,81 +1,80 @@ -/* - * $Id: autoopts.c,v 4.25 2007/04/15 19:01:18 bkorb Exp $ - * Time-stamp: "2007-04-15 11:10:40 bkorb" +/** + * \file autoopts.c + * + * Time-stamp: "2011-03-25 17:55:07 bkorb" * * This file contains all of the routines that must be linked into * an executable to use the generated option processing. The optional * routines are in separately compiled modules so that they will not * necessarily be linked in. - */ - -/* - * Automated Options copyright 1992-2007 Bruce Korb - * - * Automated Options is free software. - * You may 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. - * - * Automated Options 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 Automated Options. See the file "COPYING". If not, - * write to: The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * This file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved * - * As a special exception, Bruce Korb gives permission for additional - * uses of the text contained in his release of AutoOpts. + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. * - * The exception is that, if you link the AutoOpts library with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the AutoOpts library code into it. + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" * - * This exception applies only to the code released by Bruce Korb under - * the name AutoOpts. If you copy code from other sources under the - * General Public License into a copy of AutoOpts, as the General Public - * License permits, the exception does not apply to the code that you add - * in this way. To avoid misleading anyone as to the status of such - * modified files, you must delete this exception notice from them. + * These files have the following md5sums: * - * If you write modifications of your own for AutoOpts, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd */ -static char const zNil[] = ""; +#ifndef PKGDATADIR +# define PKGDATADIR "" +#endif + +static char const zNil[] = ""; +static arg_types_t argTypes = { NULL }; +static char zOptFmtLine[16] = { NUL }; +static ag_bool displayEnum = AG_FALSE; +static char const pkgdatadir_default[] = PKGDATADIR; +static char const * program_pkgdatadir = pkgdatadir_default; +static tOptionLoadMode option_load_mode = OPTION_LOAD_UNCOOKED; +static tePagerState pagerState = PAGER_STATE_INITIAL; + + FILE * option_usage_fp = NULL; /* = = = START-STATIC-FORWARD = = = */ -/* static forward declarations maintained by :mkfwd */ static tSuccess -findOptDesc( tOptions* pOpts, tOptState* pOptState ); +findOptDesc(tOptions* pOpts, tOptState* pOptState); static tSuccess -nextOption( tOptions* pOpts, tOptState* pOptState ); +next_opt_arg_must(tOptions* pOpts, tOptState* pOptState); static tSuccess -doPresets( tOptions* pOpts ); +next_opt_arg_may(tOptions* pOpts, tOptState* pOptState); + +static tSuccess +next_opt_arg_none(tOptions* pOpts, tOptState* pOptState); + +static tSuccess +nextOption(tOptions* pOpts, tOptState* pOptState); + +static tSuccess +doPresets(tOptions* pOpts); static int -checkConsistency( tOptions* pOpts ); +checkConsistency(tOptions* pOpts); /* = = = END-STATIC-FORWARD = = = */ LOCAL void * -ao_malloc( size_t sz ) +ao_malloc(size_t sz) { void * res = malloc(sz); if (res == NULL) { - fprintf( stderr, "malloc of %d bytes failed\n", (int)sz ); - exit( EXIT_FAILURE ); + fprintf(stderr, zAO_Alloc, (int)sz); + exit(EXIT_FAILURE); } return res; } @@ -83,36 +82,25 @@ ao_malloc( size_t sz ) #define malloc(_s) ao_malloc(_s) LOCAL void * -ao_realloc( void *p, size_t sz ) +ao_realloc(void *p, size_t sz) { - void * res = realloc(p, sz); + void * res = (p == NULL) ? malloc(sz) : realloc(p, sz); if (res == NULL) { - fprintf( stderr, "realloc of %d bytes at 0x%p failed\n", (int)sz, p ); - exit( EXIT_FAILURE ); + fprintf(stderr, zAO_Realloc, (int)sz, p); + exit(EXIT_FAILURE); } return res; } #undef realloc #define realloc(_p,_s) ao_realloc(_p,_s) - -LOCAL void -ao_free( void *p ) -{ - if (p != NULL) - free(p); -} -#undef free -#define free(_p) ao_free(_p) - - LOCAL char * -ao_strdup( char const *str ) +ao_strdup(char const *str) { char * res = strdup(str); if (res == NULL) { - fprintf( stderr, "strdup of %d byte string failed\n", (int)strlen(str) ); - exit( EXIT_FAILURE ); + fprintf(stderr, zAO_Strdup, (int)strlen(str)); + exit(EXIT_FAILURE); } return res; } @@ -136,13 +124,13 @@ ao_strdup( char const *str ) #endif /* - * handleOption + * handle_opt * * This routine handles equivalencing, sets the option state flags and * invokes the handler procedure, if any. */ LOCAL tSuccess -handleOption( tOptions* pOpts, tOptState* pOptState ) +handle_opt(tOptions* pOpts, tOptState* pOptState) { /* * Save a copy of the option procedure pointer. @@ -190,8 +178,8 @@ handleOption( tOptions* pOpts, tOptState* pOptState ) * THEN we have a usage problem. */ if (p->optActualIndex != pOD->optIndex) { - fprintf( stderr, (char*)zMultiEquiv, p->pz_Name, pOD->pz_Name, - (pOpts->pOptDesc + p->optActualIndex)->pz_Name); + fprintf(stderr, (char*)zMultiEquiv, p->pz_Name, pOD->pz_Name, + (pOpts->pOptDesc + p->optActualIndex)->pz_Name); return FAILURE; } } else { @@ -240,7 +228,7 @@ handleOption( tOptions* pOpts, tOptState* pOptState ) char const * pzEqv = (pOD->optEquivIndex != NO_EQUIVALENT) ? zEquiv : zNil; - fputs( zErrOnly, stderr ); + fputs(zErrOnly, stderr); if (pOD->optMaxCt > 1) fprintf(stderr, zAtMost, pOD->optMaxCt, pOD->pz_Name, pzEqv); @@ -254,8 +242,8 @@ handleOption( tOptions* pOpts, tOptState* pOptState ) /* * If provided a procedure to call, call it */ - if (pOP != (tpOptProc)NULL) - (*pOP)( pOpts, pOD ); + if (pOP != NULL) + (*pOP)(pOpts, pOD); return SUCCESS; } @@ -274,32 +262,45 @@ handleOption( tOptions* pOpts, tOptState* pOptState ) * Find the long option descriptor for the current option */ LOCAL tSuccess -longOptionFind( tOptions* pOpts, char* pzOptName, tOptState* pOptState ) +longOptionFind(tOptions* pOpts, char* pzOptName, tOptState* pOptState) { ag_bool disable = AG_FALSE; - char* pzEq = strchr( pzOptName, '=' ); + char* pzEq = strchr(pzOptName, '='); tOptDesc* pOD = pOpts->pOptDesc; int idx = 0; int idxLim = pOpts->optCt; int matchCt = 0; int matchIdx = 0; int nameLen; + char opt_name_buf[128]; /* * IF the value is attached to the name, - * THEN clip it off. - * Either way, figure out how long our name is + * copy it off so we can NUL terminate. */ if (pzEq != NULL) { nameLen = (int)(pzEq - pzOptName); - *pzEq = NUL; - } else nameLen = strlen( pzOptName ); + if (nameLen >= sizeof(opt_name_buf)) + return FAILURE; + memcpy(opt_name_buf, pzOptName, nameLen); + opt_name_buf[nameLen] = NUL; + pzOptName = opt_name_buf; + pzEq++; + + } else nameLen = strlen(pzOptName); do { - if (SKIP_OPT(pOD)) + /* + * If option disabled or a doc option, skip to next + */ + if (pOD->pz_Name == NULL) continue; - if (strneqvcmp( pzOptName, pOD->pz_Name, nameLen ) == 0) { + if ( SKIP_OPT(pOD) + && (pOD->fOptState != (OPTST_OMITTED | OPTST_NO_INIT))) + continue; + + if (strneqvcmp(pzOptName, pOD->pz_Name, nameLen) == 0) { /* * IF we have a complete match * THEN it takes priority over any already located partial @@ -348,13 +349,21 @@ longOptionFind( tOptions* pOpts, char* pzOptName, tOptState* pOptState ) } while (pOD++, (++idx < idxLim)); - if (pzEq != NULL) - *(pzEq++) = '='; - /* * Make sure we either found an exact match or found only one partial */ if (matchCt == 1) { + pOD = pOpts->pOptDesc + matchIdx; + + if (SKIP_OPT(pOD)) { + fprintf(stderr, zDisabledErr, pOpts->pzProgName, pOD->pz_Name); + if (pOD->pzText != NULL) + fprintf(stderr, " -- %s", pOD->pzText); + fputc('\n', stderr); + (*pOpts->pUsageProc)(pOpts, EXIT_FAILURE); + /* NOTREACHED */ + } + /* * IF we found a disablement name, * THEN set the bit in the callers' flag word @@ -362,7 +371,7 @@ longOptionFind( tOptions* pOpts, char* pzOptName, tOptState* pOptState ) if (disable) pOptState->flags |= OPTST_DISABLED; - pOptState->pOD = pOpts->pOptDesc + matchIdx; + pOptState->pOD = pOD; pOptState->pzOptArg = pzEq; pOptState->optType = TOPT_LONG; return SUCCESS; @@ -389,9 +398,9 @@ longOptionFind( tOptions* pOpts, char* pzOptName, tOptState* pOptState ) * THEN call the usage procedure. */ if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0) { - fprintf( stderr, zIllOptStr, pOpts->pzProgPath, - (matchCt == 0) ? zIllegal : zAmbiguous, pzOptName ); - (*pOpts->pUsageProc)( pOpts, EXIT_FAILURE ); + fprintf(stderr, (matchCt == 0) ? zIllOptStr : zAmbigOptStr, + pOpts->pzProgPath, pzOptName); + (*pOpts->pUsageProc)(pOpts, EXIT_FAILURE); } return FAILURE; @@ -404,7 +413,7 @@ longOptionFind( tOptions* pOpts, char* pzOptName, tOptState* pOptState ) * Find the short option descriptor for the current option */ LOCAL tSuccess -shortOptionFind( tOptions* pOpts, uint_t optValue, tOptState* pOptState ) +shortOptionFind(tOptions* pOpts, uint_t optValue, tOptState* pOptState) { tOptDesc* pRes = pOpts->pOptDesc; int ct = pOpts->optCt; @@ -412,28 +421,28 @@ shortOptionFind( tOptions* pOpts, uint_t optValue, tOptState* pOptState ) /* * Search the option list */ - for (;;) { - /* - * IF the values match, - * THEN we stop here - */ - if ((! SKIP_OPT(pRes)) && (optValue == pRes->optValue)) { - pOptState->pOD = pRes; - pOptState->optType = TOPT_SHORT; - return SUCCESS; + do { + if (optValue != pRes->optValue) + continue; + + if (SKIP_OPT(pRes)) { + if ( (pRes->fOptState == (OPTST_OMITTED | OPTST_NO_INIT)) + && (pRes->pz_Name != NULL)) { + fprintf(stderr, zDisabledErr, pOpts->pzProgPath, pRes->pz_Name); + if (pRes->pzText != NULL) + fprintf(stderr, " -- %s", pRes->pzText); + fputc('\n', stderr); + (*pOpts->pUsageProc)(pOpts, EXIT_FAILURE); + /* NOTREACHED */ + } + goto short_opt_error; } - /* - * Advance to next option description - */ - pRes++; + pOptState->pOD = pRes; + pOptState->optType = TOPT_SHORT; + return SUCCESS; - /* - * IF we have searched everything, ... - */ - if (--ct <= 0) - break; - } + } while (pRes++, --ct > 0); /* * IF the character value is a digit @@ -441,7 +450,7 @@ shortOptionFind( tOptions* pOpts, uint_t optValue, tOptState* pOptState ) * THEN the result is the "option" itself and the * option is the specially marked "number" option. */ - if ( isdigit( optValue ) + if ( IS_DEC_DIGIT_CHAR(optValue) && (pOpts->specOptIdx.number_option != NO_EQUIVALENT) ) { pOptState->pOD = \ pRes = pOpts->pOptDesc + pOpts->specOptIdx.number_option; @@ -450,13 +459,15 @@ shortOptionFind( tOptions* pOpts, uint_t optValue, tOptState* pOptState ) return SUCCESS; } +short_opt_error: + /* * IF we are to stop on errors (the default, actually) * THEN call the usage procedure. */ if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0) { - fprintf( stderr, zIllOptChr, pOpts->pzProgPath, optValue ); - (*pOpts->pUsageProc)( pOpts, EXIT_FAILURE ); + fprintf(stderr, zIllOptChr, pOpts->pzProgPath, optValue); + (*pOpts->pUsageProc)(pOpts, EXIT_FAILURE); } return FAILURE; @@ -469,7 +480,7 @@ shortOptionFind( tOptions* pOpts, uint_t optValue, tOptState* pOptState ) * Find the option descriptor for the current option */ static tSuccess -findOptDesc( tOptions* pOpts, tOptState* pOptState ) +findOptDesc(tOptions* pOpts, tOptState* pOptState) { /* * IF we are continuing a short option list (e.g. -xyz...) @@ -477,7 +488,7 @@ findOptDesc( tOptions* pOpts, tOptState* pOptState ) * OTHERWISE see if there is room to advance and then do so. */ if ((pOpts->pzCurOpt != NULL) && (*pOpts->pzCurOpt != NUL)) - return shortOptionFind( pOpts, (tAoUC)*(pOpts->pzCurOpt), pOptState ); + return shortOptionFind(pOpts, (tAoUC)*(pOpts->pzCurOpt), pOptState); if (pOpts->curOptIdx >= pOpts->origArgCt) return PROBLEM; /* NORMAL COMPLETION */ @@ -488,16 +499,28 @@ findOptDesc( tOptions* pOpts, tOptState* pOptState ) * IF all arguments must be named options, ... */ if (NAMED_OPTS(pOpts)) { - char* pz = pOpts->pzCurOpt; + char * pz = pOpts->pzCurOpt; + int def; + tSuccess res; + tAoUS * def_opt; + pOpts->curOptIdx++; + if (*pz != '-') + return longOptionFind(pOpts, pz, pOptState); + /* - * Skip over any flag/option markers. - * In this mode, they are not required. + * The name is prefixed with one or more hyphens. Strip them off + * and disable the "default_opt" setting. Use heavy recasting to + * strip off the "const" quality of the "default_opt" field. */ - while (*pz == '-') pz++; - - return longOptionFind( pOpts, pz, pOptState ); + while (*(++pz) == '-') ; + def_opt = (void *)&(pOpts->specOptIdx.default_opt); + def = *def_opt; + *def_opt = NO_EQUIVALENT; + res = longOptionFind(pOpts, pz, pOptState); + *def_opt = def; + return res; } /* @@ -533,12 +556,12 @@ findOptDesc( tOptions* pOpts, tOptState* pOptState ) * Therefore, if long options are not to be accepted, we punt. */ if ((pOpts->fOptSet & OPTPROC_LONGOPT) == 0) { - fprintf( stderr, zIllOptStr, pOpts->pzProgPath, - zIllegal, pOpts->pzCurOpt-2 ); + fprintf(stderr, zIllOptStr, pOpts->pzProgPath, + zIllegal, pOpts->pzCurOpt-2); return FAILURE; } - return longOptionFind( pOpts, pOpts->pzCurOpt, pOptState ); + return longOptionFind(pOpts, pOpts->pzCurOpt, pOptState); } /* @@ -547,193 +570,218 @@ findOptDesc( tOptions* pOpts, tOptState* pOptState ) * short (i.e. single character) option. */ if ((pOpts->fOptSet & OPTPROC_SHORTOPT) != 0) - return shortOptionFind( pOpts, (tAoUC)*(pOpts->pzCurOpt), pOptState ); + return shortOptionFind(pOpts, (tAoUC)*(pOpts->pzCurOpt), pOptState); - return longOptionFind( pOpts, pOpts->pzCurOpt, pOptState ); + return longOptionFind(pOpts, pOpts->pzCurOpt, pOptState); } -/* - * nextOption - * - * Find the option descriptor and option argument (if any) for the - * next command line argument. DO NOT modify the descriptor. Put - * all the state in the state argument so that the option can be skipped - * without consequence (side effect). - */ static tSuccess -nextOption( tOptions* pOpts, tOptState* pOptState ) +next_opt_arg_must(tOptions* pOpts, tOptState* pOptState) { - tSuccess res; - enum { ARG_NONE, ARG_MAY, ARG_MUST } arg_type = ARG_NONE; - teOptArgType at; - - res = findOptDesc( pOpts, pOptState ); - if (! SUCCESSFUL( res )) - return res; - pOptState->flags |= (pOptState->pOD->fOptState & OPTST_PERSISTENT_MASK); - at = OPTST_GET_ARGTYPE(pOptState->flags); - /* - * Figure out what to do about option arguments. An argument may be - * required, not associated with the option, or be optional. We detect the - * latter by examining for an option marker on the next possible argument. - * Disabled mode option selection also disables option arguments. + * An option argument is required. Long options can either have + * a separate command line argument, or an argument attached by + * the '=' character. Figure out which. */ - if ((pOptState->flags & OPTST_DISABLED) != 0) - arg_type = ARG_NONE; - else if (at == OPARG_TYPE_NONE) - arg_type = ARG_NONE; - else if (pOptState->flags & OPTST_ARG_OPTIONAL) - arg_type = ARG_MAY; - else - arg_type = ARG_MUST; - - switch (arg_type) { - case ARG_MUST: + switch (pOptState->optType) { + case TOPT_SHORT: /* - * An option argument is required. Long options can either have - * a separate command line argument, or an argument attached by - * the '=' character. Figure out which. + * See if an arg string follows the flag character */ - switch (pOptState->optType) { - case TOPT_SHORT: - /* - * See if an arg string follows the flag character - */ - if (*++(pOpts->pzCurOpt) == NUL) - pOpts->pzCurOpt = pOpts->origArgVect[ pOpts->curOptIdx++ ]; - pOptState->pzOptArg = pOpts->pzCurOpt; - break; + if (*++(pOpts->pzCurOpt) == NUL) + pOpts->pzCurOpt = pOpts->origArgVect[ pOpts->curOptIdx++ ]; + pOptState->pzOptArg = pOpts->pzCurOpt; + break; - case TOPT_LONG: - /* - * See if an arg string has already been assigned (glued on - * with an `=' character) - */ - if (pOptState->pzOptArg == NULL) - pOptState->pzOptArg = pOpts->origArgVect[ pOpts->curOptIdx++ ]; - break; + case TOPT_LONG: + /* + * See if an arg string has already been assigned (glued on + * with an `=' character) + */ + if (pOptState->pzOptArg == NULL) + pOptState->pzOptArg = pOpts->origArgVect[ pOpts->curOptIdx++ ]; + break; - default: + default: #ifdef DEBUG - fputs( "AutoOpts lib error: option type not selected\n", - stderr ); - exit( EXIT_FAILURE ); + fputs("AutoOpts lib error: option type not selected\n", stderr); + exit(EXIT_FAILURE); #endif - case TOPT_DEFAULT: - /* - * The option was selected by default. The current token is - * the option argument. - */ - break; - } - + case TOPT_DEFAULT: /* - * Make sure we did not overflow the argument list. + * The option was selected by default. The current token is + * the option argument. */ - if (pOpts->curOptIdx > pOpts->origArgCt) { - fprintf( stderr, zMisArg, pOpts->pzProgPath, - pOptState->pOD->pz_Name ); - return FAILURE; - } - - pOpts->pzCurOpt = NULL; /* next time advance to next arg */ break; + } - case ARG_MAY: - /* - * An option argument is optional. - */ - switch (pOptState->optType) { - case TOPT_SHORT: - if (*++pOpts->pzCurOpt != NUL) - pOptState->pzOptArg = pOpts->pzCurOpt; - else { - char* pzLA = pOpts->origArgVect[ pOpts->curOptIdx ]; - - /* - * BECAUSE it is optional, we must make sure - * we did not find another flag and that there - * is such an argument. - */ - if ((pzLA == NULL) || (*pzLA == '-')) - pOptState->pzOptArg = NULL; - else { - pOpts->curOptIdx++; /* argument found */ - pOptState->pzOptArg = pzLA; - } - } - break; + /* + * Make sure we did not overflow the argument list. + */ + if (pOpts->curOptIdx > pOpts->origArgCt) { + fprintf(stderr, zMisArg, pOpts->pzProgPath, pOptState->pOD->pz_Name); + return FAILURE; + } + + pOpts->pzCurOpt = NULL; /* next time advance to next arg */ + return SUCCESS; +} + + +static tSuccess +next_opt_arg_may(tOptions* pOpts, tOptState* pOptState) +{ + /* + * An option argument is optional. + */ + switch (pOptState->optType) { + case TOPT_SHORT: + if (*++pOpts->pzCurOpt != NUL) + pOptState->pzOptArg = pOpts->pzCurOpt; + else { + char* pzLA = pOpts->origArgVect[ pOpts->curOptIdx ]; - case TOPT_LONG: /* - * Look for an argument if we don't already have one (glued on - * with a `=' character) *AND* we are not in named argument mode + * BECAUSE it is optional, we must make sure + * we did not find another flag and that there + * is such an argument. */ - if ( (pOptState->pzOptArg == NULL) - && (! NAMED_OPTS(pOpts))) { - char* pzLA = pOpts->origArgVect[ pOpts->curOptIdx ]; - - /* - * BECAUSE it is optional, we must make sure - * we did not find another flag and that there - * is such an argument. - */ - if ((pzLA == NULL) || (*pzLA == '-')) - pOptState->pzOptArg = NULL; - else { - pOpts->curOptIdx++; /* argument found */ - pOptState->pzOptArg = pzLA; - } + if ((pzLA == NULL) || (*pzLA == '-')) + pOptState->pzOptArg = NULL; + else { + pOpts->curOptIdx++; /* argument found */ + pOptState->pzOptArg = pzLA; } - break; - - default: - case TOPT_DEFAULT: - fputs( "AutoOpts lib error: defaulted to option with optional arg\n", - stderr ); - exit( EX_SOFTWARE ); } - - /* - * After an option with an optional argument, we will - * *always* start with the next option because if there - * were any characters following the option name/flag, - * they would be interpreted as the argument. - */ - pOpts->pzCurOpt = NULL; break; - default: /* CANNOT */ + case TOPT_LONG: /* - * No option argument. Make sure next time around we find - * the correct option flag character for short options + * Look for an argument if we don't already have one (glued on + * with a `=' character) *AND* we are not in named argument mode */ - if (pOptState->optType == TOPT_SHORT) - (pOpts->pzCurOpt)++; + if ( (pOptState->pzOptArg == NULL) + && (! NAMED_OPTS(pOpts))) { + char* pzLA = pOpts->origArgVect[ pOpts->curOptIdx ]; - /* - * It is a long option. Make sure there was no ``=xxx'' argument - */ - else if (pOptState->pzOptArg != NULL) { - fprintf( stderr, zNoArg, pOpts->pzProgPath, - pOptState->pOD->pz_Name ); - return FAILURE; + /* + * BECAUSE it is optional, we must make sure + * we did not find another flag and that there + * is such an argument. + */ + if ((pzLA == NULL) || (*pzLA == '-')) + pOptState->pzOptArg = NULL; + else { + pOpts->curOptIdx++; /* argument found */ + pOptState->pzOptArg = pzLA; + } } + break; - /* - * It is a long option. Advance to next command line argument. - */ - else - pOpts->pzCurOpt = NULL; + default: + case TOPT_DEFAULT: + fputs(zAO_Woops, stderr ); + exit(EX_SOFTWARE); } + /* + * After an option with an optional argument, we will + * *always* start with the next option because if there + * were any characters following the option name/flag, + * they would be interpreted as the argument. + */ + pOpts->pzCurOpt = NULL; return SUCCESS; } +static tSuccess +next_opt_arg_none(tOptions* pOpts, tOptState* pOptState) +{ + /* + * No option argument. Make sure next time around we find + * the correct option flag character for short options + */ + if (pOptState->optType == TOPT_SHORT) + (pOpts->pzCurOpt)++; + + /* + * It is a long option. Make sure there was no ``=xxx'' argument + */ + else if (pOptState->pzOptArg != NULL) { + fprintf(stderr, zNoArg, pOpts->pzProgPath, pOptState->pOD->pz_Name); + return FAILURE; + } + + /* + * It is a long option. Advance to next command line argument. + */ + else + pOpts->pzCurOpt = NULL; + return SUCCESS; +} + +/* + * nextOption + * + * Find the option descriptor and option argument (if any) for the + * next command line argument. DO NOT modify the descriptor. Put + * all the state in the state argument so that the option can be skipped + * without consequence (side effect). + */ +static tSuccess +nextOption(tOptions* pOpts, tOptState* pOptState) +{ + { + tSuccess res; + res = findOptDesc(pOpts, pOptState); + if (! SUCCESSFUL(res)) + return res; + } + + if ( ((pOptState->flags & OPTST_DEFINED) != 0) + && ((pOptState->pOD->fOptState & OPTST_NO_COMMAND) != 0)) { + fprintf(stderr, zNotCmdOpt, pOptState->pOD->pz_Name); + return FAILURE; + } + + pOptState->flags |= (pOptState->pOD->fOptState & OPTST_PERSISTENT_MASK); + + /* + * Figure out what to do about option arguments. An argument may be + * required, not associated with the option, or be optional. We detect the + * latter by examining for an option marker on the next possible argument. + * Disabled mode option selection also disables option arguments. + */ + { + enum { ARG_NONE, ARG_MAY, ARG_MUST } arg_type = ARG_NONE; + tSuccess res; + + if ((pOptState->flags & OPTST_DISABLED) != 0) + arg_type = ARG_NONE; + + else if (OPTST_GET_ARGTYPE(pOptState->flags) == OPARG_TYPE_NONE) + arg_type = ARG_NONE; + + else if (pOptState->flags & OPTST_ARG_OPTIONAL) + arg_type = ARG_MAY; + + else + arg_type = ARG_MUST; + + switch (arg_type) { + case ARG_MUST: res = next_opt_arg_must(pOpts, pOptState); break; + case ARG_MAY: res = next_opt_arg_may( pOpts, pOptState); break; + case ARG_NONE: res = next_opt_arg_none(pOpts, pOptState); break; + } + + return res; + } +} + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * DO PRESETS @@ -747,11 +795,12 @@ nextOption( tOptions* pOpts, tOptState* pOptState ) * line arguments. */ -/* - * doImmediateOpts - scan the command line for immediate action options +/** + * scan the command line for immediate action options. + * This is only called the first time through. */ LOCAL tSuccess -doImmediateOpts( tOptions* pOpts ) +doImmediateOpts(tOptions* pOpts) { pOpts->curOptIdx = 1; /* start by skipping program name */ pOpts->pzCurOpt = NULL; @@ -763,73 +812,76 @@ doImmediateOpts( tOptions* pOpts ) for (;;) { tOptState optState = OPTSTATE_INITIALIZER(PRESET); - switch (nextOption( pOpts, &optState )) { - case FAILURE: goto optionsDone; + switch (nextOption(pOpts, &optState)) { + case FAILURE: goto failed_option; case PROBLEM: return SUCCESS; /* no more args */ case SUCCESS: break; } /* - * IF this *is* an immediate-attribute option, then do it. + * IF this is an immediate-attribute option, then do it. */ if (! DO_IMMEDIATELY(optState.flags)) continue; - if (! SUCCESSFUL( handleOption( pOpts, &optState ))) + if (! SUCCESSFUL(handle_opt(pOpts, &optState))) break; - } optionsDone:; + } failed_option:; if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0) - (*pOpts->pUsageProc)( pOpts, EXIT_FAILURE ); + (*pOpts->pUsageProc)(pOpts, EXIT_FAILURE); + return FAILURE; } - +/** + * Process all the options from our current position onward. (This allows + * interspersed options and arguments for the few non-standard programs that + * require it.) Thus, do not rewind option indexes because some programs + * choose to re-invoke after a non-option. + */ LOCAL tSuccess -doRegularOpts( tOptions* pOpts ) +doRegularOpts(tOptions* pOpts) { - /* - * Now, process all the options from our current position onward. - * (This allows interspersed options and arguments for the few - * non-standard programs that require it.) - */ for (;;) { tOptState optState = OPTSTATE_INITIALIZER(DEFINED); - switch (nextOption( pOpts, &optState )) { - case FAILURE: goto optionsDone; + switch (nextOption(pOpts, &optState)) { + case FAILURE: goto failed_option; case PROBLEM: return SUCCESS; /* no more args */ case SUCCESS: break; } /* - * IF this is not being processed normally (i.e. is immediate action) + * IF this is an immediate action option, * THEN skip it (unless we are supposed to do it a second time). */ if (! DO_NORMALLY(optState.flags)) { if (! DO_SECOND_TIME(optState.flags)) continue; - optState.pOD->optOccCt--; /* don't count last time */ + optState.pOD->optOccCt--; /* don't count this repetition */ } - if (! SUCCESSFUL( handleOption( pOpts, &optState ))) + if (! SUCCESSFUL(handle_opt(pOpts, &optState))) break; - } optionsDone:; + } failed_option:; + if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0) - (*pOpts->pUsageProc)( pOpts, EXIT_FAILURE ); + (*pOpts->pUsageProc)(pOpts, EXIT_FAILURE); + return FAILURE; } -/* - * doPresets - check for preset values from a config file or the envrionment +/** + * check for preset values from a config files or envrionment variables */ static tSuccess -doPresets( tOptions* pOpts ) +doPresets(tOptions* pOpts) { tOptDesc * pOD = NULL; - if (! SUCCESSFUL( doImmediateOpts( pOpts ))) + if (! SUCCESSFUL(doImmediateOpts(pOpts))) return FAILURE; /* @@ -837,7 +889,8 @@ doPresets( tOptions* pOpts ) * has a --load-opts option. See if a command line option has disabled * option presetting. */ - if (pOpts->specOptIdx.save_opts != 0) { + if ( (pOpts->specOptIdx.save_opts != NO_EQUIVALENT) + && (pOpts->specOptIdx.save_opts != 0)) { pOD = pOpts->pOptDesc + pOpts->specOptIdx.save_opts + 1; if (DISABLED_OPT(pOD)) return SUCCESS; @@ -852,22 +905,22 @@ doPresets( tOptions* pOpts ) * THEN do any environment presets and leave. */ if (pOpts->papzHomeList == NULL) { - doEnvPresets( pOpts, ENV_ALL ); + doEnvPresets(pOpts, ENV_ALL); } else { - doEnvPresets( pOpts, ENV_IMM ); + doEnvPresets(pOpts, ENV_IMM); /* * Check to see if environment variables have disabled presetting. */ if ((pOD != NULL) && ! DISABLED_OPT(pOD)) - internalFileLoad( pOpts ); + internalFileLoad(pOpts); /* * ${PROGRAM_LOAD_OPTS} value of "no" cannot disable other environment * variable options. Only the loading of .rc files. */ - doEnvPresets( pOpts, ENV_NON_IMM ); + doEnvPresets(pOpts, ENV_NON_IMM); } pOpts->fOptSet &= ~OPTPROC_PRESETTING; @@ -882,7 +935,7 @@ doPresets( tOptions* pOpts ) * Make sure that the argument list passes our consistency tests. */ static int -checkConsistency( tOptions* pOpts ) +checkConsistency(tOptions* pOpts) { int errCt = 0; tOptDesc* pOD = pOpts->pOptDesc; @@ -907,7 +960,7 @@ checkConsistency( tOptions* pOpts ) if (UNUSED_OPT(p)) { const tOptDesc* pN = pOpts->pOptDesc + pMust[-1]; errCt++; - fprintf( stderr, zReqFmt, pOD->pz_Name, pN->pz_Name ); + fprintf(stderr, zReqFmt, pOD->pz_Name, pN->pz_Name); } if (*pMust == NO_EQUIVALENT) @@ -919,7 +972,7 @@ checkConsistency( tOptions* pOpts ) if (SELECTED_OPT(p)) { const tOptDesc* pN = pOpts->pOptDesc + pCant[-1]; errCt++; - fprintf( stderr, zCantFmt, pOD->pz_Name, pN->pz_Name ); + fprintf(stderr, zCantFmt, pOD->pz_Name, pN->pz_Name); } if (*pCant == NO_EQUIVALENT) @@ -951,8 +1004,8 @@ checkConsistency( tOptions* pOpts ) errCt++; if (pOD->optMinCt > 1) - fprintf( stderr, zNotEnough, pOD->pz_Name, pOD->optMinCt ); - else fprintf( stderr, zNeedOne, pOD->pz_Name ); + fprintf(stderr, zNotEnough, pOD->pz_Name, pOD->optMinCt); + else fprintf(stderr, zNeedOne, pOD->pz_Name); } while (0); if (--oCt <= 0) @@ -971,7 +1024,7 @@ checkConsistency( tOptions* pOpts ) */ if ((pOpts->fOptSet & OPTPROC_NO_ARGS) != 0) { if (pOpts->origArgCt > pOpts->curOptIdx) { - fprintf( stderr, zNoArgs, pOpts->pzProgName ); + fprintf(stderr, zNoArgs, pOpts->pzProgName); ++errCt; } } @@ -981,7 +1034,7 @@ checkConsistency( tOptions* pOpts ) */ else if ((pOpts->fOptSet & OPTPROC_ARGS_REQ) != 0) { if (pOpts->origArgCt <= pOpts->curOptIdx) { - fprintf( stderr, zArgsMust, pOpts->pzProgName ); + fprintf(stderr, zArgsMust, pOpts->pzProgName); ++errCt; } } @@ -1044,13 +1097,10 @@ checkConsistency( tOptions* pOpts ) * ERRSKIP_OPTERR or ERRSTOP_OPTERR macros were invoked. =*/ int -optionProcess( - tOptions* pOpts, - int argCt, - char** argVect ) +optionProcess(tOptions * pOpts, int argCt, char ** argVect) { - if (! SUCCESSFUL( validateOptionsStruct( pOpts, argVect[0] ))) - exit( EX_SOFTWARE ); + if (! SUCCESSFUL(validateOptionsStruct(pOpts, argVect[0]))) + exit(EX_SOFTWARE); /* * Establish the real program name, the program full path, @@ -1060,12 +1110,28 @@ optionProcess( pOpts->origArgCt = argCt; pOpts->origArgVect = argVect; pOpts->fOptSet |= OPTPROC_INITDONE; + if (HAS_pzPkgDataDir(pOpts)) + program_pkgdatadir = pOpts->pzPkgDataDir; - if (! SUCCESSFUL( doPresets( pOpts ))) + if (! SUCCESSFUL(doPresets(pOpts))) return 0; + /* + * IF option name conversion was suppressed but it is not suppressed + * for the command line, then it's time to translate option names. + * Usage text will not get retranslated. + */ + if ( ((pOpts->fOptSet & OPTPROC_TRANSLATE) != 0) + && (pOpts->pTransProc != NULL) + && ((pOpts->fOptSet & OPTPROC_NO_XLAT_MASK) + == OPTPROC_NXLAT_OPT_CFG) ) { + + pOpts->fOptSet &= ~OPTPROC_NXLAT_OPT_CFG; + (*pOpts->pTransProc)(); + } + if ((pOpts->fOptSet & OPTPROC_REORDER) != 0) - optionSort( pOpts ); + optionSort(pOpts); pOpts->curOptIdx = 1; pOpts->pzCurOpt = NULL; @@ -1080,7 +1146,7 @@ optionProcess( pOpts->pzCurOpt = NULL; } - if (! SUCCESSFUL( doRegularOpts( pOpts ))) + if (! SUCCESSFUL(doRegularOpts(pOpts))) return pOpts->origArgCt; /* @@ -1090,12 +1156,13 @@ optionProcess( * THEN do that now before testing for conflicts. * (conflicts are ignored in preset options) */ - if (pOpts->specOptIdx.save_opts != 0) { + if ( (pOpts->specOptIdx.save_opts != NO_EQUIVALENT) + && (pOpts->specOptIdx.save_opts != 0)) { tOptDesc* pOD = pOpts->pOptDesc + pOpts->specOptIdx.save_opts; - if (SELECTED_OPT( pOD )) { - optionSaveFile( pOpts ); - exit( EXIT_SUCCESS ); + if (SELECTED_OPT(pOD)) { + optionSaveFile(pOpts); + exit(EXIT_SUCCESS); } } @@ -1104,8 +1171,8 @@ optionProcess( * THEN look for too few occurrences of required options */ if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0) { - if (checkConsistency( pOpts ) != 0) - (*pOpts->pUsageProc)( pOpts, EXIT_FAILURE ); + if (checkConsistency(pOpts) != 0) + (*pOpts->pUsageProc)(pOpts, EXIT_FAILURE); } return pOpts->curOptIdx; diff --git a/sntp/libopts/autoopts.h b/sntp/libopts/autoopts.h index 2645757..831a52b 100644 --- a/sntp/libopts/autoopts.h +++ b/sntp/libopts/autoopts.h @@ -1,61 +1,38 @@ /* - * Time-stamp: "2007-04-15 09:59:39 bkorb" + * \file autoopts.h * - * autoopts.h $Id: autoopts.h,v 4.23 2007/04/15 19:01:18 bkorb Exp $ - * Time-stamp: "2005-02-14 05:59:50 bkorb" + * Time-stamp: "2011-03-25 17:51:34 bkorb" * * This file defines all the global structures and special values * used in the automated option processing library. - */ - -/* - * Automated Options copyright 1992-2007 Bruce Korb - * - * Automated Options is free software. - * You may 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. * - * Automated Options 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. + * This file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved * - * You should have received a copy of the GNU General Public License - * along with Automated Options. See the file "COPYING". If not, - * write to: The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. * - * As a special exception, Bruce Korb gives permission for additional - * uses of the text contained in his release of AutoOpts. + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" * - * The exception is that, if you link the AutoOpts library with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the AutoOpts library code into it. + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. + * These files have the following md5sums: * - * This exception applies only to the code released by Bruce Korb under - * the name AutoOpts. If you copy code from other sources under the - * General Public License into a copy of AutoOpts, as the General Public - * License permits, the exception does not apply to the code that you add - * in this way. To avoid misleading anyone as to the status of such - * modified files, you must delete this exception notice from them. - * - * If you write modifications of your own for AutoOpts, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd */ #ifndef AUTOGEN_AUTOOPTS_H #define AUTOGEN_AUTOOPTS_H #include "compat/compat.h" +#include "ag-char-map.h" #define AO_NAME_LIMIT 127 #define AO_NAME_SIZE ((size_t)(AO_NAME_LIMIT + 1)) @@ -110,36 +87,6 @@ typedef int tDirection; #define PROCESSING(d) ((d)>0) #define PRESETTING(d) ((d)<0) -#define ISNAMECHAR( c ) (isalnum(c) || ((c) == '_') || ((c) == '-')) - -/* - * Procedure success codes - * - * USAGE: define procedures to return "tSuccess". Test their results - * with the SUCCEEDED, FAILED and HADGLITCH macros. - * - * Microsoft sticks its nose into user space here, so for Windows' sake, - * make sure all of these are undefined. - */ -#undef SUCCESS -#undef FAILURE -#undef PROBLEM -#undef SUCCEEDED -#undef SUCCESSFUL -#undef FAILED -#undef HADGLITCH - -#define SUCCESS ((tSuccess) 0) -#define FAILURE ((tSuccess)-1) -#define PROBLEM ((tSuccess) 1) - -typedef int tSuccess; - -#define SUCCEEDED( p ) ((p) == SUCCESS) -#define SUCCESSFUL( p ) SUCCEEDED( p ) -#define FAILED( p ) ((p) < SUCCESS) -#define HADGLITCH( p ) ((p) > SUCCESS) - /* * When loading a line (or block) of text as an option, the value can * be processed in any of several modes: @@ -167,7 +114,7 @@ typedef enum { OPTION_LOAD_KEEP } tOptionLoadMode; -extern tOptionLoadMode option_load_mode; +static tOptionLoadMode option_load_mode; /* * The pager state is used by optionPagedUsage() procedure. @@ -183,8 +130,6 @@ typedef enum { PAGER_STATE_CHILD } tePagerState; -extern tePagerState pagerState; - typedef enum { ENV_ALL, ENV_IMM, @@ -208,9 +153,9 @@ typedef struct { { NULL, NULL, OPTST_ ## st, TOPT_UNDEFINED } #define TEXTTO_TABLE \ - _TT_( LONGUSAGE ) \ - _TT_( USAGE ) \ - _TT_( VERSION ) + _TT_(LONGUSAGE) \ + _TT_(USAGE) \ + _TT_(VERSION) #define _TT_(n) \ TT_ ## n , @@ -219,39 +164,40 @@ typedef enum { TEXTTO_TABLE COUNT_TT } teTextTo; #undef _TT_ typedef struct { - tCC* pzStr; - tCC* pzReq; - tCC* pzNum; - tCC* pzKey; - tCC* pzKeyL; - tCC* pzBool; - tCC* pzNest; - tCC* pzOpt; - tCC* pzNo; - tCC* pzBrk; - tCC* pzNoF; - tCC* pzSpc; - tCC* pzOptFmt; + char const * pzStr; + char const * pzReq; + char const * pzNum; + char const * pzFile; + char const * pzKey; + char const * pzKeyL; + char const * pzBool; + char const * pzNest; + char const * pzOpt; + char const * pzNo; + char const * pzBrk; + char const * pzNoF; + char const * pzSpc; + char const * pzOptFmt; + char const * pzTime; } arg_types_t; -#define AGALOC( c, w ) ao_malloc((size_t)c) -#define AGREALOC( p, c, w ) ao_realloc((void*)p, (size_t)c) -#define AGFREE( p ) ao_free((void*)p) -#define AGDUPSTR( p, s, w ) (p = ao_strdup(s)) +#define AGALOC(c, w) ao_malloc((size_t)c) +#define AGREALOC(p, c, w) ao_realloc((void*)p, (size_t)c) +#define AGFREE(_p) free((void *)_p) +#define AGDUPSTR(p, s, w) (p = ao_strdup(s)) static void * -ao_malloc( size_t sz ); +ao_malloc(size_t sz); static void * -ao_realloc( void *p, size_t sz ); +ao_realloc(void *p, size_t sz); -static void -ao_free( void *p ); +#define ao_free(_p) free((void *)_p) static char * -ao_strdup( char const *str ); +ao_strdup(char const *str); -#define TAGMEM( m, t ) +#define TAGMEM(m, t) /* * DO option handling? @@ -358,8 +304,8 @@ ao_strdup( char const *str ); #endif #ifndef HAVE_STRCHR -extern char* strchr( char const *s, int c); -extern char* strrchr( char const *s, int c); +extern char* strchr(char const *s, int c); +extern char* strrchr(char const *s, int c); #endif /* @@ -373,7 +319,8 @@ extern char* strrchr( char const *s, int c); /* * File pointer for usage output */ -extern FILE* option_usage_fp; +FILE * option_usage_fp; +static char const * program_pkgdatadir; extern tOptProc optionPrintVersion, optionPagedUsage, optionLoadOpt; diff --git a/sntp/libopts/autoopts/options.h b/sntp/libopts/autoopts/options.h index c2ceeb3..c2925e7 100644 --- a/sntp/libopts/autoopts/options.h +++ b/sntp/libopts/autoopts/options.h @@ -2,34 +2,33 @@ * * DO NOT EDIT THIS FILE (options.h) * - * It has been AutoGen-ed Saturday May 5, 2007 at 12:02:34 PM PDT + * It has been AutoGen-ed April 29, 2011 at 03:44:02 PM by AutoGen 5.11.9 * From the definitions funcs.def * and the template file options_h * * This file defines all the global structures and special values * used in the automated option processing library. * - * Automated Options copyright 1992-Y Bruce Korb + * Automated Options Copyright (C) 1992-2011 by Bruce Korb * - * AutoOpts is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * AutoOpts is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * AutoOpts is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * AutoOpts is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with AutoOpts. If not, write to: - * The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor - * Boston, MA 02110-1301, USA. + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>."; + */ #ifndef AUTOOPTS_OPTIONS_H_GUARD -#define AUTOOPTS_OPTIONS_H_GUARD +#define AUTOOPTS_OPTIONS_H_GUARD 1 #include <sys/types.h> +#include <stdio.h> #if defined(HAVE_STDINT_H) # include <stdint.h> @@ -59,28 +58,33 @@ * to an option descriptor must be obtained. There are two ways: * * 1. inside an option processing procedure, it is the second argument, - * conventionally "tOptDesc* pOD". + * conventionally "tOptDesc* pOD". * - * 2. Outside of an option procedure (or to reference a different option - * descriptor), use either "&DESC( opt_name )" or "&pfx_DESC( opt_name )". + * 2. Outside of an option procedure (or to reference a different option + * descriptor), use either "&DESC( opt_name )" or "&pfx_DESC( opt_name )". * * See the relevant generated header file to determine which and what * values for "opt_name" are available. */ - -#define OPTIONS_STRUCT_VERSION 118784 -#define OPTIONS_VERSION_STRING "29:0:4" +#define OPTIONS_STRUCT_VERSION 143360 +#define OPTIONS_VERSION_STRING "35:0:10" #define OPTIONS_MINIMUM_VERSION 102400 #define OPTIONS_MIN_VER_STRING "25:0:0" typedef enum { - OPARG_TYPE_NONE = 0, - OPARG_TYPE_STRING = 1, /* default type/ vanilla string */ - OPARG_TYPE_ENUMERATION = 2, /* opt arg is an enum (keyword list) */ - OPARG_TYPE_BOOLEAN = 3, /* opt arg is boolean-valued */ - OPARG_TYPE_MEMBERSHIP = 4, /* opt arg sets set membership bits */ - OPARG_TYPE_NUMERIC = 5, /* opt arg has numeric value */ - OPARG_TYPE_HIERARCHY = 6 /* option arg is hierarchical value */ + OPARG_TYPE_NONE = 0, + OPARG_TYPE_STRING = 1, /* default type/ vanilla string */ + OPARG_TYPE_ENUMERATION = 2, /* opt arg is an enum (keyword list) */ + OPARG_TYPE_BOOLEAN = 3, /* opt arg is boolean-valued */ + OPARG_TYPE_MEMBERSHIP = 4, /* opt arg sets set membership bits */ + OPARG_TYPE_NUMERIC = 5, /* opt arg is a long int */ + OPARG_TYPE_HIERARCHY = 6, /* option arg is hierarchical value */ + OPARG_TYPE_FILE = 7, /* option arg names a file */ + OPARG_TYPE_TIME = 8, /* opt arg is a time duration */ + OPARG_TYPE_FLOAT = 9, /* opt arg is a floating point num */ + OPARG_TYPE_DOUBLE = 10, /* opt arg is a double prec. float */ + OPARG_TYPE_LONG_DOUBLE = 11, /* opt arg is a long double prec. */ + OPARG_TYPE_LONG_LONG = 12 /* opt arg is a long long int */ } teOptArgType; typedef struct optionValue { @@ -96,6 +100,31 @@ typedef struct optionValue { } v; } tOptionValue; +typedef enum { + FTYPE_MODE_MAY_EXIST = 0x00, + FTYPE_MODE_MUST_EXIST = 0x01, + FTYPE_MODE_MUST_NOT_EXIST = 0x02, + FTYPE_MODE_EXIST_MASK = 0x03, + FTYPE_MODE_NO_OPEN = 0x00, + FTYPE_MODE_OPEN_FD = 0x10, + FTYPE_MODE_FOPEN_FP = 0x20, + FTYPE_MODE_OPEN_MASK = 0x30 +} teOptFileType; + +typedef union { + int file_flags; + char const * file_mode; +} tuFileMode; + +typedef struct argList tArgList; +#define MIN_ARG_ALLOC_CT 6 +#define INCR_ARG_ALLOC_CT 8 +struct argList { + int useCt; + int allocCt; + char const * apzArgs[MIN_ARG_ALLOC_CT]; +}; + /* * Bits in the fOptState option descriptor field. */ @@ -103,6 +132,7 @@ typedef enum { OPTST_SET_ID = 0, /* Set via the "SET_OPT()" macro */ OPTST_PRESET_ID = 1, /* Set via an RC/INI file */ OPTST_DEFINED_ID = 2, /* Set via a command line option */ + OPTST_RESET_ID = 3, /* Reset via command line option */ OPTST_EQUIVALENCE_ID = 4, /* selected by equiv'ed option */ OPTST_DISABLED_ID = 5, /* option is in disabled state */ OPTST_ALLOC_ARG_ID = 6, /* pzOptArg was allocated */ @@ -121,13 +151,17 @@ typedef enum { OPTST_MUST_SET_ID = 20, /* must be set or pre-set */ OPTST_DOCUMENT_ID = 21, /* opt is for doc only */ OPTST_TWICE_ID = 22, /* process opt twice - imm + reg */ - OPTST_DISABLE_TWICE_ID = 23 /* process disabled option twice */ + OPTST_DISABLE_TWICE_ID = 23, /* process disabled option twice */ + OPTST_SCALED_NUM_ID = 24, /* scaled integer value */ + OPTST_NO_COMMAND_ID = 25, /* disable from cmd line */ + OPTST_DEPRECATED_ID = 26 /* support is being removed */ } opt_state_enum_t; -#define OPTST_INIT 0U +#define OPTST_INIT 0U #define OPTST_SET (1U << OPTST_SET_ID) #define OPTST_PRESET (1U << OPTST_PRESET_ID) #define OPTST_DEFINED (1U << OPTST_DEFINED_ID) +#define OPTST_RESET (1U << OPTST_RESET_ID) #define OPTST_EQUIVALENCE (1U << OPTST_EQUIVALENCE_ID) #define OPTST_DISABLED (1U << OPTST_DISABLED_ID) #define OPTST_ALLOC_ARG (1U << OPTST_ALLOC_ARG_ID) @@ -147,30 +181,39 @@ typedef enum { #define OPTST_DOCUMENT (1U << OPTST_DOCUMENT_ID) #define OPTST_TWICE (1U << OPTST_TWICE_ID) #define OPTST_DISABLE_TWICE (1U << OPTST_DISABLE_TWICE_ID) -#define OPT_STATE_MASK 0x00FFFF77U - -#define OPTST_SET_MASK ( \ - OPTST_SET | \ - OPTST_PRESET | \ - OPTST_DEFINED ) - -#define OPTST_MUTABLE_MASK ( \ - OPTST_SET | \ - OPTST_PRESET | \ - OPTST_DEFINED | \ - OPTST_EQUIVALENCE | \ - OPTST_DISABLED | \ - OPTST_ALLOC_ARG ) - -#define OPTST_SELECTED_MASK ( \ - OPTST_SET | \ - OPTST_DEFINED ) - -#define OPTST_ARG_TYPE_MASK ( \ - OPTST_ARG_TYPE_1 | \ - OPTST_ARG_TYPE_2 | \ - OPTST_ARG_TYPE_3 | \ - OPTST_ARG_TYPE_4 ) +#define OPTST_SCALED_NUM (1U << OPTST_SCALED_NUM_ID) +#define OPTST_NO_COMMAND (1U << OPTST_NO_COMMAND_ID) +#define OPTST_DEPRECATED (1U << OPTST_DEPRECATED_ID) +#define OPT_STATE_MASK 0x07FFFF7FU + +#define OPTST_SET_MASK ( \ + OPTST_DEFINED | OPTST_PRESET | OPTST_RESET | \ + OPTST_SET \ + /* 0x0000000FU */ ) + +#define OPTST_MUTABLE_MASK ( \ + OPTST_ALLOC_ARG | OPTST_DEFINED | \ + OPTST_DISABLED | OPTST_EQUIVALENCE | \ + OPTST_PRESET | OPTST_RESET | \ + OPTST_SET \ + /* 0x0000007FU */ ) + +#define OPTST_SELECTED_MASK ( \ + OPTST_DEFINED | OPTST_SET \ + /* 0x00000005U */ ) + +#define OPTST_ARG_TYPE_MASK ( \ + OPTST_ARG_TYPE_1 | OPTST_ARG_TYPE_2 | OPTST_ARG_TYPE_3 | \ + OPTST_ARG_TYPE_4 \ + /* 0x0000F000U */ ) + +#define OPTST_DO_NOT_SAVE_MASK ( \ + OPTST_DOCUMENT | OPTST_NO_INIT | OPTST_OMITTED \ + /* 0x00280100U */ ) + +#define OPTST_NO_USAGE_MASK ( \ + OPTST_DEPRECATED | OPTST_NO_COMMAND | OPTST_OMITTED \ + /* 0x06080000U */ ) #ifdef NO_OPTIONAL_OPT_ARGS # undef OPTST_ARG_OPTIONAL @@ -179,13 +222,12 @@ typedef enum { #define OPTST_PERSISTENT_MASK (~OPTST_MUTABLE_MASK) -#define SELECTED_OPT( pod ) ((pod)->fOptState & OPTST_SELECTED_MASK) -#define UNUSED_OPT( pod ) (((pod)->fOptState & OPTST_SET_MASK) == 0) -#define DISABLED_OPT( pod ) ((pod)->fOptState & OPTST_DISABLED) -#define OPTION_STATE( pod ) ((pod)->fOptState) - -#define OPTST_SET_ARGTYPE(n) ((n) << OPTST_ARG_TYPE_1_ID) -#define OPTST_GET_ARGTYPE(f) (((f) & OPTST_ARG_TYPE_MASK)>>OPTST_ARG_TYPE_1_ID) +#define SELECTED_OPT(_od) ((_od)->fOptState & OPTST_SELECTED_MASK) +#define UNUSED_OPT( _od) (((_od)->fOptState & OPTST_SET_MASK) == 0) +#define DISABLED_OPT(_od) ((_od)->fOptState & OPTST_DISABLED) +#define OPTION_STATE(_od) ((_od)->fOptState) +#define OPTST_SET_ARGTYPE(_n) ((_n) << OPTST_ARG_TYPE_1_ID) +#define OPTST_GET_ARGTYPE(_f) (((_f)&OPTST_ARG_TYPE_MASK)>>OPTST_ARG_TYPE_1_ID) /* * PRIVATE INTERFACES @@ -199,42 +241,50 @@ typedef enum { * Define the processing state flags */ typedef enum { - OPTPROC_LONGOPT_ID = 0, /* Process long style options */ - OPTPROC_SHORTOPT_ID = 1, /* Process short style "flags" */ - OPTPROC_ERRSTOP_ID = 2, /* Stop on argument errors */ - OPTPROC_DISABLEDOPT_ID = 3, /* Current option is disabled */ - OPTPROC_NO_REQ_OPT_ID = 4, /* no options are required */ - OPTPROC_NUM_OPT_ID = 5, /* there is a number option */ - OPTPROC_INITDONE_ID = 6, /* have initializations been done? */ - OPTPROC_NEGATIONS_ID = 7, /* any negation options? */ - OPTPROC_ENVIRON_ID = 8, /* check environment? */ - OPTPROC_NO_ARGS_ID = 9, /* Disallow remaining arguments */ - OPTPROC_ARGS_REQ_ID = 10, /* Require arguments after options */ - OPTPROC_REORDER_ID = 11, /* reorder operands after options */ - OPTPROC_GNUUSAGE_ID = 12, /* emit usage in GNU style */ - OPTPROC_TRANSLATE_ID = 13, /* Translate strings in tOptions */ - OPTPROC_HAS_IMMED_ID = 14, /* program defines immed options */ - OPTPROC_PRESETTING_ID = 19 /* opt processing in preset state */ + OPTPROC_LONGOPT_ID = 0, /* Process long style options */ + OPTPROC_SHORTOPT_ID = 1, /* Process short style "flags" */ + OPTPROC_ERRSTOP_ID = 2, /* Stop on argument errors */ + OPTPROC_DISABLEDOPT_ID = 3, /* Current option is disabled */ + OPTPROC_NO_REQ_OPT_ID = 4, /* no options are required */ + OPTPROC_NUM_OPT_ID = 5, /* there is a number option */ + OPTPROC_INITDONE_ID = 6, /* have inits been done? */ + OPTPROC_NEGATIONS_ID = 7, /* any negation options? */ + OPTPROC_ENVIRON_ID = 8, /* check environment? */ + OPTPROC_NO_ARGS_ID = 9, /* Disallow remaining arguments */ + OPTPROC_ARGS_REQ_ID = 10, /* Require args after options */ + OPTPROC_REORDER_ID = 11, /* reorder operands after opts */ + OPTPROC_GNUUSAGE_ID = 12, /* emit usage in GNU style */ + OPTPROC_TRANSLATE_ID = 13, /* Translate strings in tOptions */ + OPTPROC_MISUSE_ID = 14, /* no usage on usage error */ + OPTPROC_NXLAT_OPT_CFG_ID = 16, /* suppress for config only */ + OPTPROC_NXLAT_OPT_ID = 17, /* suppress xlation always */ + OPTPROC_PRESETTING_ID = 19 /* opt processing in preset state */ } optproc_state_enum_t; -#define OPTPROC_NONE 0U -#define OPTPROC_LONGOPT (1U << OPTPROC_LONGOPT_ID) -#define OPTPROC_SHORTOPT (1U << OPTPROC_SHORTOPT_ID) -#define OPTPROC_ERRSTOP (1U << OPTPROC_ERRSTOP_ID) -#define OPTPROC_DISABLEDOPT (1U << OPTPROC_DISABLEDOPT_ID) -#define OPTPROC_NO_REQ_OPT (1U << OPTPROC_NO_REQ_OPT_ID) -#define OPTPROC_NUM_OPT (1U << OPTPROC_NUM_OPT_ID) -#define OPTPROC_INITDONE (1U << OPTPROC_INITDONE_ID) -#define OPTPROC_NEGATIONS (1U << OPTPROC_NEGATIONS_ID) -#define OPTPROC_ENVIRON (1U << OPTPROC_ENVIRON_ID) -#define OPTPROC_NO_ARGS (1U << OPTPROC_NO_ARGS_ID) -#define OPTPROC_ARGS_REQ (1U << OPTPROC_ARGS_REQ_ID) -#define OPTPROC_REORDER (1U << OPTPROC_REORDER_ID) -#define OPTPROC_GNUUSAGE (1U << OPTPROC_GNUUSAGE_ID) -#define OPTPROC_TRANSLATE (1U << OPTPROC_TRANSLATE_ID) -#define OPTPROC_HAS_IMMED (1U << OPTPROC_HAS_IMMED_ID) -#define OPTPROC_PRESETTING (1U << OPTPROC_PRESETTING_ID) -#define OPTPROC_STATE_MASK 0x00087FFFU +#define OPTPROC_NONE 0U +#define OPTPROC_LONGOPT (1U << OPTPROC_LONGOPT_ID) +#define OPTPROC_SHORTOPT (1U << OPTPROC_SHORTOPT_ID) +#define OPTPROC_ERRSTOP (1U << OPTPROC_ERRSTOP_ID) +#define OPTPROC_DISABLEDOPT (1U << OPTPROC_DISABLEDOPT_ID) +#define OPTPROC_NO_REQ_OPT (1U << OPTPROC_NO_REQ_OPT_ID) +#define OPTPROC_NUM_OPT (1U << OPTPROC_NUM_OPT_ID) +#define OPTPROC_INITDONE (1U << OPTPROC_INITDONE_ID) +#define OPTPROC_NEGATIONS (1U << OPTPROC_NEGATIONS_ID) +#define OPTPROC_ENVIRON (1U << OPTPROC_ENVIRON_ID) +#define OPTPROC_NO_ARGS (1U << OPTPROC_NO_ARGS_ID) +#define OPTPROC_ARGS_REQ (1U << OPTPROC_ARGS_REQ_ID) +#define OPTPROC_REORDER (1U << OPTPROC_REORDER_ID) +#define OPTPROC_GNUUSAGE (1U << OPTPROC_GNUUSAGE_ID) +#define OPTPROC_TRANSLATE (1U << OPTPROC_TRANSLATE_ID) +#define OPTPROC_MISUSE (1U << OPTPROC_MISUSE_ID) +#define OPTPROC_NXLAT_OPT_CFG (1U << OPTPROC_NXLAT_OPT_CFG_ID) +#define OPTPROC_NXLAT_OPT (1U << OPTPROC_NXLAT_OPT_ID) +#define OPTPROC_PRESETTING (1U << OPTPROC_PRESETTING_ID) +#define OPTPROC_STATE_MASK 0x000B7FFFU + +#define OPTPROC_NO_XLAT_MASK ( \ + OPTPROC_NXLAT_OPT | OPTPROC_NXLAT_OPT_CFG \ + /* 0x00030000U */ ) #define STMTS(s) do { s; } while (0) @@ -265,19 +315,24 @@ typedef enum { AG_FALSE = 0, AG_TRUE } ag_bool; typedef struct options tOptions; typedef struct optDesc tOptDesc; typedef struct optNames tOptNames; +#define OPTPROC_EMIT_USAGE ((tOptions *)0x01UL) +#define OPTPROC_EMIT_SHELL ((tOptions *)0x02UL) +#define OPTPROC_RETURN_VALNAME ((tOptions *)0x03UL) +#define OPTPROC_EMIT_LIMIT ((tOptions *)0x0FUL) /* * The option procedures do the special processing for each * option flag that needs it. */ -typedef void (tOptProc)( tOptions* pOpts, tOptDesc* pOptDesc ); +typedef void (tOptProc)(tOptions* pOpts, tOptDesc* pOptDesc); typedef tOptProc* tpOptProc; /* * The usage procedure will never return. It calls "exit(2)" * with the "exitCode" argument passed to it. */ -typedef void (tUsageProc)( tOptions* pOpts, int exitCode ); +// coverity[+kill] +typedef void (tUsageProc)(tOptions* pOpts, int exitCode); typedef tUsageProc* tpUsageProc; /* @@ -289,21 +344,6 @@ typedef tUsageProc* tpUsageProc; #define OPTION_LIMIT SHRT_MAX #define NO_EQUIVALENT (OPTION_LIMIT+1) -/* - * Special values for optValue. It must not be generatable from the - * computation "optIndex +96". Since "optIndex" is limited to 100, ... - */ -#define NUMBER_OPTION '#' - -typedef struct argList tArgList; -#define MIN_ARG_ALLOC_CT 6 -#define INCR_ARG_ALLOC_CT 8 -struct argList { - int useCt; - int allocCt; - tCC* apzArgs[ MIN_ARG_ALLOC_CT ]; -}; - typedef union { char const * argString; uintptr_t argEnum; @@ -311,8 +351,12 @@ typedef union { long argInt; unsigned long argUint; unsigned int argBool; + FILE * argFp; + int argFd; } optArgBucket_t; +#define pzLastArg optArg.argString + /* * Descriptor structure for each option. * Only the fields marked "PUBLIC" are for public use. @@ -331,18 +375,17 @@ struct optDesc { tAoUI fOptState; /* PUBLIC */ tAoUI reserved; optArgBucket_t optArg; /* PUBLIC */ -# define pzLastArg optArg.argString void* optCookie; /* PUBLIC */ - const int * pOptMust; - const int * pOptCant; - tpOptProc pOptProc; - char const* pzText; + int const * const pOptMust; + int const * const pOptCant; + tpOptProc const pOptProc; + char const* const pzText; - char const* pz_NAME; - char const* pz_Name; - char const* pz_DisableName; - char const* pz_DisablePfx; + char const* const pz_NAME; + char const* const pz_Name; + char const* const pz_DisableName; + char const* const pz_DisablePfx; }; /* @@ -362,6 +405,13 @@ struct optSpecIndex { */ typedef void (tOptionXlateProc)(void); +/* + * Everything marked "PUBLIC" is also marked "const". + * Public access is not a license to modify. Other fields + * are used and modified by the library. They are also + * subject to change without any notice. Do not even + * look at these outside of libopts. + */ struct options { int const structVersion; int origArgCt; @@ -370,32 +420,52 @@ struct options { unsigned int curOptIdx; char* pzCurOpt; - char const* pzProgPath; - char const* pzProgName; - char const* const pzPROGNAME; - char const* const pzRcName; - char const* const pzCopyright; - char const* const pzCopyNotice; - char const* const pzFullVersion; + char const* const pzProgPath; /* PUBLIC */ + char const* const pzProgName; /* PUBLIC */ + char const* const pzPROGNAME; /* PUBLIC */ + char const* const pzRcName; /* PUBLIC */ + char const* const pzCopyright; /* PUBLIC */ + char const* const pzCopyNotice; /* PUBLIC */ + char const* const pzFullVersion; /* PUBLIC */ char const* const* const papzHomeList; char const* const pzUsageTitle; char const* const pzExplain; char const* const pzDetail; - tOptDesc* const pOptDesc; - char const* const pzBugAddr; + tOptDesc* const pOptDesc; /* PUBLIC */ + char const* const pzBugAddr; /* PUBLIC */ void* pExtensions; void* pSavedState; + // coverity[+kill] tpUsageProc pUsageProc; tOptionXlateProc* pTransProc; tOptSpecIndex specOptIdx; int const optCt; int const presetOptCt; + char const * pzFullUsage; + char const * pzShortUsage; + /* PUBLIC: */ + optArgBucket_t const * const originalOptArgArray; + void * const * const originalOptArgCookie; + char const * const pzPkgDataDir; + char const * const pzPackager; }; /* + * Versions where in various fields first appear: + * ($AO_CURRENT * 4096 + $AO_REVISION, but $AO_REVISION must be zero) + */ +#define originalOptArgArray_STRUCT_VERSION 131072 /* AO_CURRENT = 32 */ +#define HAS_originalOptArgArray(_opt) \ + ((_opt)->structVersion >= originalOptArgArray_STRUCT_VERSION) + +#define pzPkgDataDir_STRUCT_VERSION 139264 /* AO_CURRENT = 34 */ +#define HAS_pzPkgDataDir(_opt) \ + ((_opt)->structVersion >= pzPkgDataDir_STRUCT_VERSION) + +/* * "token list" structure returned by "string_tokenize()" */ typedef struct { @@ -437,7 +507,8 @@ typedef struct { #define TEXT_MMAP_FAILED_ADDR(a) ((void*)(a) == (void*)MAP_FAILED) #ifdef __cplusplus -extern "C" { +#define CPLUSPLUS_OPENER extern "C" { +CPLUSPLUS_OPENER #define CPLUSPLUS_CLOSER } #else #define CPLUSPLUS_CLOSER @@ -447,7 +518,7 @@ extern "C" { * The following routines may be coded into AutoOpts client code: */ -/* From: tokenize.c line 115 +/* From: tokenize.c line 166 * * ao_string_tokenize - tokenize an input string * @@ -488,10 +559,10 @@ extern "C" { * Double quote strings are formed according to the rules of string * constants in ANSI-C programs. */ -extern token_list_t* ao_string_tokenize( char const* ); +extern token_list_t* ao_string_tokenize(char const*); -/* From: configfile.c line 113 +/* From: configfile.c line 80 * * configFileLoad - parse a configuration file * @@ -508,10 +579,10 @@ extern token_list_t* ao_string_tokenize( char const* ); * @code{optionGetValue()}, @code{optionNextValue()} and * @code{optionUnloadNested()}. */ -extern const tOptionValue* configFileLoad( char const* ); +extern const tOptionValue* configFileLoad(char const*); -/* From: configfile.c line 883 +/* From: configfile.c line 1059 * * optionFileLoad - Load the locatable config files, in order * @@ -538,10 +609,10 @@ extern const tOptionValue* configFileLoad( char const* ); * * Configuration files not found or not decipherable are simply ignored. */ -extern int optionFileLoad( tOptions*, char const* ); +extern int optionFileLoad(tOptions*, char const*); -/* From: configfile.c line 245 +/* From: configfile.c line 212 * * optionFindNextValue - find a hierarcicaly valued option instance * @@ -557,10 +628,10 @@ extern int optionFileLoad( tOptions*, char const* ); * configurable. It will search through the list and return the next entry * that matches the criteria. */ -extern const tOptionValue* optionFindNextValue( const tOptDesc*, const tOptionValue*, char const*, char const* ); +extern const tOptionValue* optionFindNextValue(const tOptDesc*, const tOptionValue*, char const*, char const*); -/* From: configfile.c line 171 +/* From: configfile.c line 138 * * optionFindValue - find a hierarcicaly valued option instance * @@ -574,10 +645,10 @@ extern const tOptionValue* optionFindNextValue( const tOptDesc*, const tOptionVa * This routine will find an entry in a nested value option or configurable. * It will search through the list and return a matching entry. */ -extern const tOptionValue* optionFindValue( const tOptDesc*, char const*, char const* ); +extern const tOptionValue* optionFindValue(const tOptDesc*, char const*, char const*); -/* From: restore.c line 188 +/* From: restore.c line 166 * * optionFree - free allocated option processing memory * @@ -587,10 +658,10 @@ extern const tOptionValue* optionFindValue( const tOptDesc*, char const*, char c * AutoOpts sometimes allocates memory and puts pointers to it in the * option state structures. This routine deallocates all such memory. */ -extern void optionFree( tOptions* ); +extern void optionFree(tOptions*); -/* From: configfile.c line 314 +/* From: configfile.c line 281 * * optionGetValue - get a specific value from a hierarcical list * @@ -605,10 +676,10 @@ extern void optionFree( tOptions* ); * the first entry with a name that exactly matches the argument will be * returned. */ -extern const tOptionValue* optionGetValue( const tOptionValue*, char const* ); +extern const tOptionValue* optionGetValue(const tOptionValue*, char const*); -/* From: load.c line 521 +/* From: load.c line 478 * * optionLoadLine - process a string for an option name and value * @@ -629,10 +700,10 @@ extern const tOptionValue* optionGetValue( const tOptionValue*, char const* ); * formation used in AutoGen definition files (@pxref{basic expression}), * except that you may not use backquotes. */ -extern void optionLoadLine( tOptions*, char const* ); +extern void optionLoadLine(tOptions*, char const*); -/* From: configfile.c line 373 +/* From: configfile.c line 340 * * optionNextValue - get the next value from a hierarchical list * @@ -648,10 +719,10 @@ extern void optionLoadLine( tOptions*, char const* ); * The "@var{pOldValue}" must have been gotten from a prior call to this * routine or to "@code{opitonGetValue()}". */ -extern const tOptionValue* optionNextValue( const tOptionValue*, const tOptionValue* ); +extern const tOptionValue* optionNextValue(const tOptionValue*, const tOptionValue*); -/* From: usage.c line 128 +/* From: usage.c line 195 * * optionOnlyUsage - Print usage text for just the options * @@ -663,10 +734,10 @@ extern const tOptionValue* optionNextValue( const tOptionValue*, const tOptionVa * This function may be used when the emitted usage must incorporate * information not available to AutoOpts. */ -extern void optionOnlyUsage( tOptions*, int ); +extern void optionOnlyUsage(tOptions*, int); -/* From: autoopts.c line 1012 +/* From: autoopts.c line 1065 * * optionProcess - this is the main option processing routine * @@ -693,10 +764,10 @@ extern void optionOnlyUsage( tOptions*, int ); * is treated as an operand. Encountering an operand stops option * processing. */ -extern int optionProcess( tOptions*, int, char** ); +extern int optionProcess(tOptions*, int, char**); -/* From: restore.c line 145 +/* From: restore.c line 123 * * optionRestore - restore option state from memory copy * @@ -710,10 +781,10 @@ extern int optionProcess( tOptions*, int, char** ); * to optionProcess(3AO), then you may change the contents of the * argc/argv parameters to optionProcess. */ -extern void optionRestore( tOptions* ); +extern void optionRestore(tOptions*); -/* From: save.c line 334 +/* From: save.c line 664 * * optionSaveFile - saves the option state to a file * @@ -725,12 +796,20 @@ extern void optionRestore( tOptions* ); * option, or by appending the @code{rcfile} attribute to the last * @code{homerc} attribute. If no @code{rcfile} attribute was specified, it * will default to @code{.@i{programname}rc}. If you wish to specify another - * file, you should invoke the @code{SET_OPT_SAVE_OPTS( @i{filename} )} macro. + * file, you should invoke the @code{SET_OPT_SAVE_OPTS(@i{filename})} macro. + * + * The recommend usage is as follows: + * @example + * optionProcess(&progOptions, argc, argv); + * if (i_want_a_non_standard_place_for_this) + * SET_OPT_SAVE_OPTS("myfilename"); + * optionSaveFile(&progOptions); + * @end example */ -extern void optionSaveFile( tOptions* ); +extern void optionSaveFile(tOptions*); -/* From: restore.c line 93 +/* From: restore.c line 71 * * optionSaveState - saves the option state to memory * @@ -749,10 +828,10 @@ extern void optionSaveFile( tOptions* ); * restoring of stacked string arguments and hierarchical values is * disabled. The values are not saved. */ -extern void optionSaveState( tOptions* ); +extern void optionSaveState(tOptions*); -/* From: nested.c line 559 +/* From: nested.c line 551 * * optionUnloadNested - Deallocate the memory for a nested value * @@ -763,10 +842,10 @@ extern void optionSaveState( tOptions* ); * have been gotten from a call to @code{configFileLoad()} (See * @pxref{libopts-configFileLoad}). */ -extern void optionUnloadNested( tOptionValue const * ); +extern void optionUnloadNested(tOptionValue const *); -/* From: version.c line 58 +/* From: version.c line 31 * * optionVersion - return the compiled AutoOpts version number * @@ -775,10 +854,10 @@ extern void optionUnloadNested( tOptionValue const * ); * Returns the full version string compiled into the library. * The returned string cannot be modified. */ -extern char const* optionVersion( void ); +extern char const* optionVersion(void); -/* From: ../compat/pathfind.c line 34 +/* From: ../compat/pathfind.c line 29 * * pathfind - fild a file in a list of directories * @@ -818,11 +897,11 @@ extern char const* optionVersion( void ); * @end example */ #ifndef HAVE_PATHFIND -extern char* pathfind( char const*, char const*, char const* ); +extern char* pathfind(char const*, char const*, char const*); #endif /* HAVE_PATHFIND */ -/* From: streqvcmp.c line 233 +/* From: streqvcmp.c line 209 * * strequate - map a list of characters to the same value * @@ -834,10 +913,10 @@ extern char* pathfind( char const*, char const*, char const* ); * This function name is mapped to option_strequate so as to not conflict * with the POSIX name space. */ -extern void strequate( char const* ); +extern void strequate(char const*); -/* From: streqvcmp.c line 143 +/* From: streqvcmp.c line 119 * * streqvcmp - compare two strings with an equivalence mapping * @@ -853,10 +932,10 @@ extern void strequate( char const* ); * This function name is mapped to option_streqvcmp so as to not conflict * with the POSIX name space. */ -extern int streqvcmp( char const*, char const* ); +extern int streqvcmp(char const*, char const*); -/* From: streqvcmp.c line 180 +/* From: streqvcmp.c line 156 * * streqvmap - Set the character mappings for the streqv functions * @@ -872,7 +951,7 @@ extern int streqvcmp( char const*, char const* ); * are incremented and the process repeated until @code{ct} entries have been * set. For example, * @example - * streqvmap( 'a', 'A', 26 ); + * streqvmap('a', 'A', 26); * @end example * @noindent * will alter the mapping so that all English lower case letters @@ -881,10 +960,10 @@ extern int streqvcmp( char const*, char const* ); * This function name is mapped to option_streqvmap so as to not conflict * with the POSIX name space. */ -extern void streqvmap( char, char, int ); +extern void streqvmap(char, char, int); -/* From: streqvcmp.c line 102 +/* From: streqvcmp.c line 78 * * strneqvcmp - compare two strings with an equivalence mapping * @@ -902,10 +981,10 @@ extern void streqvmap( char, char, int ); * This function name is mapped to option_strneqvcmp so as to not conflict * with the POSIX name space. */ -extern int strneqvcmp( char const*, char const*, int ); +extern int strneqvcmp(char const*, char const*, int); -/* From: streqvcmp.c line 259 +/* From: streqvcmp.c line 235 * * strtransform - convert a string into its mapped-to value * @@ -917,55 +996,65 @@ extern int strneqvcmp( char const*, char const*, int ); * character is put into the output. * This function name is mapped to option_strtransform so as to not conflict * with the POSIX name space. + * + * The source and destination may be the same. */ -extern void strtransform( char*, char const* ); +extern void strtransform(char*, char const*); /* AutoOpts PRIVATE FUNCTIONS: */ tOptProc optionStackArg, optionUnstackArg, optionBooleanVal, optionNumericVal; -extern char* ao_string_cook( char*, int* ); +extern char* ao_string_cook(char*, int*); + +extern unsigned int ao_string_cook_escape_char(char const*, char*, unsigned int); + +extern void genshelloptUsage(tOptions*, int); + +extern void optionBooleanVal(tOptions*, tOptDesc*); + +extern uintptr_t optionEnumerationVal(tOptions*, tOptDesc*, char const * const *, unsigned int); -extern unsigned int ao_string_cook_escape_char( char const*, char*, unsigned int ); +extern void optionFileCheck(tOptions*, tOptDesc*, teOptFileType, tuFileMode); -extern void export_options_to_guile( tOptions* ); +extern char const * optionKeywordName(tOptDesc*, unsigned int); -extern void genshelloptUsage( tOptions*, int ); +extern void optionLoadOpt(tOptions*, tOptDesc*); -extern void optionBooleanVal( tOptions*, tOptDesc* ); +extern ag_bool optionMakePath(char*, int, char const*, char const*); -extern uintptr_t optionEnumerationVal( tOptions*, tOptDesc*, char const * const *, unsigned int ); +extern void optionNestedVal(tOptions*, tOptDesc*); -extern char const* optionKeywordName( tOptDesc*, unsigned int ); +extern void optionNumericVal(tOptions*, tOptDesc*); -extern void optionLoadOpt( tOptions*, tOptDesc* ); +extern void optionPagedUsage(tOptions*, tOptDesc*); -extern ag_bool optionMakePath( char*, int, char const*, char const* ); +extern void optionParseShell(tOptions*); -extern void optionNestedVal( tOptions*, tOptDesc* ); +extern void optionPrintVersion(tOptions*, tOptDesc*); -extern void optionNumericVal( tOptions*, tOptDesc* ); +extern void optionPutShell(tOptions*); -extern void optionPagedUsage( tOptions*, tOptDesc* ); +extern void optionResetOpt(tOptions*, tOptDesc*); -extern void optionParseShell( tOptions* ); +extern void optionSetMembers(tOptions*, tOptDesc*, char const * const *, unsigned int); -extern void optionPrintVersion( tOptions*, tOptDesc* ); +extern void optionShowRange(tOptions*, tOptDesc*, void *, int); -extern void optionPutShell( tOptions* ); +extern void optionStackArg(tOptions*, tOptDesc*); -extern void optionSetMembers( tOptions*, tOptDesc*, char const * const *, unsigned int ); +extern void optionTimeDate(tOptions*, tOptDesc*); -extern void optionStackArg( tOptions*, tOptDesc* ); +extern void optionTimeVal(tOptions*, tOptDesc*); -extern void optionUnstackArg( tOptions*, tOptDesc* ); +extern void optionUnstackArg(tOptions*, tOptDesc*); -extern void optionUsage( tOptions*, int ); +extern void optionUsage(tOptions*, int); -extern void optionVersionStderr( tOptions*, tOptDesc* ); +extern void optionVersionStderr(tOptions*, tOptDesc*); -extern void* text_mmap( char const*, int, int, tmap_info_t* ); +extern void* text_mmap(char const*, int, int, tmap_info_t*); -extern int text_munmap( tmap_info_t* ); +extern int text_munmap(tmap_info_t*); CPLUSPLUS_CLOSER #endif /* AUTOOPTS_OPTIONS_H_GUARD */ diff --git a/sntp/libopts/autoopts/project.h b/sntp/libopts/autoopts/project.h new file mode 100644 index 0000000..b01affb --- /dev/null +++ b/sntp/libopts/autoopts/project.h @@ -0,0 +1,50 @@ + +#ifndef AUTOGEN_PROJECT_H +#define AUTOGEN_PROJECT_H + +#include "config.h" + +/* + * Procedure success codes + * + * USAGE: define procedures to return "tSuccess". Test their results + * with the SUCCEEDED, FAILED and HADGLITCH macros. + * + * Microsoft sticks its nose into user space here, so for Windows' sake, + * make sure all of these are undefined. + */ +#undef SUCCESS +#undef FAILURE +#undef PROBLEM +#undef SUCCEEDED +#undef SUCCESSFUL +#undef FAILED +#undef HADGLITCH + +#define SUCCESS ((tSuccess) 0) +#define FAILURE ((tSuccess)-1) +#define PROBLEM ((tSuccess) 1) + +typedef int tSuccess; + +#define SUCCEEDED(p) ((p) == SUCCESS) +#define SUCCESSFUL(p) SUCCEEDED(p) +#define FAILED(p) ((p) < SUCCESS) +#define HADGLITCH(p) ((p) > SUCCESS) + +#ifndef STR +# define __STR(s) #s +# define STR(s) __STR(s) +#endif + +#define STRSIZE(s) (sizeof(s)-1) + +#ifdef DEFINING +# define VALUE(s) = s +# define MODE +#else +# define VALUE(s) +# define MODE extern +#endif + +#endif /* AUTOGEN_PROJECT_H */ diff --git a/sntp/libopts/autoopts/usage-txt.h b/sntp/libopts/autoopts/usage-txt.h index 5aaaa01..de92663 100644 --- a/sntp/libopts/autoopts/usage-txt.h +++ b/sntp/libopts/autoopts/usage-txt.h @@ -2,35 +2,33 @@ * * DO NOT EDIT THIS FILE (usage-txt.h) * - * It has been AutoGen-ed Saturday May 5, 2007 at 12:02:33 PM PDT + * It has been AutoGen-ed April 29, 2011 at 03:44:00 PM by AutoGen 5.11.9 * From the definitions usage-txt.def * and the template file usage-txt.tpl * * This file handles all the bookkeeping required for tracking all the little - * tiny strings used by the AutoOpts library. There are 113 + * tiny strings used by the AutoOpts library. There are 142 * of them. This is not versioned because it is entirely internal to the * library and accessed by client code only in a very well-controlled way: * they may substitute translated strings using a procedure that steps through * all the string pointers. * - * AutoOpts is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * AutoOpts is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * AutoOpts is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * AutoOpts is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with AutoOpts. If not, write to: - * The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor - * Boston, MA 02110-1301, USA. + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>."; + */ #ifndef AUTOOPTS_USAGE_TXT_H_GUARD -#define AUTOOPTS_USAGE_TXT_H_GUARD +#define AUTOOPTS_USAGE_TXT_H_GUARD 1 #undef cch_t #define cch_t char const @@ -42,10 +40,12 @@ typedef struct { int field_ct; char* utpz_GnuBoolArg; char* utpz_GnuKeyArg; + char* utpz_GnuFileArg; char* utpz_GnuKeyLArg; + char* utpz_GnuTimeArg; char* utpz_GnuNumArg; char* utpz_GnuStrArg; - cch_t* apz_str[ 108 ]; + cch_t* apz_str[ 135 ]; } usage_text_t; /* @@ -58,119 +58,148 @@ extern usage_text_t option_usage_text; /* * Provide a mapping from a short name to fields in this structure. */ -#define zAO_Bad (option_usage_text.apz_str[ 0]) -#define zAO_Big (option_usage_text.apz_str[ 1]) -#define zAO_Err (option_usage_text.apz_str[ 2]) -#define zAO_Sml (option_usage_text.apz_str[ 3]) -#define zAll (option_usage_text.apz_str[ 4]) -#define zAlt (option_usage_text.apz_str[ 5]) -#define zAmbigKey (option_usage_text.apz_str[ 6]) -#define zAmbiguous (option_usage_text.apz_str[ 7]) -#define zArgsMust (option_usage_text.apz_str[ 8]) -#define zAtMost (option_usage_text.apz_str[ 9]) -#define zAuto (option_usage_text.apz_str[ 10]) -#define zBadPipe (option_usage_text.apz_str[ 11]) -#define zBadVerArg (option_usage_text.apz_str[ 12]) -#define zCantFmt (option_usage_text.apz_str[ 13]) -#define zCantSave (option_usage_text.apz_str[ 14]) -#define zDefaultOpt (option_usage_text.apz_str[ 15]) -#define zDis (option_usage_text.apz_str[ 16]) -#define zEnab (option_usage_text.apz_str[ 17]) -#define zEquiv (option_usage_text.apz_str[ 18]) -#define zErrOnly (option_usage_text.apz_str[ 19]) -#define zExamineFmt (option_usage_text.apz_str[ 20]) -#define zFiveSpaces (option_usage_text.apz_str[ 21]) -#define zFlagOkay (option_usage_text.apz_str[ 22]) -#define zFmtFmt (option_usage_text.apz_str[ 23]) -#define zForkFail (option_usage_text.apz_str[ 24]) -#define zFSErrOptLoad (option_usage_text.apz_str[ 25]) -#define zFSErrReadFile (option_usage_text.apz_str[ 26]) -#define zGenshell (option_usage_text.apz_str[ 27]) +#define zAO_Alloc (option_usage_text.apz_str[ 0]) +#define zAO_Bad (option_usage_text.apz_str[ 1]) +#define zAO_Big (option_usage_text.apz_str[ 2]) +#define zAO_Err (option_usage_text.apz_str[ 3]) +#define zAO_Realloc (option_usage_text.apz_str[ 4]) +#define zAO_Sml (option_usage_text.apz_str[ 5]) +#define zAO_Strdup (option_usage_text.apz_str[ 6]) +#define zAO_Ver (option_usage_text.apz_str[ 7]) +#define zAO_Woops (option_usage_text.apz_str[ 8]) +#define zAliasRange (option_usage_text.apz_str[ 9]) +#define zAll (option_usage_text.apz_str[ 10]) +#define zAlt (option_usage_text.apz_str[ 11]) +#define zAmbigKey (option_usage_text.apz_str[ 12]) +#define zAmbigOptStr (option_usage_text.apz_str[ 13]) +#define zArgsMust (option_usage_text.apz_str[ 14]) +#define zAtMost (option_usage_text.apz_str[ 15]) +#define zAuto (option_usage_text.apz_str[ 16]) +#define zBadPipe (option_usage_text.apz_str[ 17]) +#define zBadVerArg (option_usage_text.apz_str[ 18]) +#define zCantFmt (option_usage_text.apz_str[ 19]) +#define zCantSave (option_usage_text.apz_str[ 20]) +#define zCfgAO_Flags (option_usage_text.apz_str[ 21]) +#define zCfgProg (option_usage_text.apz_str[ 22]) +#define zDefaultOpt (option_usage_text.apz_str[ 23]) +#define zDis (option_usage_text.apz_str[ 24]) +#define zDisabledErr (option_usage_text.apz_str[ 25]) +#define zDisabledOpt (option_usage_text.apz_str[ 26]) +#define zDisabledWhy (option_usage_text.apz_str[ 27]) +#define zEnab (option_usage_text.apz_str[ 28]) +#define zEquiv (option_usage_text.apz_str[ 29]) +#define zErrOnly (option_usage_text.apz_str[ 30]) +#define zExamineFmt (option_usage_text.apz_str[ 31]) +#define zFiveSpaces (option_usage_text.apz_str[ 32]) +#define zFlagOkay (option_usage_text.apz_str[ 33]) +#define zFmtFmt (option_usage_text.apz_str[ 34]) +#define zForkFail (option_usage_text.apz_str[ 35]) +#define zFreopenFail (option_usage_text.apz_str[ 36]) +#define zFSErrOptLoad (option_usage_text.apz_str[ 37]) +#define zFSErrReadFile (option_usage_text.apz_str[ 38]) +#define zFSOptError (option_usage_text.apz_str[ 39]) +#define zFSOptErrMayExist (option_usage_text.apz_str[ 40]) +#define zFSOptErrMustExist (option_usage_text.apz_str[ 41]) +#define zFSOptErrNoExist (option_usage_text.apz_str[ 42]) +#define zFSOptErrOpen (option_usage_text.apz_str[ 43]) +#define zFSOptErrFopen (option_usage_text.apz_str[ 44]) +#define zFileCannotExist (option_usage_text.apz_str[ 45]) +#define zFileMustExist (option_usage_text.apz_str[ 46]) +#define zGenshell (option_usage_text.apz_str[ 47]) #define zGnuBoolArg (option_usage_text.utpz_GnuBoolArg) -#define zGnuBreak (option_usage_text.apz_str[ 28]) +#define zGnuBreak (option_usage_text.apz_str[ 48]) #define zGnuKeyArg (option_usage_text.utpz_GnuKeyArg) +#define zGnuFileArg (option_usage_text.utpz_GnuFileArg) #define zGnuKeyLArg (option_usage_text.utpz_GnuKeyLArg) -#define zGnuNestArg (option_usage_text.apz_str[ 29]) +#define zGnuTimeArg (option_usage_text.utpz_GnuTimeArg) +#define zGnuNestArg (option_usage_text.apz_str[ 49]) #define zGnuNumArg (option_usage_text.utpz_GnuNumArg) -#define zGnuOptArg (option_usage_text.apz_str[ 30]) -#define zGnuOptFmt (option_usage_text.apz_str[ 31]) +#define zGnuOptArg (option_usage_text.apz_str[ 50]) +#define zGnuOptFmt (option_usage_text.apz_str[ 51]) #define zGnuStrArg (option_usage_text.utpz_GnuStrArg) -#define zIllOptChr (option_usage_text.apz_str[ 32]) -#define zIllOptStr (option_usage_text.apz_str[ 33]) -#define zIllegal (option_usage_text.apz_str[ 34]) -#define zInvalOptDesc (option_usage_text.apz_str[ 35]) -#define zKeyWords (option_usage_text.apz_str[ 36]) -#define zLoadCooked (option_usage_text.apz_str[ 37]) -#define zLoadKeep (option_usage_text.apz_str[ 38]) -#define zLoadType (option_usage_text.apz_str[ 39]) -#define zLoadUncooked (option_usage_text.apz_str[ 40]) -#define zLtypeInteger (option_usage_text.apz_str[ 41]) -#define zLtypeNest (option_usage_text.apz_str[ 42]) -#define zLtypeString (option_usage_text.apz_str[ 43]) -#define zLtypeBool (option_usage_text.apz_str[ 44]) -#define zLtypeKeyword (option_usage_text.apz_str[ 45]) -#define zLtypeSetMembership (option_usage_text.apz_str[ 46]) -#define zMembers (option_usage_text.apz_str[ 47]) -#define zMisArg (option_usage_text.apz_str[ 48]) -#define zMultiEquiv (option_usage_text.apz_str[ 49]) -#define zMust (option_usage_text.apz_str[ 50]) -#define zNeedOne (option_usage_text.apz_str[ 51]) -#define zNoArg (option_usage_text.apz_str[ 52]) -#define zNoArgs (option_usage_text.apz_str[ 53]) -#define zNoCreat (option_usage_text.apz_str[ 54]) -#define zNoFlags (option_usage_text.apz_str[ 55]) -#define zNoKey (option_usage_text.apz_str[ 56]) -#define zNoLim (option_usage_text.apz_str[ 57]) -#define zNoPreset (option_usage_text.apz_str[ 58]) -#define zNoRq_NoShrtTtl (option_usage_text.apz_str[ 59]) -#define zNoRq_ShrtTtl (option_usage_text.apz_str[ 60]) -#define zNoStat (option_usage_text.apz_str[ 61]) -#define zNoState (option_usage_text.apz_str[ 62]) -#define zNone (option_usage_text.apz_str[ 63]) -#define zNotDef (option_usage_text.apz_str[ 64]) -#define zNotEnough (option_usage_text.apz_str[ 65]) -#define zNotFile (option_usage_text.apz_str[ 66]) -#define zNotNumber (option_usage_text.apz_str[ 67]) -#define zNrmOptFmt (option_usage_text.apz_str[ 68]) -#define zNumberOpt (option_usage_text.apz_str[ 69]) -#define zOneSpace (option_usage_text.apz_str[ 70]) -#define zOnlyOne (option_usage_text.apz_str[ 71]) -#define zOptsOnly (option_usage_text.apz_str[ 72]) -#define zPathFmt (option_usage_text.apz_str[ 73]) -#define zPlsSendBugs (option_usage_text.apz_str[ 74]) -#define zPreset (option_usage_text.apz_str[ 75]) -#define zPresetFile (option_usage_text.apz_str[ 76]) -#define zPresetIntro (option_usage_text.apz_str[ 77]) -#define zProg (option_usage_text.apz_str[ 78]) -#define zProhib (option_usage_text.apz_str[ 79]) -#define zReorder (option_usage_text.apz_str[ 80]) -#define zReqFmt (option_usage_text.apz_str[ 81]) -#define zReqOptFmt (option_usage_text.apz_str[ 82]) -#define zReqThese (option_usage_text.apz_str[ 83]) -#define zReq_NoShrtTtl (option_usage_text.apz_str[ 84]) -#define zReq_ShrtTtl (option_usage_text.apz_str[ 85]) -#define zSepChars (option_usage_text.apz_str[ 86]) -#define zSetMembers (option_usage_text.apz_str[ 87]) -#define zSetMemberSettings (option_usage_text.apz_str[ 88]) -#define zShrtGnuOptFmt (option_usage_text.apz_str[ 89]) -#define zSixSpaces (option_usage_text.apz_str[ 90]) -#define zStdBoolArg (option_usage_text.apz_str[ 91]) -#define zStdBreak (option_usage_text.apz_str[ 92]) -#define zStdKeyArg (option_usage_text.apz_str[ 93]) -#define zStdKeyLArg (option_usage_text.apz_str[ 94]) -#define zStdNestArg (option_usage_text.apz_str[ 95]) -#define zStdNoArg (option_usage_text.apz_str[ 96]) -#define zStdNumArg (option_usage_text.apz_str[ 97]) -#define zStdOptArg (option_usage_text.apz_str[ 98]) -#define zStdReqArg (option_usage_text.apz_str[ 99]) -#define zStdStrArg (option_usage_text.apz_str[100]) -#define zTabHyp (option_usage_text.apz_str[101]) -#define zTabHypAnd (option_usage_text.apz_str[102]) -#define zTabout (option_usage_text.apz_str[103]) -#define zThreeSpaces (option_usage_text.apz_str[104]) -#define zTwoSpaces (option_usage_text.apz_str[105]) -#define zUpTo (option_usage_text.apz_str[106]) -#define zValidKeys (option_usage_text.apz_str[107]) +#define zIllOptChr (option_usage_text.apz_str[ 52]) +#define zIllOptStr (option_usage_text.apz_str[ 53]) +#define zIllegal (option_usage_text.apz_str[ 54]) +#define zIntRange (option_usage_text.apz_str[ 55]) +#define zInvalOptDesc (option_usage_text.apz_str[ 56]) +#define zLowerBits (option_usage_text.apz_str[ 57]) +#define zMembers (option_usage_text.apz_str[ 58]) +#define zMisArg (option_usage_text.apz_str[ 59]) +#define zMultiEquiv (option_usage_text.apz_str[ 60]) +#define zMust (option_usage_text.apz_str[ 61]) +#define zNeedOne (option_usage_text.apz_str[ 62]) +#define zNoArg (option_usage_text.apz_str[ 63]) +#define zNoArgv (option_usage_text.apz_str[ 64]) +#define zNoArgs (option_usage_text.apz_str[ 65]) +#define zNoCreat (option_usage_text.apz_str[ 66]) +#define zNoFlags (option_usage_text.apz_str[ 67]) +#define zNoKey (option_usage_text.apz_str[ 68]) +#define zNoLim (option_usage_text.apz_str[ 69]) +#define zNoPreset (option_usage_text.apz_str[ 70]) +#define zNoResetArg (option_usage_text.apz_str[ 71]) +#define zNoRq_NoShrtTtl (option_usage_text.apz_str[ 72]) +#define zNoRq_ShrtTtl (option_usage_text.apz_str[ 73]) +#define zNoStat (option_usage_text.apz_str[ 74]) +#define zNoState (option_usage_text.apz_str[ 75]) +#define zNone (option_usage_text.apz_str[ 76]) +#define zNotDef (option_usage_text.apz_str[ 77]) +#define zNotCmdOpt (option_usage_text.apz_str[ 78]) +#define zNotEnough (option_usage_text.apz_str[ 79]) +#define zNotFile (option_usage_text.apz_str[ 80]) +#define zNotNumber (option_usage_text.apz_str[ 81]) +#define zNotDate (option_usage_text.apz_str[ 82]) +#define zNotDuration (option_usage_text.apz_str[ 83]) +#define zNrmOptFmt (option_usage_text.apz_str[ 84]) +#define zNumberOpt (option_usage_text.apz_str[ 85]) +#define zOneSpace (option_usage_text.apz_str[ 86]) +#define zOnlyOne (option_usage_text.apz_str[ 87]) +#define zOptsOnly (option_usage_text.apz_str[ 88]) +#define zOutputFail (option_usage_text.apz_str[ 89]) +#define zPathFmt (option_usage_text.apz_str[ 90]) +#define zPlsSendBugs (option_usage_text.apz_str[ 91]) +#define zPreset (option_usage_text.apz_str[ 92]) +#define zPresetFile (option_usage_text.apz_str[ 93]) +#define zPresetIntro (option_usage_text.apz_str[ 94]) +#define zProhib (option_usage_text.apz_str[ 95]) +#define zReorder (option_usage_text.apz_str[ 96]) +#define zRange (option_usage_text.apz_str[ 97]) +#define zRangeAbove (option_usage_text.apz_str[ 98]) +#define zRangeLie (option_usage_text.apz_str[ 99]) +#define zRangeOnly (option_usage_text.apz_str[100]) +#define zRangeOr (option_usage_text.apz_str[101]) +#define zRangeErr (option_usage_text.apz_str[102]) +#define zRangeExact (option_usage_text.apz_str[103]) +#define zRangeScaled (option_usage_text.apz_str[104]) +#define zRangeUpto (option_usage_text.apz_str[105]) +#define zResetNotConfig (option_usage_text.apz_str[106]) +#define zReqFmt (option_usage_text.apz_str[107]) +#define zReqOptFmt (option_usage_text.apz_str[108]) +#define zReqThese (option_usage_text.apz_str[109]) +#define zReq_NoShrtTtl (option_usage_text.apz_str[110]) +#define zReq_ShrtTtl (option_usage_text.apz_str[111]) +#define zSepChars (option_usage_text.apz_str[112]) +#define zSetMemberSettings (option_usage_text.apz_str[113]) +#define zShrtGnuOptFmt (option_usage_text.apz_str[114]) +#define zSixSpaces (option_usage_text.apz_str[115]) +#define zStdBoolArg (option_usage_text.apz_str[116]) +#define zStdBreak (option_usage_text.apz_str[117]) +#define zStdFileArg (option_usage_text.apz_str[118]) +#define zStdKeyArg (option_usage_text.apz_str[119]) +#define zStdKeyLArg (option_usage_text.apz_str[120]) +#define zStdTimeArg (option_usage_text.apz_str[121]) +#define zStdNestArg (option_usage_text.apz_str[122]) +#define zStdNoArg (option_usage_text.apz_str[123]) +#define zStdNumArg (option_usage_text.apz_str[124]) +#define zStdOptArg (option_usage_text.apz_str[125]) +#define zStdReqArg (option_usage_text.apz_str[126]) +#define zStdStrArg (option_usage_text.apz_str[127]) +#define zTabHyp (option_usage_text.apz_str[128]) +#define zTabHypAnd (option_usage_text.apz_str[129]) +#define zTabout (option_usage_text.apz_str[130]) +#define zThreeSpaces (option_usage_text.apz_str[131]) +#define zTwoSpaces (option_usage_text.apz_str[132]) +#define zUpTo (option_usage_text.apz_str[133]) +#define zValidKeys (option_usage_text.apz_str[134]) /* * First, set up the strings. Some of these are writable. These are all in @@ -180,19 +209,28 @@ extern usage_text_t option_usage_text; static char eng_zGnuBoolArg[] = "=T/F"; static char eng_zGnuKeyArg[] = "=KWd"; + static char eng_zGnuFileArg[] = "=file"; static char eng_zGnuKeyLArg[] = "=Mbr"; + static char eng_zGnuTimeArg[] = "=Tim"; static char eng_zGnuNumArg[] = "=num"; static char eng_zGnuStrArg[] = "=str"; -static char const usage_txt[3208] = +static char const usage_txt[4435] = + "malloc of %d bytes failed\n\0" "AutoOpts function called without option descriptor\n\0" "\tThis exceeds the compiled library version: \0" "Automated Options Processing Error!\n" "\t%s called AutoOpts function with structure version %d:%d:%d.\n\0" + "realloc of %d bytes at 0x%p failed\n\0" "\tThis is less than the minimum library version: \0" + "strdup of %d byte string failed\n\0" + "Automated Options version %s\n" + "\tcopyright (c) 1999-2011 by Bruce Korb - all rights reserved\n\0" + "AutoOpts lib error: defaulted to option with optional arg\n\0" + "(AutoOpts bug): Aliasing option is out of range.\0" "all\0" "\t\t\t\t- an alternate for %s\n\0" "%s error: the keyword `%s' is ambiguous for %s\n\0" - "ambiguous\0" + "%s: ambiguous option -- %s\n\0" "%s: Command line arguments required\n\0" "%d %s%s options allowed\n\0" "version and help options:\0" @@ -203,19 +241,33 @@ static char const usage_txt[3208] = "\t'n' - version and copyright notice\n\0" "ERROR: %s option conflicts with the %s option\n\0" "%s(optionSaveState): error: cannot allocate %d bytes\n\0" + "auto-options\0" + "program\0" "\t\t\t\t- default option for unnamed options\n\0" "\t\t\t\t- disabled as --%s\n\0" + "%s: The ``%s'' option has been disabled\0" + " --- %-14s %s\n\0" + "This option has been disabled\0" "\t\t\t\t- enabled by default\n\0" "-equivalence\0" "ERROR: only \0" " - examining environment variables named %s_*\n\0" " \0" - "Options are specified by doubled hyphens and their name\n" - "or by a single hyphen and the flag character.\n\0" + "Options are specified by doubled hyphens and their name or by a single\n" + "hyphen and the flag character.\n\0" "%%-%ds %%s\n\0" "fs error %d (%s) on fork - cannot obtain %s usage\n\0" + "fs error %d (%s) on freopen\n\0" "File error %d (%s) opening %s for loading options\n\0" "fs error %d (%s) reading file %s\n\0" + "fs error %d (%s) on %s %s for option %s\n\0" + "stat-ing for directory\0" + "stat-ing for regular file\0" + "stat-ing for non-existant file\0" + "open-ing file\0" + "fopen-ing file\0" + "\t\t\t\t- file must not pre-exist\n\0" + "\t\t\t\t- file must pre-exist\n\0" "\n" "= = = = = = = =\n\n" "This incarnation of genshell will produce\n" @@ -226,20 +278,11 @@ static char const usage_txt[3208] = "[=arg]\0" "--%2$s%1$s\0" "%s: illegal option -- %c\n\0" - "%s: %s option -- %s\n\0" + "%s: illegal option -- %s\n\0" "illegal\0" + " or an integer from %d through %d\n\0" "AutoOpts ERROR: invalid option descriptor for %s\n\0" - "words=\0" - "cooked\0" - "keep\0" - "type=\0" - "uncooked\0" - "integer\0" - "nested\0" - "string\0" - "bool\0" - "keyword\0" - "set\0" + " or an integer mask with any of the lower %d bits set\n\0" "\t\t\t\t- is a set membership option\n\0" "%s: option `%s' requires an argument\n\0" "Equivalenced option '%s' was equivalenced to both\n" @@ -247,26 +290,32 @@ static char const usage_txt[3208] = "\t\t\t\t- must appear between %d and %d times\n\0" "ERROR: The %s option is required\n\0" "%s: option `%s' cannot have an argument\n\0" + "%s: cannot allocate new argument vector\n\0" "%s: Command line arguments not allowed\n\0" "error %d (%s) creating %s\n\0" "Options are specified by single or double hyphens and their name.\n\0" "%s error: `%s' does not match any %s keywords\n\0" "\t\t\t\t- may appear multiple times\n\0" "\t\t\t\t- may not be preset\n\0" + "The 'reset-option' option requires an argument\n\0" " Arg Option-Name Description\n\0" " Flg Arg Option-Name Description\n\0" "error %d (%s) stat-ing %s\n\0" "%s(optionRestore): error: no saved option state\n\0" "none\0" "'%s' not defined\n\0" + "'%s' is not a command line option\n\0" "ERROR: The %s option must appear %d times\n\0" "error: cannot load options from non-regular file %s\n\0" "%s error: `%s' is not a recognizable number\n\0" + "%s error: `%s' is not a recognizable date/time\n\0" + "%s error: `%s' is not a recognizable time duration\n\0" " %3s %s\0" "The '-#<number>' option may omit the hash char\n\0" " \0" "one %s%s option allowed\n\0" "All arguments are named options.\n\0" + "Write failure to output file\0" " - reading file %s\0" "\n" "please send bug reports to: %s\n\0" @@ -275,16 +324,24 @@ static char const usage_txt[3208] = "# %s#\n\0" "\n" "The following option preset mechanisms are supported:\n\0" - "program\0" "prohibits these options:\n\0" "Operands and options may be intermixed. They will be reordered.\n\0" + "%s%ld to %ld\0" + "%sgreater than or equal to %ld\0" + "%sIt must lie in one of the ranges:\n\0" + "%sIt must be in the range:\n\0" + ", or\n\0" + "%s error: %s option value ``%s'' is out of range.\n\0" + "%s%ld exactly\0" + "%sis scalable with a suffix: k/K/m/M/g/G/t/T\n\0" + "%sless than or equal to %ld\0" + "The --reset-option has not been configured.\n\0" "ERROR: %s option requires the %s option\n\0" " %3s %-14s %s\0" "requires these options:\n\0" " Arg Option-Name Req? Description\n\0" " Flg Arg Option-Name Req? Description\n\0" "-_^\0" - "members=\0" "or you may use a numeric representation. Preceding these with a '!' will\n" "clear the bits, specifying 'none' will clear all bits, and 'all' will set them\n" "all. Multiple entries may be passed as an option argument list.\n\0" @@ -294,8 +351,10 @@ static char const usage_txt[3208] = "\n" "%s\n\n" "%s\0" + "Fil\0" "KWd\0" "Mbr\0" + "Tim\0" "Cpx\0" "no \0" "Num\0" @@ -317,37 +376,44 @@ static char const usage_txt[3208] = * Aren't you glad you don't maintain this by hand? */ usage_text_t option_usage_text = { - 113, - eng_zGnuBoolArg, eng_zGnuKeyArg, eng_zGnuKeyLArg, eng_zGnuNumArg, - eng_zGnuStrArg, + 142, + eng_zGnuBoolArg, eng_zGnuKeyArg, eng_zGnuFileArg, eng_zGnuKeyLArg, + eng_zGnuTimeArg, eng_zGnuNumArg, eng_zGnuStrArg, { - usage_txt + 0, usage_txt + 52, usage_txt + 98, usage_txt + 197, - usage_txt + 247, usage_txt + 251, usage_txt + 278, usage_txt + 327, - usage_txt + 337, usage_txt + 374, usage_txt + 399, usage_txt + 425, - usage_txt + 465, usage_txt + 602, usage_txt + 650, usage_txt + 704, - usage_txt + 746, usage_txt + 770, usage_txt + 796, usage_txt + 809, - usage_txt + 823, usage_txt + 870, usage_txt + 876, usage_txt + 979, - usage_txt + 991, usage_txt +1042, usage_txt +1093, usage_txt +1127, - usage_txt +1233, usage_txt +1239, usage_txt +1245, usage_txt +1252, - usage_txt +1263, usage_txt +1289, usage_txt +1310, usage_txt +1318, - usage_txt +1369, usage_txt +1376, usage_txt +1383, usage_txt +1388, - usage_txt +1394, usage_txt +1403, usage_txt +1411, usage_txt +1418, - usage_txt +1425, usage_txt +1430, usage_txt +1438, usage_txt +1442, - usage_txt +1476, usage_txt +1514, usage_txt +1579, usage_txt +1622, - usage_txt +1657, usage_txt +1698, usage_txt +1738, usage_txt +1765, - usage_txt +1832, usage_txt +1880, usage_txt +1913, usage_txt +1938, - usage_txt +1973, usage_txt +2011, usage_txt +2038, usage_txt +2087, - usage_txt +2092, usage_txt +2110, usage_txt +2154, usage_txt +2208, - usage_txt +2254, usage_txt +2262, usage_txt +2310, usage_txt +2312, - usage_txt +2337, usage_txt +2371, usage_txt +2390, usage_txt +2424, - usage_txt +2460, usage_txt +2498, usage_txt +2554, usage_txt +2562, - usage_txt +2588, usage_txt +2654, usage_txt +2696, usage_txt +2710, - usage_txt +2735, usage_txt +2775, usage_txt +2818, usage_txt +2822, - usage_txt +2831, usage_txt +3050, usage_txt +3053, usage_txt +3060, - usage_txt +3064, usage_txt +3072, usage_txt +3076, usage_txt +3080, - usage_txt +3084, usage_txt +3088, usage_txt +3092, usage_txt +3096, - usage_txt +3100, usage_txt +3104, usage_txt +3111, usage_txt +3123, - usage_txt +3131, usage_txt +3135, usage_txt +3138, usage_txt +3171 + usage_txt + 0, usage_txt + 27, usage_txt + 79, usage_txt + 125, + usage_txt + 224, usage_txt + 260, usage_txt + 310, usage_txt + 343, + usage_txt + 434, usage_txt + 493, usage_txt + 543, usage_txt + 547, + usage_txt + 574, usage_txt + 623, usage_txt + 651, usage_txt + 688, + usage_txt + 713, usage_txt + 739, usage_txt + 779, usage_txt + 916, + usage_txt + 964, usage_txt +1018, usage_txt +1031, usage_txt +1039, + usage_txt +1081, usage_txt +1105, usage_txt +1145, usage_txt +1160, + usage_txt +1190, usage_txt +1216, usage_txt +1229, usage_txt +1243, + usage_txt +1290, usage_txt +1296, usage_txt +1399, usage_txt +1411, + usage_txt +1462, usage_txt +1491, usage_txt +1542, usage_txt +1576, + usage_txt +1617, usage_txt +1640, usage_txt +1666, usage_txt +1697, + usage_txt +1711, usage_txt +1726, usage_txt +1757, usage_txt +1784, + usage_txt +1890, usage_txt +1896, usage_txt +1902, usage_txt +1909, + usage_txt +1920, usage_txt +1946, usage_txt +1972, usage_txt +1980, + usage_txt +2016, usage_txt +2067, usage_txt +2123, usage_txt +2157, + usage_txt +2195, usage_txt +2260, usage_txt +2303, usage_txt +2338, + usage_txt +2379, usage_txt +2420, usage_txt +2460, usage_txt +2487, + usage_txt +2554, usage_txt +2602, usage_txt +2635, usage_txt +2660, + usage_txt +2708, usage_txt +2743, usage_txt +2781, usage_txt +2808, + usage_txt +2857, usage_txt +2862, usage_txt +2880, usage_txt +2915, + usage_txt +2959, usage_txt +3013, usage_txt +3059, usage_txt +3108, + usage_txt +3161, usage_txt +3169, usage_txt +3217, usage_txt +3219, + usage_txt +3244, usage_txt +3278, usage_txt +3307, usage_txt +3326, + usage_txt +3360, usage_txt +3396, usage_txt +3434, usage_txt +3490, + usage_txt +3516, usage_txt +3582, usage_txt +3595, usage_txt +3626, + usage_txt +3663, usage_txt +3691, usage_txt +3697, usage_txt +3749, + usage_txt +3763, usage_txt +3809, usage_txt +3837, usage_txt +3882, + usage_txt +3924, usage_txt +3938, usage_txt +3963, usage_txt +4003, + usage_txt +4046, usage_txt +4050, usage_txt +4269, usage_txt +4272, + usage_txt +4279, usage_txt +4283, usage_txt +4291, usage_txt +4295, + usage_txt +4299, usage_txt +4303, usage_txt +4307, usage_txt +4311, + usage_txt +4315, usage_txt +4319, usage_txt +4323, usage_txt +4327, + usage_txt +4331, usage_txt +4338, usage_txt +4350, usage_txt +4358, + usage_txt +4362, usage_txt +4365, usage_txt +4398 } }; diff --git a/sntp/libopts/boolean.c b/sntp/libopts/boolean.c index 37148a9..8079231 100644 --- a/sntp/libopts/boolean.c +++ b/sntp/libopts/boolean.c @@ -1,55 +1,33 @@ -/* - * $Id: boolean.c,v 4.10 2007/02/04 17:44:12 bkorb Exp $ - * Time-stamp: "2007-01-13 10:10:39 bkorb" +/** + * \file boolean.c + * + * Time-stamp: "2010-07-10 11:02:10 bkorb" * * Automated Options Paged Usage module. * * This routine will run run-on options through a pager so the * user may examine, print or edit them at their leisure. - */ - -/* - * Automated Options copyright 1992-2007 Bruce Korb * - * Automated Options is free software. - * You may 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 file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved * - * Automated Options 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. + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. * - * You should have received a copy of the GNU General Public License - * along with Automated Options. See the file "COPYING". If not, - * write to: The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" * - * As a special exception, Bruce Korb gives permission for additional - * uses of the text contained in his release of AutoOpts. + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" * - * The exception is that, if you link the AutoOpts library with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the AutoOpts library code into it. + * These files have the following md5sums: * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. - * - * This exception applies only to the code released by Bruce Korb under - * the name AutoOpts. If you copy code from other sources under the - * General Public License into a copy of AutoOpts, as the General Public - * License permits, the exception does not apply to the code that you add - * in this way. To avoid misleading anyone as to the status of such - * modified files, you must delete this exception notice from them. - * - * If you write modifications of your own for AutoOpts, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd */ /*=export_func optionBooleanVal @@ -70,6 +48,14 @@ optionBooleanVal( tOptions* pOpts, tOptDesc* pOD ) char* pz; ag_bool res = AG_TRUE; + if ((pOD->fOptState & OPTST_RESET) != 0) + return; + + if (pOD->optArg.argString == NULL) { + pOD->optArg.argBool = AG_FALSE; + return; + } + switch (*(pOD->optArg.argString)) { case '0': { diff --git a/sntp/libopts/compat/compat.h b/sntp/libopts/compat/compat.h index b3bd58f..230aef9 100644 --- a/sntp/libopts/compat/compat.h +++ b/sntp/libopts/compat/compat.h @@ -1,13 +1,50 @@ /* -*- Mode: C -*- */ -/* --- fake the preprocessor into handlng portability */ -/* - * Time-stamp: "2007-02-03 17:41:06 bkorb" +/** + * \file compat.h --- fake the preprocessor into handlng portability + * + * Time-stamp: "2010-07-16 15:11:57 bkorb" + * + * compat.h is free software. + * This file is part of AutoGen. + * + * AutoGen Copyright (c) 1992-2011 by Bruce Korb - all rights reserved + * + * AutoGen is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AutoGen 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. * - * Author: Gary V Vaughan <gvaughan@oranda.demon.co.uk> - * Created: Mon Jun 30 15:54:46 1997 + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. * - * $Id: compat.h,v 4.16 2007/04/27 01:10:47 bkorb Exp $ + * As a special exception, Bruce Korb gives permission for additional + * uses of the text contained in the release of compat.h. + * + * The exception is that, if you link the compat.h library with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the compat.h library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by Bruce Korb under + * the name compat.h. If you copy code from other sources under the + * General Public License into a copy of compat.h, as the General Public + * License permits, the exception does not apply to the code that you add + * in this way. To avoid misleading anyone as to the status of such + * modified files, you must delete this exception notice from them. + * + * If you write modifications of your own for compat.h, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. */ #ifndef COMPAT_H_GUARD #define COMPAT_H_GUARD 1 @@ -221,57 +258,89 @@ #endif #ifndef SHORT_MAX -# define SHORT_MAX ~(1 << (8*sizeof(short) -1)) +# define SHORT_MAX ~(1 << (8*sizeof(short) - 1)) #else # define USHORT_MAX ~(OUS) #endif #ifndef HAVE_INT8_T - typedef signed char int8_t; + typedef signed char int8_t; +# define HAVE_INT8_T 1 #endif #ifndef HAVE_UINT8_T - typedef unsigned char uint8_t; + typedef unsigned char uint8_t; +# define HAVE_UINT8_T 1 #endif #ifndef HAVE_INT16_T - typedef signed short int16_t; + typedef signed short int16_t; +# define HAVE_INT16_T 1 #endif #ifndef HAVE_UINT16_T - typedef unsigned short uint16_t; -#endif -#ifndef HAVE_UINT_T - typedef unsigned int uint_t; + typedef unsigned short uint16_t; +# define HAVE_UINT16_T 1 #endif #ifndef HAVE_INT32_T -# if SIZEOF_INT == 4 - typedef signed int int32_t; -# elif SIZEOF_LONG == 4 - typedef signed long int32_t; +# if SIZEOF_INT == 4 + typedef signed int int32_t; +# elif SIZEOF_LONG == 4 + typedef signed long int32_t; # endif +# define HAVE_INT32_T 1 #endif #ifndef HAVE_UINT32_T -# if SIZEOF_INT == 4 - typedef unsigned int uint32_t; -# elif SIZEOF_LONG == 4 - typedef unsigned long uint32_t; +# if SIZEOF_INT == 4 + typedef unsigned int uint32_t; +# elif SIZEOF_LONG == 4 + typedef unsigned long uint32_t; # else # error Cannot create a uint32_t type. Choke Me. # endif +# define HAVE_UINT32_T 1 #endif #ifndef HAVE_INTPTR_T - typedef signed long intptr_t; +# if SIZEOF_CHARP == SIZEOF_LONG + typedef signed long intptr_t; +# else + typedef signed int intptr_t; +# endif +# define HAVE_INTPTR_T 1 #endif + #ifndef HAVE_UINTPTR_T - typedef unsigned long uintptr_t; +# if SIZEOF_CHARP == SIZEOF_LONG + typedef unsigned long intptr_t; +# else + typedef unsigned int intptr_t; +# endif +# define HAVE_INTPTR_T 1 +#endif + +#ifndef HAVE_UINT_T + typedef unsigned int uint_t; +# define HAVE_UINT_T 1 +#endif + +#ifndef HAVE_SIZE_T + typedef unsigned int size_t; +# define HAVE_SIZE_T 1 +#endif +#ifndef HAVE_WINT_T + typedef unsigned int wint_t; +# define HAVE_WINT_T 1 +#endif +#ifndef HAVE_PID_T + typedef signed int pid_t; +# define HAVE_PID_T 1 #endif /* redefine these for BSD style string libraries */ #ifndef HAVE_STRCHR -# define strchr index -# define strrchr rindex +# define strchr index +# define strrchr rindex #endif #ifdef USE_FOPEN_BINARY diff --git a/sntp/libopts/compat/pathfind.c b/sntp/libopts/compat/pathfind.c index 96eb771..2d5b27d 100644 --- a/sntp/libopts/compat/pathfind.c +++ b/sntp/libopts/compat/pathfind.c @@ -4,12 +4,7 @@ /* * Author: Gary V Vaughan <gvaughan@oranda.demon.co.uk> - * Time-stamp: "2006-09-23 19:46:16 bkorb" - * Created: Tue Jun 24 15:07:31 1997 - * Last Modified: $Date: 2006/11/27 01:52:23 $ - * by: bkorb - * - * $Id: pathfind.c,v 4.10 2006/11/27 01:52:23 bkorb Exp $ + * Time-stamp: "2010-07-17 09:50:32 bkorb" */ /* Code: */ diff --git a/sntp/libopts/compat/windows-config.h b/sntp/libopts/compat/windows-config.h index 2612980..360af10 100644 --- a/sntp/libopts/compat/windows-config.h +++ b/sntp/libopts/compat/windows-config.h @@ -1,8 +1,23 @@ /* - * Time-stamp: "2006-10-14 14:55:09 bkorb" - * by: bkorb - * Last Committed: $Date: 2007/04/28 22:19:23 $ + * Time-stamp: "2010-02-24 08:39:04 bkorb" + * + * This file is part of AutoGen. + * + * AutoGen Copyright (c) 1992-2011 by Bruce Korb - all rights reserved + * + * AutoGen is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AutoGen is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef WINDOWS_CONFIG_HACKERY #define WINDOWS_CONFIG_HACKERY 1 diff --git a/sntp/libopts/configfile.c b/sntp/libopts/configfile.c index e0b8a74..35e82d5 100644 --- a/sntp/libopts/configfile.c +++ b/sntp/libopts/configfile.c @@ -1,112 +1,79 @@ -/* - * $Id: configfile.c,v 1.21 2007/04/15 19:01:18 bkorb Exp $ - * Time-stamp: "2007-04-15 11:22:46 bkorb" - * - * configuration/rc/ini file handling. - */ - -/* - * Automated Options copyright 1992-2007 Bruce Korb +/** + * \file configfile.c * - * Automated Options is free software. - * You may 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. + * Time-stamp: "2011-04-06 09:31:24 bkorb" * - * Automated Options 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. + * configuration/rc/ini file handling. * - * You should have received a copy of the GNU General Public License - * along with Automated Options. See the file "COPYING". If not, - * write to: The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * This file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved * - * As a special exception, Bruce Korb gives permission for additional - * uses of the text contained in his release of AutoOpts. + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. * - * The exception is that, if you link the AutoOpts library with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the AutoOpts library code into it. + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" * - * This exception applies only to the code released by Bruce Korb under - * the name AutoOpts. If you copy code from other sources under the - * General Public License into a copy of AutoOpts, as the General Public - * License permits, the exception does not apply to the code that you add - * in this way. To avoid misleading anyone as to the status of such - * modified files, you must delete this exception notice from them. + * These files have the following md5sums: * - * If you write modifications of your own for AutoOpts, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd */ +static void +set_usage_flags(tOptions * opts, char const * flg_txt); + /* = = = START-STATIC-FORWARD = = = */ -/* static forward declarations maintained by :mkfwd */ static void -filePreset( - tOptions* pOpts, - char const* pzFileName, - int direction ); +file_preset(tOptions * opts, char const * fname, int dir); static char* -handleComment( char* pzText ); +handle_comment(char* pzText); -static char* -handleConfig( - tOptions* pOpts, - tOptState* pOS, - char* pzText, - int direction ); +static char * +handle_cfg(tOptions * pOpts, tOptState * pOS, char * pzText, int dir); -static char* -handleDirective( - tOptions* pOpts, - char* pzText ); +static char * +handle_directive(tOptions * pOpts, char * pzText); -static char* -handleProgramSection( - tOptions* pOpts, - char* pzText ); +static char * +aoflags_directive(tOptions * pOpts, char * pzText); -static char* -handleStructure( - tOptions* pOpts, - tOptState* pOS, - char* pzText, - int direction ); +static char * +program_directive(tOptions * pOpts, char * pzText); -static char* -parseKeyWordType( - tOptions* pOpts, - char* pzText, - tOptionValue* pType ); +static char * +handle_section(tOptions * pOpts, char * pzText); -static char* -parseLoadMode( - char* pzText, - tOptionLoadMode* pMode ); +static int +parse_xml_encoding(char ** ppz); -static char* -parseSetMemType( - tOptions* pOpts, - char* pzText, - tOptionValue* pType ); +static char * +trim_xml_text(char * pztxt, char const * pznm, tOptionLoadMode mode); + +static void +cook_xml_text(char * pzData); + +static char * +handle_struct(tOptions * pOpts, tOptState * pOS, char * pzText, int dir); static char* -parseValueType( - char* pzText, - tOptionValue* pType ); +parse_keyword(tOptions * pOpts, char * pzText, tOptionValue * pType); static char* -skipUnknown( char* pzText ); +parse_set_mem(tOptions * pOpts, char * pzText, tOptionValue * pType); + +static char * +parse_value(char * pzText, tOptionValue * pType); + +static char * +skip_unkn(char* pzText); /* = = = END-STATIC-FORWARD = = = */ @@ -141,14 +108,14 @@ skipUnknown( char* pzText ); * @end itemize =*/ const tOptionValue* -configFileLoad( char const* pzFile ) +configFileLoad(char const* pzFile) { tmap_info_t cfgfile; tOptionValue* pRes = NULL; tOptionLoadMode save_mode = option_load_mode; char* pzText = - text_mmap( pzFile, PROT_READ, MAP_PRIVATE, &cfgfile ); + text_mmap(pzFile, PROT_READ, MAP_PRIVATE, &cfgfile); if (TEXT_MMAP_FAILED_ADDR(pzText)) return NULL; /* errno is set */ @@ -158,10 +125,10 @@ configFileLoad( char const* pzFile ) if (pRes == NULL) { int err = errno; - text_munmap( &cfgfile ); + text_munmap(&cfgfile); errno = err; } else - text_munmap( &cfgfile ); + text_munmap(&cfgfile); option_load_mode = save_mode; return pRes; @@ -193,8 +160,8 @@ configFileLoad( char const* pzFile ) * @end itemize =*/ const tOptionValue* -optionFindValue( const tOptDesc* pOptDesc, - char const* pzName, char const* pzVal ) +optionFindValue(const tOptDesc* pOptDesc, char const* pzName, + char const* pzVal) { const tOptionValue* pRes = NULL; @@ -224,7 +191,7 @@ optionFindValue( const tOptDesc* pOptDesc, while (--ct >= 0) { const tOptionValue* pOV = *(ppOV++); - const tOptionValue* pRV = optionGetValue( pOV, pzName ); + const tOptionValue* pRV = optionGetValue(pOV, pzName); if (pRV == NULL) continue; @@ -268,9 +235,9 @@ optionFindValue( const tOptDesc* pOptDesc, * @code{ENOENT} - no entry matched the given name. * @end itemize =*/ -const tOptionValue* -optionFindNextValue( const tOptDesc* pOptDesc, const tOptionValue* pPrevVal, - char const* pzName, char const* pzVal ) +tOptionValue const * +optionFindNextValue(const tOptDesc * pOptDesc, const tOptionValue * pPrevVal, + char const * pzName, char const * pzVal) { int foundOldVal = 0; tOptionValue* pRes = NULL; @@ -337,7 +304,7 @@ optionFindNextValue( const tOptDesc* pOptDesc, const tOptionValue* pPrevVal, * @end itemize =*/ const tOptionValue* -optionGetValue( const tOptionValue* pOld, char const* pzValName ) +optionGetValue(const tOptionValue* pOld, char const* pzValName) { tArgList* pAL; tOptionValue* pRes = NULL; @@ -358,7 +325,7 @@ optionGetValue( const tOptionValue* pOld, char const* pzValName ) else do { tOptionValue* pOV = *(papOV++); - if (strcmp( pOV->pzName, pzValName ) == 0) { + if (strcmp(pOV->pzName, pzValName) == 0) { pRes = pOV; break; } @@ -433,27 +400,24 @@ optionNextValue(tOptionValue const * pOVList,tOptionValue const * pOldOV ) } -/* filePreset - * +/** * Load a file containing presetting information (a configuration file). */ static void -filePreset( - tOptions* pOpts, - char const* pzFileName, - int direction ) +file_preset(tOptions * opts, char const * fname, int dir) { tmap_info_t cfgfile; - tOptState st = OPTSTATE_INITIALIZER(PRESET); - char* pzFileText = - text_mmap( pzFileName, PROT_READ|PROT_WRITE, MAP_PRIVATE, &cfgfile ); + tOptState optst = OPTSTATE_INITIALIZER(PRESET); + tAoUL st_flags = optst.flags; + char * ftext = + text_mmap(fname, PROT_READ|PROT_WRITE, MAP_PRIVATE, &cfgfile); - if (TEXT_MMAP_FAILED_ADDR(pzFileText)) + if (TEXT_MMAP_FAILED_ADDR(ftext)) return; - if (direction == DIRECTION_CALLED) { - st.flags = OPTST_DEFINED; - direction = DIRECTION_PROCESS; + if (dir == DIRECTION_CALLED) { + st_flags = OPTST_DEFINED; + dir = DIRECTION_PROCESS; } /* @@ -462,32 +426,33 @@ filePreset( * If this is called via "optionFileLoad", then the bit is not set * and we consider stuff set herein to be "set" by the client program. */ - if ((pOpts->fOptSet & OPTPROC_PRESETTING) == 0) - st.flags = OPTST_SET; + if ((opts->fOptSet & OPTPROC_PRESETTING) == 0) + st_flags = OPTST_SET; do { - while (isspace( (int)*pzFileText )) pzFileText++; + optst.flags = st_flags; + while (IS_WHITESPACE_CHAR(*ftext)) ftext++; - if (isalpha( (int)*pzFileText )) { - pzFileText = handleConfig( pOpts, &st, pzFileText, direction ); + if (IS_VAR_FIRST_CHAR(*ftext)) { + ftext = handle_cfg(opts, &optst, ftext, dir); - } else switch (*pzFileText) { + } else switch (*ftext) { case '<': - if (isalpha( (int)pzFileText[1] )) - pzFileText = handleStructure(pOpts, &st, pzFileText, direction); + if (IS_VAR_FIRST_CHAR(ftext[1])) + ftext = handle_struct(opts, &optst, ftext, dir); - else switch (pzFileText[1]) { + else switch (ftext[1]) { case '?': - pzFileText = handleDirective( pOpts, pzFileText ); + ftext = handle_directive(opts, ftext); break; case '!': - pzFileText = handleComment( pzFileText ); + ftext = handle_comment(ftext); break; case '/': - pzFileText = strchr( pzFileText+2, '>' ); - if (pzFileText++ != NULL) + ftext = strchr(ftext + 2, '>'); + if (ftext++ != NULL) break; default: @@ -496,65 +461,59 @@ filePreset( break; case '[': - pzFileText = handleProgramSection( pOpts, pzFileText ); + ftext = handle_section(opts, ftext); break; case '#': - pzFileText = strchr( pzFileText+1, '\n' ); + ftext = strchr(ftext + 1, '\n'); break; default: goto all_done; /* invalid format */ } - } while (pzFileText != NULL); + } while (ftext != NULL); - all_done: - text_munmap( &cfgfile ); +all_done: + text_munmap(&cfgfile); } -/* handleComment - * +/** * "pzText" points to a "<!" sequence. * Theoretically, we should ensure that it begins with "<!--", * but actually I don't care that much. It ends with "-->". */ static char* -handleComment( char* pzText ) +handle_comment(char* pzText) { - char* pz = strstr( pzText, "-->" ); + char* pz = strstr(pzText, "-->"); if (pz != NULL) pz += 3; return pz; } -/* handleConfig - * +/** * "pzText" points to the start of some value name. * The end of the entry is the end of the line that is not preceded by * a backslash escape character. The string value is always processed * in "cooked" mode. */ -static char* -handleConfig( - tOptions* pOpts, - tOptState* pOS, - char* pzText, - int direction ) +static char * +handle_cfg(tOptions * pOpts, tOptState * pOS, char * pzText, int dir) { char* pzName = pzText++; - char* pzEnd = strchr( pzText, '\n' ); + char* pzEnd = strchr(pzText, '\n'); if (pzEnd == NULL) return pzText + strlen(pzText); - while (ISNAMECHAR( (int)*pzText )) pzText++; - while (isspace( (int)*pzText )) pzText++; + while (IS_VALUE_NAME_CHAR(*pzText)) pzText++; + while (IS_WHITESPACE_CHAR(*pzText)) pzText++; if (pzText > pzEnd) { name_only: *pzEnd++ = NUL; - loadOptionLine( pOpts, pOS, pzName, direction, OPTION_LOAD_UNCOOKED ); + loadOptionLine(pOpts, pOS, pzName, dir, OPTION_LOAD_UNCOOKED); return pzEnd; } @@ -564,10 +523,10 @@ handleConfig( * is an invalid format and we give up parsing the text. */ if ((*pzText == '=') || (*pzText == ':')) { - while (isspace( (int)*++pzText )) ; + while (IS_WHITESPACE_CHAR(*++pzText)) ; if (pzText > pzEnd) goto name_only; - } else if (! isspace((int)pzText[-1])) + } else if (! IS_WHITESPACE_CHAR(pzText[-1])) return NULL; /* @@ -610,116 +569,334 @@ handleConfig( * "pzName" points to what looks like text for one option/configurable. * It is NUL terminated. Process it. */ - loadOptionLine( pOpts, pOS, pzName, direction, OPTION_LOAD_UNCOOKED ); + loadOptionLine(pOpts, pOS, pzName, dir, OPTION_LOAD_UNCOOKED); return pzEnd; } -/* handleDirective - * +/** * "pzText" points to a "<?" sequence. - * For the moment, we only handle "<?program" directives. + * We handle "<?program" and "<?auto-options" directives. + * All others are treated as comments. */ -static char* -handleDirective( - tOptions* pOpts, - char* pzText ) +static char * +handle_directive(tOptions * pOpts, char * pzText) { - char ztitle[32] = "<?"; - size_t title_len = strlen( zProg ); - size_t name_len; +# define DIRECTIVE_TABLE \ + _dt_(zCfgProg, program_directive) \ + _dt_(zCfgAO_Flags, aoflags_directive) + + typedef char * (directive_func_t)(tOptions *, char *); +# define _dt_(_s, _fn) _fn, + static directive_func_t * dir_disp[] = { + DIRECTIVE_TABLE + }; +# undef _dt_ + +# define _dt_(_s, _fn) 1 + + static int const dir_ct = DIRECTIVE_TABLE 0; + static char const * dir_names[DIRECTIVE_TABLE 0]; +# undef _dt_ + + int ix; + + if (dir_names[0] == NULL) { + ix = 0; +# define _dt_(_s, _fn) dir_names[ix++] = _s; + DIRECTIVE_TABLE; +# undef _dt_ + } - if ( (strncmp( pzText+2, zProg, title_len ) != 0) - || (! isspace( (int)pzText[title_len+2] )) ) { - pzText = strchr( pzText+2, '>' ); - if (pzText != NULL) - pzText++; - return pzText; + for (ix = 0; ix < dir_ct; ix++) { + size_t len = strlen(dir_names[ix]); + if ( (strncmp(pzText + 2, dir_names[ix], len) == 0) + && (! IS_VALUE_NAME_CHAR(pzText[len+2])) ) + return dir_disp[ix](pOpts, pzText + len + 2); } - name_len = strlen( pOpts->pzProgName ); - strcpy( ztitle+2, zProg ); - title_len += 2; + /* + * We don't know what this is. Skip it. + */ + pzText = strchr(pzText+2, '>'); + if (pzText != NULL) + pzText++; + return pzText; +} + +/** + * handle AutoOpts mode flags + */ +static char * +aoflags_directive(tOptions * pOpts, char * pzText) +{ + char * pz = pzText; + + while (IS_WHITESPACE_CHAR(*++pz)) ; + pzText = strchr(pz, '>'); + if (pzText != NULL) { + + size_t len = pzText - pz; + char * ftxt = AGALOC(len + 1, "aoflags"); + + memcpy(ftxt, pz, len); + ftxt[len] = NUL; + set_usage_flags(pOpts, ftxt); + AGFREE(ftxt); + + pzText++; + } + + return pzText; +} + +/** + * handle program segmentation of config file. + */ +static char * +program_directive(tOptions * pOpts, char * pzText) +{ + static char const ttlfmt[] = "<?"; + size_t ttl_len = sizeof(ttlfmt) + strlen(zCfgProg); + char * ttl = AGALOC(ttl_len, "prog title"); + size_t name_len = strlen(pOpts->pzProgName); + + memcpy(ttl, ttlfmt, sizeof(ttlfmt) - 1); + memcpy(ttl + sizeof(ttlfmt) - 1, zCfgProg, ttl_len - (sizeof(ttlfmt) - 1)); do { - pzText += title_len; + while (IS_WHITESPACE_CHAR(*++pzText)) ; - if (isspace((int)*pzText)) { - while (isspace((int)*pzText)) pzText++; - if ( (strneqvcmp( pzText, pOpts->pzProgName, (int)name_len) == 0) - && (pzText[name_len] == '>')) { - pzText += name_len + 1; - break; - } + if ( (strneqvcmp(pzText, pOpts->pzProgName, (int)name_len) == 0) + && (IS_END_XML_TOKEN_CHAR(pzText[name_len])) ) { + pzText += name_len; + break; } - pzText = strstr( pzText, ztitle ); + pzText = strstr(pzText, ttl); } while (pzText != NULL); + AGFREE(ttl); + if (pzText != NULL) + for (;;) { + if (*pzText == NUL) { + pzText = NULL; + break; + } + if (*(pzText++) == '>') + break; + } + return pzText; } -/* handleProgramSection - * +/** * "pzText" points to a '[' character. * The "traditional" [PROG_NAME] segmentation of the config file. * Do not ever mix with the "<?program prog-name>" variation. */ -static char* -handleProgramSection( - tOptions* pOpts, - char* pzText ) +static char * +handle_section(tOptions * pOpts, char * pzText) { - size_t len = strlen( pOpts->pzPROGNAME ); - if ( (strncmp( pzText+1, pOpts->pzPROGNAME, len ) == 0) + size_t len = strlen(pOpts->pzPROGNAME); + if ( (strncmp(pzText+1, pOpts->pzPROGNAME, len) == 0) && (pzText[len+1] == ']')) - return strchr( pzText + len + 2, '\n' ); + return strchr(pzText + len + 2, '\n'); if (len > 16) return NULL; { char z[24]; - sprintf( z, "[%s]", pOpts->pzPROGNAME ); - pzText = strstr( pzText, z ); + sprintf(z, "[%s]", pOpts->pzPROGNAME); + pzText = strstr(pzText, z); } if (pzText != NULL) - pzText = strchr( pzText, '\n' ); + pzText = strchr(pzText, '\n'); return pzText; } +/** + * parse XML encodings + */ +static int +parse_xml_encoding(char ** ppz) +{ +# define XMLTABLE \ + _xmlNm_(amp, '&') \ + _xmlNm_(lt, '<') \ + _xmlNm_(gt, '>') \ + _xmlNm_(ff, '\f') \ + _xmlNm_(ht, '\t') \ + _xmlNm_(cr, '\r') \ + _xmlNm_(vt, '\v') \ + _xmlNm_(bel, '\a') \ + _xmlNm_(nl, '\n') \ + _xmlNm_(space, ' ') \ + _xmlNm_(quot, '"') \ + _xmlNm_(apos, '\'') + + static struct { + char const * const nm_str; + unsigned short nm_len; + short nm_val; + } const xml_names[] = { +# define _xmlNm_(_n, _v) { #_n ";", sizeof(#_n), _v }, + XMLTABLE +# undef _xmlNm_ +# undef XMLTABLE + }; + + static int const nm_ct = sizeof(xml_names) / sizeof(xml_names[0]); + int base = 10; + + char * pz = *ppz; + + if (*pz == '#') { + pz++; + goto parse_number; + } + + if (IS_DEC_DIGIT_CHAR(*pz)) { + unsigned long v; + + parse_number: + switch (*pz) { + case 'x': case 'X': + /* + * Some forms specify hex with: &#xNN; + */ + base = 16; + pz++; + break; -/* handleStructure - * + case '0': + /* + *  is hex and  is decimal. Cool. + * Ya gotta love it. + */ + if (pz[1] == '0') + base = 16; + break; + } + + v = strtoul(pz, &pz, base); + if ((*pz != ';') || (v > 0x7F)) + return NUL; + *ppz = pz + 1; + return (int)v; + } + + { + int ix = 0; + do { + if (strncmp(pz, xml_names[ix].nm_str, xml_names[ix].nm_len) + == 0) { + *ppz = pz + xml_names[ix].nm_len; + return xml_names[ix].nm_val; + } + } while (++ix < nm_ct); + } + + return NUL; +} + +/** + * Find the end marker for the named section of XML. + * Trim that text there, trimming trailing white space for all modes + * except for OPTION_LOAD_UNCOOKED. + */ +static char * +trim_xml_text(char * pztxt, char const * pznm, tOptionLoadMode mode) +{ + static char const fmt[] = "</%s>"; + char z[64], *pz = z; + size_t len = strlen(pznm) + sizeof(fmt) - 2 /* for %s */; + + if (len > sizeof(z)) + pz = AGALOC(len, "scan name"); + + sprintf(pz, fmt, pznm); + *pztxt = ' '; + pztxt = strstr(pztxt, pz); + if (pz != z) AGFREE(pz); + + if (pztxt == NULL) + return pztxt; + + if (mode != OPTION_LOAD_UNCOOKED) + while (IS_WHITESPACE_CHAR(pztxt[-1])) len++, pztxt--; + + *pztxt = NUL; + return pztxt + len - 1 /* for NUL byte */; +} + +/** + */ +static void +cook_xml_text(char * pzData) +{ + char * pzs = pzData; + char * pzd = pzData; + char bf[4]; + bf[2] = NUL; + + for (;;) { + int ch = ((int)*(pzs++)) & 0xFF; + switch (ch) { + case NUL: + *pzd = NUL; + return; + + case '&': + *(pzd++) = \ + ch = parse_xml_encoding(&pzs); + if (ch == NUL) + return; + break; + + case '%': + bf[0] = *(pzs++); + bf[1] = *(pzs++); + if ((bf[0] == NUL) || (bf[1] == NUL)) { + *pzd = NUL; + return; + } + + ch = strtoul(bf, NULL, 16); + /* FALLTHROUGH */ + + default: + *(pzd++) = ch; + } + } +} + +/** * "pzText" points to a '<' character, followed by an alpha. * The end of the entry is either the "/>" following the name, or else a * "</name>" string. */ -static char* -handleStructure( - tOptions* pOpts, - tOptState* pOS, - char* pzText, - int direction ) +static char * +handle_struct(tOptions * pOpts, tOptState * pOS, char * pzText, int dir) { tOptionLoadMode mode = option_load_mode; - tOptionValue valu; + tOptionValue valu; char* pzName = ++pzText; char* pzData; char* pcNulPoint; - while (ISNAMECHAR( *pzText )) pzText++; + while (IS_VALUE_NAME_CHAR(*pzText)) pzText++; pcNulPoint = pzText; valu.valType = OPARG_TYPE_STRING; switch (*pzText) { case ' ': case '\t': - pzText = parseAttributes( pOpts, pzText, &mode, &valu ); + pzText = parseAttributes(pOpts, pzText, &mode, &valu); if (*pzText == '>') break; if (*pzText != '/') @@ -731,14 +908,14 @@ handleStructure( return NULL; *pzText = NUL; pzText += 2; - loadOptionLine( pOpts, pOS, pzName, direction, mode ); + loadOptionLine(pOpts, pOS, pzName, dir, mode); return pzText; case '>': break; default: - pzText = strchr( pzText, '>'); + pzText = strchr(pzText, '>'); if (pzText != NULL) pzText++; return pzText; @@ -750,28 +927,9 @@ handleStructure( */ *pcNulPoint = NUL; pzData = ++pzText; - - /* - * Find the end of the option text and NUL terminate it - */ - { - char z[64], *pz = z; - size_t len = strlen(pzName) + 4; - if (len > sizeof(z)) - pz = AGALOC(len, "scan name"); - - sprintf( pz, "</%s>", pzName ); - *pzText = ' '; - pzText = strstr( pzText, pz ); - if (pz != z) AGFREE(pz); - - if (pzText == NULL) - return pzText; - - *pzText = NUL; - - pzText += len-1; - } + pzText = trim_xml_text(pzText, pzName, mode); + if (pzText == NULL) + return pzText; /* * Rejoin the name and value for parsing by "loadOptionLine()". @@ -780,31 +938,47 @@ handleStructure( memset(pcNulPoint, ' ', pzData - pcNulPoint); /* + * If we are getting a "string" value that is to be cooked, + * then process the XML-ish &xx; XML-ish and %XX hex characters. + */ + if ( (valu.valType == OPARG_TYPE_STRING) + && (mode == OPTION_LOAD_COOKED)) + cook_xml_text(pzData); + + /* * "pzName" points to what looks like text for one option/configurable. * It is NUL terminated. Process it. */ - loadOptionLine( pOpts, pOS, pzName, direction, mode ); + loadOptionLine(pOpts, pOS, pzName, dir, mode); return pzText; } -/* internalFileLoad - * +/** * Load a configuration file. This may be invoked either from * scanning the "homerc" list, or from a specific file request. * (see "optionFileLoad()", the implementation for --load-opts) */ LOCAL void -internalFileLoad( tOptions* pOpts ) +internalFileLoad(tOptions* pOpts) { - int idx; - int inc = DIRECTION_PRESET; - char zFileName[ AG_PATH_MAX+1 ]; + uint32_t svfl; + int idx; + int inc; + char zFileName[ AG_PATH_MAX+1 ]; if (pOpts->papzHomeList == NULL) return; + svfl = pOpts->fOptSet; + inc = DIRECTION_PRESET; + + /* + * Never stop on errors in config files. + */ + pOpts->fOptSet &= ~OPTPROC_ERRSTOP; + /* * Find the last RC entry (highest priority entry) */ @@ -838,8 +1012,8 @@ internalFileLoad( tOptions* pOpts ) idx += inc; - if (! optionMakePath( zFileName, (int)sizeof(zFileName), - pzPath, pOpts->pzProgPath )) + if (! optionMakePath(zFileName, (int)sizeof(zFileName), + pzPath, pOpts->pzProgPath)) continue; /* @@ -847,23 +1021,23 @@ internalFileLoad( tOptions* pOpts ) * THEN append the Resource Configuration file name * ELSE we must have the complete file name */ - if (stat( zFileName, &StatBuf ) != 0) + if (stat(zFileName, &StatBuf) != 0) continue; /* bogus name - skip the home list entry */ - if (S_ISDIR( StatBuf.st_mode )) { - size_t len = strlen( zFileName ); - char* pz; + if (S_ISDIR(StatBuf.st_mode)) { + size_t len = strlen(zFileName); + size_t nln = strlen(pOpts->pzRcName) + 1; + char * pz = zFileName + len; - if (len + 1 + strlen( pOpts->pzRcName ) >= sizeof( zFileName )) + if (len + 1 + nln >= sizeof(zFileName)) continue; - pz = zFileName + len; if (pz[-1] != DIRCH) *(pz++) = DIRCH; - strcpy( pz, pOpts->pzRcName ); + memcpy(pz, pOpts->pzRcName, nln); } - filePreset( pOpts, zFileName, inc ); + file_preset(pOpts, zFileName, inc); /* * IF we are now to skip config files AND we are presetting, @@ -877,6 +1051,8 @@ internalFileLoad( tOptions* pOpts ) } } } /* twice for every path in the home list, ... */ + + pOpts->fOptSet = svfl; } @@ -914,13 +1090,18 @@ internalFileLoad( tOptions* pOpts ) * always be returned. =*/ int -optionFileLoad( tOptions* pOpts, char const* pzProgram ) +optionFileLoad(tOptions* pOpts, char const* pzProgram) { - if (! SUCCESSFUL( validateOptionsStruct( pOpts, pzProgram ))) + if (! SUCCESSFUL(validateOptionsStruct(pOpts, pzProgram))) return -1; - pOpts->pzProgName = pzProgram; - internalFileLoad( pOpts ); + { + char const ** pp = + (char const **)(void *)&(pOpts->pzProgName); + *pp = pzProgram; + } + + internalFileLoad(pOpts); return 0; } @@ -937,42 +1118,44 @@ optionFileLoad( tOptions* pOpts, char const* pzProgram ) * pOptDesc->optArg.argString. =*/ void -optionLoadOpt( tOptions* pOpts, tOptDesc* pOptDesc ) +optionLoadOpt(tOptions* pOpts, tOptDesc* pOptDesc) { + struct stat sb; + /* * IF the option is not being disabled, THEN load the file. There must * be a file. (If it is being disabled, then the disablement processing * already took place. It must be done to suppress preloading of ini/rc * files.) */ - if (! DISABLED_OPT( pOptDesc )) { - struct stat sb; - if (stat( pOptDesc->optArg.argString, &sb ) != 0) { - if ((pOpts->fOptSet & OPTPROC_ERRSTOP) == 0) - return; + if ( DISABLED_OPT(pOptDesc) + || ((pOptDesc->fOptState & OPTST_RESET) != 0)) + return; - fprintf( stderr, zFSErrOptLoad, errno, strerror( errno ), - pOptDesc->optArg.argString ); - exit(EX_NOINPUT); - /* NOT REACHED */ - } + if (stat(pOptDesc->optArg.argString, &sb) != 0) { + if ((pOpts->fOptSet & OPTPROC_ERRSTOP) == 0) + return; - if (! S_ISREG( sb.st_mode )) { - if ((pOpts->fOptSet & OPTPROC_ERRSTOP) == 0) - return; + fprintf(stderr, zFSErrOptLoad, errno, strerror(errno), + pOptDesc->optArg.argString); + exit(EX_NOINPUT); + /* NOT REACHED */ + } - fprintf( stderr, zNotFile, pOptDesc->optArg.argString ); - exit(EX_NOINPUT); - /* NOT REACHED */ - } + if (! S_ISREG(sb.st_mode)) { + if ((pOpts->fOptSet & OPTPROC_ERRSTOP) == 0) + return; - filePreset(pOpts, pOptDesc->optArg.argString, DIRECTION_CALLED); + fprintf(stderr, zNotFile, pOptDesc->optArg.argString); + exit(EX_NOINPUT); + /* NOT REACHED */ } + + file_preset(pOpts, pOptDesc->optArg.argString, DIRECTION_CALLED); } -/* parseAttributes - * +/** * Parse the various attributes of an XML-styled config file entry */ LOCAL char* @@ -982,238 +1165,163 @@ parseAttributes( tOptionLoadMode* pMode, tOptionValue* pType ) { - size_t lenLoadType = strlen( zLoadType ); - size_t lenKeyWords = strlen( zKeyWords ); - size_t lenSetMem = strlen( zSetMembers ); + size_t len; do { - switch (*pzText) { - case '/': pType->valType = OPARG_TYPE_NONE; - case '>': return pzText; + if (! IS_WHITESPACE_CHAR(*pzText)) + switch (*pzText) { + case '/': pType->valType = OPARG_TYPE_NONE; + case '>': return pzText; - default: - case NUL: return NULL; - - case ' ': - case '\t': - case '\n': - case '\f': - case '\r': - case '\v': + default: + case NUL: return NULL; + } + + while (IS_WHITESPACE_CHAR(*++pzText)) ; + len = 0; + while (IS_LOWER_CASE_CHAR(pzText[len])) len++; + + switch (find_xat_attribute_id(pzText, len)) { + case XAT_KWD_TYPE: + pzText = parse_value(pzText+len, pType); break; - } - while (isspace( (int)*++pzText )) ; + case XAT_KWD_WORDS: + pzText = parse_keyword(pOpts, pzText+len, pType); + break; - if (strncmp( pzText, zLoadType, lenLoadType ) == 0) { - pzText = parseValueType( pzText+lenLoadType, pType ); - continue; - } + case XAT_KWD_MEMBERS: + pzText = parse_set_mem(pOpts, pzText+len, pType); + break; - if (strncmp( pzText, zKeyWords, lenKeyWords ) == 0) { - pzText = parseKeyWordType( pOpts, pzText+lenKeyWords, pType ); - continue; - } + case XAT_KWD_COOKED: + pzText += len; + if (! IS_END_XML_TOKEN_CHAR(*pzText)) + goto invalid_kwd; - if (strncmp( pzText, zSetMembers, lenSetMem ) == 0) { - pzText = parseSetMemType( pOpts, pzText+lenSetMem, pType ); - continue; - } + *pMode = OPTION_LOAD_COOKED; + break; + + case XAT_KWD_UNCOOKED: + pzText += len; + if (! IS_END_XML_TOKEN_CHAR(*pzText)) + goto invalid_kwd; + + *pMode = OPTION_LOAD_UNCOOKED; + break; + + case XAT_KWD_KEEP: + pzText += len; + if (! IS_END_XML_TOKEN_CHAR(*pzText)) + goto invalid_kwd; - pzText = parseLoadMode( pzText, pMode ); + *pMode = OPTION_LOAD_KEEP; + break; + + default: + case XAT_KWD_INVALID: + invalid_kwd: + pType->valType = OPARG_TYPE_NONE; + return skip_unkn(pzText); + } } while (pzText != NULL); return pzText; } -/* parseKeyWordType - * +/** * "pzText" points to the character after "words=". * What should follow is a name of a keyword (enumeration) list. */ static char* -parseKeyWordType( - tOptions* pOpts, - char* pzText, - tOptionValue* pType ) +parse_keyword(tOptions * pOpts, char * pzText, tOptionValue * pType) { - return skipUnknown( pzText ); + return skip_unkn(pzText); } -/* parseLoadMode - * - * "pzText" points to some name character. We check for "cooked" or - * "uncooked" or "keep". This function should handle any attribute - * that does not have an associated value. - */ -static char* -parseLoadMode( - char* pzText, - tOptionLoadMode* pMode ) -{ - { - size_t len = strlen(zLoadCooked); - if (strncmp( pzText, zLoadCooked, len ) == 0) { - if ( (pzText[len] == '>') - || (pzText[len] == '/') - || isspace((int)pzText[len])) { - *pMode = OPTION_LOAD_COOKED; - return pzText + len; - } - goto unknown; - } - } - - { - size_t len = strlen(zLoadUncooked); - if (strncmp( pzText, zLoadUncooked, len ) == 0) { - if ( (pzText[len] == '>') - || (pzText[len] == '/') - || isspace((int)pzText[len])) { - *pMode = OPTION_LOAD_UNCOOKED; - return pzText + len; - } - goto unknown; - } - } - - { - size_t len = strlen(zLoadKeep); - if (strncmp( pzText, zLoadKeep, len ) == 0) { - if ( (pzText[len] == '>') - || (pzText[len] == '/') - || isspace((int)pzText[len])) { - *pMode = OPTION_LOAD_KEEP; - return pzText + len; - } - goto unknown; - } - } - - unknown: - return skipUnknown( pzText ); -} - - -/* parseSetMemType - * +/** * "pzText" points to the character after "members=" * What should follow is a name of a "set membership". * A collection of bit flags. */ static char* -parseSetMemType( - tOptions* pOpts, - char* pzText, - tOptionValue* pType ) +parse_set_mem(tOptions * pOpts, char * pzText, tOptionValue * pType) { - return skipUnknown( pzText ); + return skip_unkn(pzText); } -/* parseValueType - * +/** * "pzText" points to the character after "type=" */ -static char* -parseValueType( - char* pzText, - tOptionValue* pType ) +static char * +parse_value(char * pzText, tOptionValue * pType) { - { - size_t len = strlen(zLtypeString); - if (strncmp( pzText, zLtypeString, len ) == 0) { - if ((pzText[len] == '>') || isspace((int)pzText[len])) { - pType->valType = OPARG_TYPE_STRING; - return pzText + len; - } - goto unknown; - } - } + size_t len = 0; - { - size_t len = strlen(zLtypeInteger); - if (strncmp( pzText, zLtypeInteger, len ) == 0) { - if ((pzText[len] == '>') || isspace((int)pzText[len])) { - pType->valType = OPARG_TYPE_NUMERIC; - return pzText + len; - } - goto unknown; - } - } + if (*(pzText++) != '=') + goto woops; - { - size_t len = strlen(zLtypeBool); - if (strncmp( pzText, zLtypeBool, len ) == 0) { - if ((pzText[len] == '>') || isspace(pzText[len])) { - pType->valType = OPARG_TYPE_BOOLEAN; - return pzText + len; - } - goto unknown; - } - } + while (IS_OPTION_NAME_CHAR(pzText[len])) len++; + pzText += len; - { - size_t len = strlen(zLtypeKeyword); - if (strncmp( pzText, zLtypeKeyword, len ) == 0) { - if ((pzText[len] == '>') || isspace((int)pzText[len])) { - pType->valType = OPARG_TYPE_ENUMERATION; - return pzText + len; - } - goto unknown; - } + if ((len == 0) || (! IS_END_XML_TOKEN_CHAR(*pzText))) { + woops: + pType->valType = OPARG_TYPE_NONE; + return skip_unkn(pzText); } - { - size_t len = strlen(zLtypeSetMembership); - if (strncmp( pzText, zLtypeSetMembership, len ) == 0) { - if ((pzText[len] == '>') || isspace((int)pzText[len])) { - pType->valType = OPARG_TYPE_MEMBERSHIP; - return pzText + len; - } - goto unknown; - } - } + switch (find_value_type_id(pzText - len, len)) { + default: + case VTP_KWD_INVALID: goto woops; - { - size_t len = strlen(zLtypeNest); - if (strncmp( pzText, zLtypeNest, len ) == 0) { - if ((pzText[len] == '>') || isspace((int)pzText[len])) { - pType->valType = OPARG_TYPE_HIERARCHY; - return pzText + len; - } - goto unknown; - } + case VTP_KWD_STRING: + pType->valType = OPARG_TYPE_STRING; + break; + + case VTP_KWD_INTEGER: + pType->valType = OPARG_TYPE_NUMERIC; + break; + + case VTP_KWD_BOOL: + case VTP_KWD_BOOLEAN: + pType->valType = OPARG_TYPE_BOOLEAN; + break; + + case VTP_KWD_KEYWORD: + pType->valType = OPARG_TYPE_ENUMERATION; + break; + + case VTP_KWD_SET: + case VTP_KWD_SET_MEMBERSHIP: + pType->valType = OPARG_TYPE_MEMBERSHIP; + break; + + case VTP_KWD_NESTED: + case VTP_KWD_HIERARCHY: + pType->valType = OPARG_TYPE_HIERARCHY; } - unknown: - pType->valType = OPARG_TYPE_NONE; - return skipUnknown( pzText ); + return pzText; } -/* skipUnknown - * +/** * Skip over some unknown attribute */ -static char* -skipUnknown( char* pzText ) +static char * +skip_unkn(char* pzText) { for (;; pzText++) { - if (isspace( (int)*pzText )) return pzText; - switch (*pzText) { - case NUL: return NULL; - case '/': - case '>': return pzText; - } + if (IS_END_XML_TOKEN_CHAR(*pzText)) return pzText; + if (*pzText == NUL) return NULL; } } -/* validateOptionsStruct - * +/** * Make sure the option descriptor is there and that we understand it. * This should be called from any user entry point where one needs to * worry about validity. (Some entry points are free to assume that @@ -1221,11 +1329,11 @@ skipUnknown( char* pzText ) * already been called.) */ LOCAL tSuccess -validateOptionsStruct( tOptions* pOpts, char const* pzProgram ) +validateOptionsStruct(tOptions* pOpts, char const* pzProgram) { if (pOpts == NULL) { - fputs( zAO_Bad, stderr ); - exit( EX_CONFIG ); + fputs(zAO_Bad, stderr); + exit(EX_CONFIG); } /* @@ -1233,7 +1341,14 @@ validateOptionsStruct( tOptions* pOpts, char const* pzProgram ) * is available, then go do it. */ if ( ((pOpts->fOptSet & OPTPROC_TRANSLATE) != 0) - && (pOpts->pTransProc != 0) ) { + && (pOpts->pTransProc != NULL) ) { + /* + * If option names are not to be translated at all, then do not do + * it for configuration parsing either. (That is the bit that really + * gets tested anyway.) + */ + if ((pOpts->fOptSet & OPTPROC_NO_XLAT_MASK) == OPTPROC_NXLAT_OPT) + pOpts->fOptSet |= OPTPROC_NXLAT_OPT_CFG; (*pOpts->pTransProc)(); pOpts->fOptSet &= ~OPTPROC_TRANSLATE; } @@ -1247,14 +1362,16 @@ validateOptionsStruct( tOptions* pOpts, char const* pzProgram ) && ( (pOpts->structVersion > OPTIONS_STRUCT_VERSION ) || (pOpts->structVersion < OPTIONS_MINIMUM_VERSION ) ) ) { + static char const aover[] = + __STR(AO_CURRENT)":"__STR(AO_REVISION)":"__STR(AO_AGE)"\n"; - fprintf( stderr, zAO_Err, pOpts->origArgVect[0], - NUM_TO_VER( pOpts->structVersion )); + fprintf(stderr, zAO_Err, pzProgram, NUM_TO_VER(pOpts->structVersion)); if (pOpts->structVersion > OPTIONS_STRUCT_VERSION ) - fputs( zAO_Big, stderr ); + fputs(zAO_Big, stderr); else - fputs( zAO_Sml, stderr ); + fputs(zAO_Sml, stderr); + fwrite(aover, sizeof(aover) - 1, 1, stderr); return FAILURE; } @@ -1263,18 +1380,20 @@ validateOptionsStruct( tOptions* pOpts, char const* pzProgram ) * and the set of equivalent characters. */ if (pOpts->pzProgName == NULL) { - char const* pz = strrchr( pzProgram, DIRCH ); - + char const * pz = strrchr(pzProgram, DIRCH); + char const ** pp = + (char const **)(void **)&(pOpts->pzProgName); if (pz == NULL) - pOpts->pzProgName = pzProgram; - else pOpts->pzProgName = pz+1; + *pp = pzProgram; + else *pp = pz+1; - pOpts->pzProgPath = pzProgram; + pp = (char const **)(void **)&(pOpts->pzProgPath); + *pp = pzProgram; /* * when comparing long names, these are equivalent */ - strequate( zSepChars ); + strequate(zSepChars); } return SUCCESS; diff --git a/sntp/libopts/cook.c b/sntp/libopts/cook.c index bebd123..811ce59 100644 --- a/sntp/libopts/cook.c +++ b/sntp/libopts/cook.c @@ -1,57 +1,35 @@ - -/* - * $Id: cook.c,v 4.10 2007/02/04 17:44:12 bkorb Exp $ - * Time-stamp: "2006-09-24 15:21:02 bkorb" +/** + * \file cook.c + * + * Time-stamp: "2011-03-12 15:05:26 bkorb" * * This file contains the routines that deal with processing quoted strings * into an internal format. - */ - -/* - * Automated Options copyright 1992-2007 Bruce Korb - * - * Automated Options is free software. - * You may 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. - * - * Automated Options 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 Automated Options. See the file "COPYING". If not, - * write to: The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * This file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved * - * As a special exception, Bruce Korb gives permission for additional - * uses of the text contained in his release of AutoOpts. + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. * - * The exception is that, if you link the AutoOpts library with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the AutoOpts library code into it. + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" * - * This exception applies only to the code released by Bruce Korb under - * the name AutoOpts. If you copy code from other sources under the - * General Public License into a copy of AutoOpts, as the General Public - * License permits, the exception does not apply to the code that you add - * in this way. To avoid misleading anyone as to the status of such - * modified files, you must delete this exception notice from them. + * These files have the following md5sums: * - * If you write modifications of your own for AutoOpts, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd */ /* = = = START-STATIC-FORWARD = = = */ -/* static forward declarations maintained by :mkfwd */ +static ag_bool +contiguous_quote(char ** pps, char * pq, int * lnct_p); /* = = = END-STATIC-FORWARD = = = */ /*=export_func ao_string_cook_escape_char @@ -105,96 +83,132 @@ ao_string_cook_escape_char( char const* pzIn, char* pRes, u_int nl ) case 't': *pRes = '\t'; break; case 'v': *pRes = '\v'; break; - case 'x': /* HEX Escape */ - if (isxdigit( (int)*pzIn )) { - unsigned int val; - unsigned char ch = *pzIn++; - - if ((ch >= 'A') && (ch <= 'F')) - val = 10 + (ch - 'A'); - else if ((ch >= 'a') && (ch <= 'f')) - val = 10 + (ch - 'a'); - else val = ch - '0'; - - ch = *pzIn; + case 'x': + case 'X': /* HEX Escape */ + if (IS_HEX_DIGIT_CHAR(*pzIn)) { + char z[4], *pz = z; - if (! isxdigit( ch )) { - *pRes = val; - res = 2; - break; - } - val <<= 4; - if ((ch >= 'A') && (ch <= 'F')) - val += 10 + (ch - 'A'); - else if ((ch >= 'a') && (ch <= 'f')) - val += 10 + (ch - 'a'); - else val += ch - '0'; - - res = 3; - *pRes = val; + do *(pz++) = *(pzIn++); + while (IS_HEX_DIGIT_CHAR(*pzIn) && (pz < z + 2)); + *pz = NUL; + *pRes = (unsigned char)strtoul(z, NULL, 16); + res += pz - z; } break; - default: + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + { /* * IF the character copied was an octal digit, * THEN set the output character to an octal value */ - if (isdigit( (int)*pRes ) && (*pRes < '8')) { - unsigned int val = *pRes - '0'; - unsigned char ch = *pzIn++; + char z[4], *pz = z + 1; + unsigned long val; + z[0] = *pRes; + + while (IS_OCT_DIGIT_CHAR(*pzIn) && (pz < z + 3)) + *(pz++) = *(pzIn++); + *pz = NUL; + val = strtoul(z, NULL, 8); + if (val > 0xFF) + val = 0xFF; + *pRes = (unsigned char)val; + res = pz - z; + break; + } - /* - * IF the second character is *not* an octal digit, - * THEN save the value and bail - */ - if ((ch < '0') || (ch > '7')) { - *pRes = val; - break; - } + default: ; + } - val = (val<<3) + (ch - '0'); - ch = *pzIn; - res = 2; + return res; +} + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * A quoted string has been found. + * Find the end of it and compress any escape sequences. + */ +static ag_bool +contiguous_quote(char ** pps, char * pq, int * lnct_p) +{ + char * ps = *pps + 1; + for (;;) { + while (IS_WHITESPACE_CHAR(*ps)) + if (*(ps++) == '\n') + (*lnct_p)++; + + /* + * IF the next character is a quote character, + * THEN we will concatenate the strings. + */ + switch (*ps) { + case '"': + case '\'': + *pq = *(ps++); /* assign new quote character and return */ + *pps = ps; + return AG_TRUE; + + case '/': /* - * IF the THIRD character is *not* an octal digit, - * THEN save the value and bail + * Allow for a comment embedded in the concatenated string. */ - if ((ch < '0') || (ch > '7')) { - *pRes = val; + switch (ps[1]) { + default: + *pps = NULL; + return AG_FALSE; + + case '/': + /* + * Skip to end of line + */ + ps = strchr(ps, '\n'); + if (ps == NULL) { + *pps = NULL; + return AG_FALSE; + } break; + + case '*': + { + char* p = strstr( ps+2, "*/" ); + /* + * Skip to terminating star slash + */ + if (p == NULL) { + *pps = NULL; + return AG_FALSE; + } + + while (ps < p) { + if (*(ps++) == '\n') + (*lnct_p)++; + } + + ps = p + 2; + } } + continue; + default: /* - * IF the new value would not be too large, - * THEN add on the third and last character value + * The next non-whitespace character is not a quote. + * The series of quoted strings has come to an end. */ - if ((val<<3) < 0xFF) { - val = (val<<3) + (ch - '0'); - res = 3; - } - - *pRes = val; - break; + *pps = ps; + return AG_FALSE; } } - - return res; } - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * - * A quoted string has been found. - * Find the end of it and compress any escape sequences. - */ /*=export_func ao_string_cook * private: * * what: concatenate and escape-process strings - * arg: + char* + pzScan + The *MODIFIABLE* input buffer + - * arg: + int* + pLineCt + The (possibly NULL) pointer to a line count + + * arg: + char* + pzScan + The *MODIFIABLE* input buffer + + * arg: + int* + lnct_p + The (possibly NULL) pointer to a line count + * * ret-type: char* * ret-desc: The address of the text following the processed strings. @@ -210,8 +224,8 @@ ao_string_cook_escape_char( char const* pzIn, char* pRes, u_int nl ) * * err: @code{NULL} is returned if the string(s) is/are mal-formed. =*/ -char* -ao_string_cook( char* pzScan, int* pLineCt ) +char * +ao_string_cook(char * pzScan, int * lnct_p) { int l = 0; char q = *pzScan; @@ -223,8 +237,8 @@ ao_string_cook( char* pzScan, int* pLineCt ) char* pzD = pzScan++; char* pzS = pzScan; - if (pLineCt == NULL) - pLineCt = &l; + if (lnct_p == NULL) + lnct_p = &l; for (;;) { /* @@ -236,65 +250,8 @@ ao_string_cook( char* pzScan, int* pLineCt ) */ while (*pzS == q) { *pzD = NUL; /* This is probably the end of the line */ - pzS++; - - scan_for_quote: - while (isspace((int)*pzS)) - if (*(pzS++) == '\n') - (*pLineCt)++; - - /* - * IF the next character is a quote character, - * THEN we will concatenate the strings. - */ - switch (*pzS) { - case '"': - case '\'': - break; - - case '/': - /* - * Allow for a comment embedded in the concatenated string. - */ - switch (pzS[1]) { - default: return NULL; - case '/': - /* - * Skip to end of line - */ - pzS = strchr( pzS, '\n' ); - if (pzS == NULL) - return NULL; - (*pLineCt)++; - break; - - case '*': - { - char* p = strstr( pzS+2, "*/" ); - /* - * Skip to terminating star slash - */ - if (p == NULL) - return NULL; - while (pzS < p) { - if (*(pzS++) == '\n') - (*pLineCt)++; - } - - pzS = p + 2; - } - } - goto scan_for_quote; - - default: - /* - * The next non-whitespace character is not a quote. - * The series of quoted strings has come to an end. - */ + if (! contiguous_quote(&pzS, &q, lnct_p)) return pzS; - } - - q = *(pzS++); /* assign new quote character and advance scan */ } /* @@ -305,7 +262,7 @@ ao_string_cook( char* pzScan, int* pLineCt ) return NULL; case '\n': - (*pLineCt)++; + (*lnct_p)++; break; case '\\': @@ -317,7 +274,7 @@ ao_string_cook( char* pzScan, int* pLineCt ) if (*pzS == '\n') { pzS++; pzD--; - (*pLineCt)++; + (*lnct_p)++; } /* diff --git a/sntp/libopts/enumeration.c b/sntp/libopts/enumeration.c index 67dd4f4..a79a32e 100644 --- a/sntp/libopts/enumeration.c +++ b/sntp/libopts/enumeration.c @@ -1,96 +1,86 @@ -/* - * $Id: enumeration.c,v 4.17 2007/02/04 17:44:12 bkorb Exp $ - * Time-stamp: "2007-01-13 10:22:35 bkorb" +/** + * \file enumeration.c + * + * Time-stamp: "2011-04-06 10:48:22 bkorb" * * Automated Options Paged Usage module. * * This routine will run run-on options through a pager so the * user may examine, print or edit them at their leisure. - */ - -/* - * Automated Options copyright 1992-2007 Bruce Korb - * - * Automated Options is free software. - * You may 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. * - * Automated Options 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. + * This file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved * - * You should have received a copy of the GNU General Public License - * along with Automated Options. See the file "COPYING". If not, - * write to: The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. * - * As a special exception, Bruce Korb gives permission for additional - * uses of the text contained in his release of AutoOpts. + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" * - * The exception is that, if you link the AutoOpts library with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the AutoOpts library code into it. + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. + * These files have the following md5sums: * - * This exception applies only to the code released by Bruce Korb under - * the name AutoOpts. If you copy code from other sources under the - * General Public License into a copy of AutoOpts, as the General Public - * License permits, the exception does not apply to the code that you add - * in this way. To avoid misleading anyone as to the status of such - * modified files, you must delete this exception notice from them. - * - * If you write modifications of your own for AutoOpts, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd */ -tSCC* pz_enum_err_fmt; +static char const * pz_enum_err_fmt; /* = = = START-STATIC-FORWARD = = = */ -/* static forward declarations maintained by :mkfwd */ static void -enumError( - tOptions* pOpts, - tOptDesc* pOD, - tCC* const * paz_names, - int name_ct ); +enum_err(tOptions * pOpts, tOptDesc * pOD, + char const * const * paz_names, int name_ct); static uintptr_t -findName( - tCC* pzName, - tOptions* pOpts, - tOptDesc* pOD, - tCC* const * paz_names, - unsigned int name_ct ); +find_name(char const * pzName, tOptions * pOpts, tOptDesc * pOD, + char const * const * paz_names, unsigned int name_ct); + +static void +set_memb_usage(tOptions * pOpts, tOptDesc * pOD, char const * const * paz_names, + unsigned int name_ct); + +static void +set_memb_shell(tOptions * pOpts, tOptDesc * pOD, char const * const * paz_names, + unsigned int name_ct); + +static void +set_memb_names(tOptions * pOpts, tOptDesc * pOD, char const * const * paz_names, + unsigned int name_ct); /* = = = END-STATIC-FORWARD = = = */ static void -enumError( - tOptions* pOpts, - tOptDesc* pOD, - tCC* const * paz_names, - int name_ct ) +enum_err(tOptions * pOpts, tOptDesc * pOD, + char const * const * paz_names, int name_ct) { size_t max_len = 0; size_t ttl_len = 0; + int ct_down = name_ct; + int hidden = 0; - if (pOpts != NULL) - fprintf( option_usage_fp, pz_enum_err_fmt, pOpts->pzProgName, - pOD->optArg.argString, pOD->pz_Name ); + /* + * A real "pOpts" pointer means someone messed up. Give a real error. + */ + if (pOpts > OPTPROC_EMIT_LIMIT) + fprintf(option_usage_fp, pz_enum_err_fmt, pOpts->pzProgName, + pOD->optArg.argString, pOD->pz_Name); - fprintf( option_usage_fp, zValidKeys, pOD->pz_Name ); + fprintf(option_usage_fp, zValidKeys, pOD->pz_Name); + /* + * If the first name starts with this funny character, then we have + * a first value with an unspellable name. You cannot specify it. + * So, we don't list it either. + */ if (**paz_names == 0x7F) { paz_names++; - name_ct--; + hidden = 1; + ct_down = --name_ct; } /* @@ -98,15 +88,16 @@ enumError( * of all the names. */ { - tCC * const * paz = paz_names; - int ct = name_ct; + char const * const * paz = paz_names; do { - size_t len = strlen( *(paz++) ) + 1; + size_t len = strlen(*(paz++)) + 1; if (len > max_len) max_len = len; ttl_len += len; - } while (--ct > 0); + } while (--ct_down > 0); + + ct_down = name_ct; } /* @@ -114,20 +105,20 @@ enumError( */ if (max_len > 35) { do { - fprintf( option_usage_fp, " %s\n", *(paz_names++) ); - } while (--name_ct > 0); + fprintf(option_usage_fp, " %s\n", *(paz_names++)); + } while (--ct_down > 0); } /* * ELSE IF they all fit on one line, then do so. */ else if (ttl_len < 76) { - fputc( ' ', option_usage_fp ); + fputc(' ', option_usage_fp); do { - fputc( ' ', option_usage_fp ); - fputs( *(paz_names++), option_usage_fp ); - } while (--name_ct > 0); - fputc( '\n', option_usage_fp ); + fputc(' ', option_usage_fp); + fputs(*(paz_names++), option_usage_fp); + } while (--ct_down > 0); + fputc('\n', option_usage_fp); } /* @@ -137,82 +128,86 @@ enumError( int ent_no = 0; char zFmt[16]; /* format for all-but-last entries on a line */ - sprintf( zFmt, "%%-%ds", (int)max_len ); + sprintf(zFmt, "%%-%ds", (int)max_len); max_len = 78 / max_len; /* max_len is now max entries on a line */ - fputs( " ", option_usage_fp ); + fputs(" ", option_usage_fp); /* * Loop through all but the last entry */ - while (--name_ct > 0) { + ct_down = name_ct; + while (--ct_down > 0) { if (++ent_no == max_len) { /* * Last entry on a line. Start next line, too. */ - fprintf( option_usage_fp, "%s\n ", *(paz_names++) ); + fprintf(option_usage_fp, "%s\n ", *(paz_names++)); ent_no = 0; } else - fprintf( option_usage_fp, zFmt, *(paz_names++) ); + fprintf(option_usage_fp, zFmt, *(paz_names++) ); } - fprintf( option_usage_fp, "%s\n", *paz_names ); + fprintf(option_usage_fp, "%s\n", *paz_names); } - /* - * IF we do not have a pOpts pointer, then this output is being requested - * by the usage procedure. Let's not re-invoke it recursively. - */ - if (pOpts != NULL) - (*(pOpts->pUsageProc))( pOpts, EXIT_FAILURE ); - if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_MEMBERSHIP) - fputs( zSetMemberSettings, option_usage_fp ); + if (pOpts > OPTPROC_EMIT_LIMIT) { + fprintf(option_usage_fp, zIntRange, hidden, name_ct - 1 + hidden); + + (*(pOpts->pUsageProc))(pOpts, EXIT_FAILURE); + /* NOTREACHED */ + } + + if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_MEMBERSHIP) { + fprintf(option_usage_fp, zLowerBits, name_ct); + fputs(zSetMemberSettings, option_usage_fp); + } else { + fprintf(option_usage_fp, zIntRange, hidden, name_ct - 1 + hidden); + } } static uintptr_t -findName( - tCC* pzName, - tOptions* pOpts, - tOptDesc* pOD, - tCC* const * paz_names, - unsigned int name_ct ) +find_name(char const * pzName, tOptions * pOpts, tOptDesc * pOD, + char const * const * paz_names, unsigned int name_ct) { - uintptr_t res = name_ct; - size_t len = strlen( (char*)pzName ); - uintptr_t idx; + /* + * Return the matching index as a pointer sized integer. + * The result gets stashed in a char* pointer. + */ + uintptr_t res = name_ct; + size_t len = strlen((char*)pzName); + uintptr_t idx; + + if (IS_DEC_DIGIT_CHAR(*pzName)) { + char * pz = (char *)(void *)pzName; + unsigned long val = strtoul(pz, &pz, 0); + if ((*pz == NUL) && (val < name_ct)) + return (uintptr_t)val; + enum_err(pOpts, pOD, paz_names, (int)name_ct); + return name_ct; + } + /* * Look for an exact match, but remember any partial matches. * Multiple partial matches means we have an ambiguous match. */ for (idx = 0; idx < name_ct; idx++) { - if (strncmp( (char*)paz_names[idx], (char*)pzName, len) == 0) { + if (strncmp((char*)paz_names[idx], (char*)pzName, len) == 0) { if (paz_names[idx][len] == NUL) return idx; /* full match */ - if (res != name_ct) { - pz_enum_err_fmt = zAmbigKey; - option_usage_fp = stderr; - enumError( pOpts, pOD, paz_names, (int)name_ct ); - } - res = idx; /* save partial match */ + res = (res != name_ct) ? ~0 : idx; /* save partial match */ } } - /* - * no partial match -> error - */ - if (res == name_ct) { - pz_enum_err_fmt = zNoKey; - option_usage_fp = stderr; - enumError( pOpts, pOD, paz_names, (int)name_ct ); - } + if (res < name_ct) + return res; /* partial match */ - /* - * Return the matching index as a char* pointer. - * The result gets stashed in a char* pointer, so it will have to fit. - */ - return res; + pz_enum_err_fmt = (res == name_ct) ? zNoKey : zAmbigKey; + option_usage_fp = stderr; + enum_err(pOpts, pOD, paz_names, (int)name_ct); + return name_ct; } @@ -223,20 +218,18 @@ findName( * arg: tOptDesc*, pOD, enumeration option description * arg: unsigned int, enum_val, the enumeration value to map * - * ret_type: char const* + * ret_type: char const * * ret_desc: the enumeration name from const memory * * doc: This converts an enumeration value into the matching string. =*/ -char const* -optionKeywordName( - tOptDesc* pOD, - unsigned int enum_val ) +char const * +optionKeywordName(tOptDesc * pOD, unsigned int enum_val) { tOptDesc od; od.optArg.argEnum = enum_val; - (*(pOD->pOptProc))( (void*)(2UL), &od ); + (*(pOD->pOptProc))(OPTPROC_RETURN_VALNAME, &od ); return od.optArg.argString; } @@ -260,11 +253,8 @@ optionKeywordName( * if there is only one partial match. =*/ uintptr_t -optionEnumerationVal( - tOptions* pOpts, - tOptDesc* pOD, - tCC * const * paz_names, - unsigned int name_ct ) +optionEnumerationVal(tOptions * pOpts, tOptDesc * pOD, + char const * const * paz_names, unsigned int name_ct) { uintptr_t res = 0UL; @@ -273,28 +263,28 @@ optionEnumerationVal( * then it is some sort of special request. */ switch ((uintptr_t)pOpts) { - case 0UL: + case (uintptr_t)OPTPROC_EMIT_USAGE: /* * print the list of enumeration names. */ - enumError( pOpts, pOD, paz_names, (int)name_ct ); + enum_err(pOpts, pOD, paz_names, (int)name_ct); break; - case 1UL: + case (uintptr_t)OPTPROC_EMIT_SHELL: { unsigned int ix = pOD->optArg.argEnum; /* * print the name string. */ if (ix >= name_ct) - printf( "INVALID-%d", ix ); + printf("INVALID-%d", ix); else - fputs( paz_names[ ix ], stdout ); + fputs(paz_names[ ix ], stdout); break; } - case 2UL: + case (uintptr_t)OPTPROC_RETURN_VALNAME: { tSCC zInval[] = "*INVALID*"; unsigned int ix = pOD->optArg.argEnum; @@ -304,12 +294,12 @@ optionEnumerationVal( if (ix >= name_ct) return (uintptr_t)zInval; - res = (uintptr_t)paz_names[ ix ]; + pOD->optArg.argString = paz_names[ix]; break; } default: - res = findName( pOD->optArg.argString, pOpts, pOD, paz_names, name_ct ); + res = find_name(pOD->optArg.argString, pOpts, pOD, paz_names, name_ct); if (pOD->fOptState & OPTST_ALLOC_ARG) { AGFREE(pOD->optArg.argString); @@ -321,6 +311,89 @@ optionEnumerationVal( return res; } +static void +set_memb_usage(tOptions * pOpts, tOptDesc * pOD, char const * const * paz_names, + unsigned int name_ct) +{ + /* + * print the list of enumeration names. + */ + enum_err(OPTPROC_EMIT_USAGE, pOD, paz_names, (int)name_ct ); +} + +static void +set_memb_shell(tOptions * pOpts, tOptDesc * pOD, char const * const * paz_names, + unsigned int name_ct) +{ + /* + * print the name string. + */ + int ix = 0; + uintptr_t bits = (uintptr_t)pOD->optCookie; + size_t len = 0; + + bits &= ((uintptr_t)1 << (uintptr_t)name_ct) - (uintptr_t)1; + + while (bits != 0) { + if (bits & 1) { + if (len++ > 0) fputs(" | ", stdout); + fputs(paz_names[ix], stdout); + } + if (++ix >= name_ct) break; + bits >>= 1; + } +} + +static void +set_memb_names(tOptions * pOpts, tOptDesc * pOD, char const * const * paz_names, + unsigned int name_ct) +{ + static char const none[] = "none"; + static char const plus[3] = " + "; + + char * pz; + uintptr_t bits = (uintptr_t)pOD->optCookie; + int ix = 0; + size_t len = sizeof(none); + + bits &= ((uintptr_t)1 << (uintptr_t)name_ct) - (uintptr_t)1; + + /* + * Replace the enumeration value with the name string. + * First, determine the needed length, then allocate and fill in. + */ + while (bits != 0) { + if (bits & 1) + len += strlen(paz_names[ix]) + sizeof(plus); + if (++ix >= name_ct) break; + bits >>= 1; + } + + pOD->optArg.argString = pz = AGALOC(len, "enum name"); + + /* + * Start by clearing all the bits. We want to turn off any defaults + * because we will be restoring to current state, not adding to + * the default set of bits. + */ + memcpy(pz, none, sizeof(none)-1); + pz += sizeof(none)-1; + bits = (uintptr_t)pOD->optCookie; + bits &= ((uintptr_t)1 << (uintptr_t)name_ct) - (uintptr_t)1; + ix = 0; + + while (bits != 0) { + if (bits & 1) { + size_t nln = strlen(paz_names[ix]); + memcpy(pz, plus, sizeof(plus)); + memcpy(pz+sizeof(plus), paz_names[ix], nln); + pz += strlen(paz_names[ix]) + 3; + } + if (++ix >= name_ct) break; + bits >>= 1; + } + *pz = NUL; +} /*=export_func optionSetMembers * what: Convert between bit flag values and strings @@ -339,91 +412,35 @@ optionEnumerationVal( * if there is only one partial match. =*/ void -optionSetMembers( - tOptions* pOpts, - tOptDesc* pOD, - tCC* const * paz_names, - unsigned int name_ct ) +optionSetMembers(tOptions * pOpts, tOptDesc * pOD, + char const* const * paz_names, unsigned int name_ct) { /* * IF the program option descriptor pointer is invalid, * then it is some sort of special request. */ switch ((uintptr_t)pOpts) { - case 0UL: - /* - * print the list of enumeration names. - */ - enumError( pOpts, pOD, paz_names, (int)name_ct ); + case (uintptr_t)OPTPROC_EMIT_USAGE: + set_memb_usage(pOpts, pOD, paz_names, name_ct); return; - case 1UL: - { - /* - * print the name string. - */ - uintptr_t bits = (uintptr_t)pOD->optCookie; - uintptr_t res = 0; - size_t len = 0; - - while (bits != 0) { - if (bits & 1) { - if (len++ > 0) fputs( " | ", stdout ); - fputs( paz_names[ res ], stdout ); - } - if (++res >= name_ct) break; - bits >>= 1; - } + case (uintptr_t)OPTPROC_EMIT_SHELL: + set_memb_shell(pOpts, pOD, paz_names, name_ct); return; - } - case 2UL: - { - char* pz; - uintptr_t bits = (uintptr_t)pOD->optCookie; - uintptr_t res = 0; - size_t len = 0; - - /* - * Replace the enumeration value with the name string. - * First, determine the needed length, then allocate and fill in. - */ - while (bits != 0) { - if (bits & 1) - len += strlen( paz_names[ res ]) + 8; - if (++res >= name_ct) break; - bits >>= 1; - } - - pOD->optArg.argString = pz = AGALOC( len, "enum name" ); - - /* - * Start by clearing all the bits. We want to turn off any defaults - * because we will be restoring to current state, not adding to - * the default set of bits. - */ - strcpy( pz, "none" ); - pz += 4; - bits = (uintptr_t)pOD->optCookie; - res = 0; - while (bits != 0) { - if (bits & 1) { - strcpy( pz, " + " ); - strcpy( pz+3, paz_names[ res ]); - pz += strlen( paz_names[ res ]) + 3; - } - if (++res >= name_ct) break; - bits >>= 1; - } + case (uintptr_t)OPTPROC_RETURN_VALNAME: + set_memb_names(pOpts, pOD, paz_names, name_ct); return; - } default: break; } + if ((pOD->fOptState & OPTST_RESET) != 0) + return; + { - tCC* pzArg = pOD->optArg.argString; + char const* pzArg = pOD->optArg.argString; uintptr_t res; if ((pzArg == NULL) || (*pzArg == NUL)) { pOD->optCookie = (void*)0; @@ -435,42 +452,49 @@ optionSetMembers( tSCC zSpn[] = " ,|+\t\r\f\n"; int iv, len; - pzArg += strspn( pzArg, zSpn ); + pzArg += strspn(pzArg, zSpn); iv = (*pzArg == '!'); if (iv) - pzArg += strspn( pzArg+1, zSpn ) + 1; + pzArg += strspn(pzArg+1, zSpn) + 1; - len = strcspn( pzArg, zSpn ); + len = strcspn(pzArg, zSpn); if (len == 0) break; - if ((len == 3) && (strncmp(pzArg, zAll, (size_t)3) == 0)) { + if ((len == 3) && (strncmp(pzArg, zAll, 3) == 0)) { if (iv) res = 0; else res = ~0UL; } - else if ((len == 4) && (strncmp(pzArg, zNone, (size_t)4) == 0)) { + else if ((len == 4) && (strncmp(pzArg, zNone, 4) == 0)) { if (! iv) res = 0; } else do { char* pz; - uintptr_t bit = strtoul( pzArg, &pz, 0 ); + uintptr_t bit = strtoul(pzArg, &pz, 0); if (pz != pzArg + len) { char z[ AO_NAME_SIZE ]; - tCC* p; + char const* p; + int shift_ct; + if (*pz != NUL) { if (len >= AO_NAME_LIMIT) break; - strncpy( z, pzArg, (size_t)len ); + memcpy(z, pzArg, (size_t)len); z[len] = NUL; p = z; } else { p = pzArg; } - bit = 1UL << findName(p, pOpts, pOD, paz_names, name_ct); + shift_ct = find_name(p, pOpts, pOD, paz_names, name_ct); + if (shift_ct >= name_ct) { + pOD->optCookie = (void*)0; + return; + } + bit = 1UL << shift_ct; } if (iv) res &= ~bit; @@ -481,7 +505,7 @@ optionSetMembers( break; pzArg += len + 1; } - if (name_ct < (8 * sizeof( uintptr_t ))) { + if (name_ct < (8 * sizeof(uintptr_t))) { res &= (1UL << name_ct) - 1UL; } diff --git a/sntp/libopts/environment.c b/sntp/libopts/environment.c index 9fb1550..8530230 100644 --- a/sntp/libopts/environment.c +++ b/sntp/libopts/environment.c @@ -1,61 +1,38 @@ -/* - * $Id: environment.c,v 4.13 2007/04/15 19:01:18 bkorb Exp $ - * Time-stamp: "2007-04-15 11:50:35 bkorb" +/** + * \file environment.c + * + * Time-stamp: "2011-04-06 09:35:55 bkorb" * * This file contains all of the routines that must be linked into * an executable to use the generated option processing. The optional * routines are in separately compiled modules so that they will not * necessarily be linked in. - */ - -/* - * Automated Options copyright 1992-2007 Bruce Korb * - * Automated Options is free software. - * You may 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 file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved * - * Automated Options 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. + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. * - * You should have received a copy of the GNU General Public License - * along with Automated Options. See the file "COPYING". If not, - * write to: The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" * - * As a special exception, Bruce Korb gives permission for additional - * uses of the text contained in his release of AutoOpts. + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" * - * The exception is that, if you link the AutoOpts library with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the AutoOpts library code into it. + * These files have the following md5sums: * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. - * - * This exception applies only to the code released by Bruce Korb under - * the name AutoOpts. If you copy code from other sources under the - * General Public License into a copy of AutoOpts, as the General Public - * License permits, the exception does not apply to the code that you add - * in this way. To avoid misleading anyone as to the status of such - * modified files, you must delete this exception notice from them. - * - * If you write modifications of your own for AutoOpts, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd */ /* = = = START-STATIC-FORWARD = = = */ -/* static forward declarations maintained by :mkfwd */ static void -checkEnvOpt(tOptState * os, char * env_name, +do_env_opt(tOptState * os, char * env_name, tOptions* pOpts, teEnvPresetType type); /* = = = END-STATIC-FORWARD = = = */ @@ -66,31 +43,25 @@ checkEnvOpt(tOptState * os, char * env_name, * doImmediateOpts and/or doRegularOpts. */ LOCAL void -doPrognameEnv( tOptions* pOpts, teEnvPresetType type ) +doPrognameEnv(tOptions* pOpts, teEnvPresetType type) { - char const* pczOptStr = getenv( pOpts->pzPROGNAME ); + char const* pczOptStr = getenv(pOpts->pzPROGNAME); token_list_t* pTL; int sv_argc; tAoUI sv_flag; char** sv_argv; /* - * IF there is no such environment variable - * *or* there is, but we are doing immediate opts and there are - * no immediate opts to do (--help inside $PROGNAME is silly, - * but --no-load-defs is not, so that is marked) - * THEN bail out now. ( + * No such beast? Then bail now. */ - if ( (pczOptStr == NULL) - || ( (type == ENV_IMM) - && ((pOpts->fOptSet & OPTPROC_HAS_IMMED) == 0) ) ) + if (pczOptStr == NULL) return; /* * Tokenize the string. If there's nothing of interest, we'll bail * here immediately. */ - pTL = ao_string_tokenize( pczOptStr ); + pTL = ao_string_tokenize(pczOptStr); if (pTL == NULL) return; @@ -116,51 +87,41 @@ doPrognameEnv( tOptions* pOpts, teEnvPresetType type ) switch (type) { case ENV_IMM: - /* - * We know the OPTPROC_HAS_IMMED bit is set. - */ - (void)doImmediateOpts( pOpts ); + (void)doImmediateOpts(pOpts); break; - case ENV_NON_IMM: - (void)doRegularOpts( pOpts ); - break; + case ENV_ALL: + (void)doImmediateOpts(pOpts); + pOpts->curOptIdx = 1; + pOpts->pzCurOpt = NULL; + /* FALLTHROUGH */ - default: - /* - * Only to immediate opts if the OPTPROC_HAS_IMMED bit is set. - */ - if (pOpts->fOptSet & OPTPROC_HAS_IMMED) { - (void)doImmediateOpts( pOpts ); - pOpts->curOptIdx = 1; - pOpts->pzCurOpt = NULL; - } - (void)doRegularOpts( pOpts ); - break; + case ENV_NON_IMM: + (void)doRegularOpts(pOpts); } /* * Free up the temporary arg vector and restore the original program args. */ - free( pTL ); + free(pTL); pOpts->origArgVect = sv_argv; pOpts->origArgCt = sv_argc; pOpts->fOptSet = sv_flag; } static void -checkEnvOpt(tOptState * os, char * env_name, +do_env_opt(tOptState * os, char * env_name, tOptions* pOpts, teEnvPresetType type) { - os->pzOptArg = getenv( env_name ); + os->pzOptArg = getenv(env_name); if (os->pzOptArg == NULL) return; - os->flags = OPTST_PRESET | OPTST_ALLOC_ARG | os->pOD->fOptState; - os->optType = TOPT_UNDEFINED; + os->flags = OPTST_PRESET | OPTST_ALLOC_ARG | os->pOD->fOptState; + os->optType = TOPT_UNDEFINED; if ( (os->pOD->pz_DisablePfx != NULL) - && (streqvcmp( os->pzOptArg, os->pOD->pz_DisablePfx ) == 0)) { + && (streqvcmp(os->pzOptArg, os->pOD->pz_DisablePfx) == 0)) { os->flags |= OPTST_DISABLED; os->pzOptArg = NULL; } @@ -192,21 +153,27 @@ checkEnvOpt(tOptState * os, char * env_name, * The interpretation of the option value depends * on the type of value argument the option takes */ - if (os->pzOptArg != NULL) { - if (OPTST_GET_ARGTYPE(os->pOD->fOptState) == OPARG_TYPE_NONE) { - os->pzOptArg = NULL; - } else if ( (os->pOD->fOptState & OPTST_ARG_OPTIONAL) - && (*os->pzOptArg == NUL)) { - os->pzOptArg = NULL; - } else if (*os->pzOptArg == NUL) { - os->pzOptArg = zNil; - } else { - AGDUPSTR( os->pzOptArg, os->pzOptArg, "option argument" ); - os->flags |= OPTST_ALLOC_ARG; - } + if (OPTST_GET_ARGTYPE(os->pOD->fOptState) == OPARG_TYPE_NONE) { + /* + * Ignore any value. + */ + os->pzOptArg = NULL; + + } else if (os->pzOptArg[0] == NUL) { + /* + * If the argument is the empty string and the argument is + * optional, then treat it as if the option was not specified. + */ + if ((os->pOD->fOptState & OPTST_ARG_OPTIONAL) == 0) + return; + os->pzOptArg = NULL; + + } else { + AGDUPSTR(os->pzOptArg, os->pzOptArg, "option argument"); + os->flags |= OPTST_ALLOC_ARG; } - handleOption( pOpts, os ); + handle_opt(pOpts, os); } /* @@ -214,7 +181,7 @@ checkEnvOpt(tOptState * os, char * env_name, * This routine should process in all, immediate or normal modes.... */ LOCAL void -doEnvPresets( tOptions* pOpts, teEnvPresetType type ) +doEnvPresets(tOptions* pOpts, teEnvPresetType type) { int ct; tOptState st; @@ -229,16 +196,18 @@ doEnvPresets( tOptions* pOpts, teEnvPresetType type ) if ((pOpts->fOptSet & OPTPROC_ENVIRON) == 0) return; - doPrognameEnv( pOpts, type ); + doPrognameEnv(pOpts, type); ct = pOpts->presetOptCt; st.pOD = pOpts->pOptDesc; pzFlagName = zEnvName - + snprintf( zEnvName, sizeof( zEnvName ), "%s_", pOpts->pzPROGNAME ); + + snprintf(zEnvName, sizeof(zEnvName), "%s_", pOpts->pzPROGNAME); spaceLeft = AO_NAME_SIZE - (pzFlagName - zEnvName) - 1; for (;ct-- > 0; st.pOD++) { + size_t nln; + /* * If presetting is disallowed, then skip this entry */ @@ -250,23 +219,34 @@ doEnvPresets( tOptions* pOpts, teEnvPresetType type ) * IF there is no such environment variable, * THEN skip this entry, too. */ - if (strlen( st.pOD->pz_NAME ) >= spaceLeft) - continue; - - /* - * Set up the option state - */ - strcpy( pzFlagName, st.pOD->pz_NAME ); - checkEnvOpt(&st, zEnvName, pOpts, type); + nln = strlen(st.pOD->pz_NAME) + 1; + if (nln <= spaceLeft) { + /* + * Set up the option state + */ + memcpy(pzFlagName, st.pOD->pz_NAME, nln); + do_env_opt(&st, zEnvName, pOpts, type); + } } /* * Special handling for ${PROGNAME_LOAD_OPTS} */ - if (pOpts->specOptIdx.save_opts != 0) { + if ( (pOpts->specOptIdx.save_opts != NO_EQUIVALENT) + && (pOpts->specOptIdx.save_opts != 0)) { + size_t nln; st.pOD = pOpts->pOptDesc + pOpts->specOptIdx.save_opts + 1; - strcpy( pzFlagName, st.pOD->pz_NAME ); - checkEnvOpt(&st, zEnvName, pOpts, type); + + if (st.pOD->pz_NAME == NULL) + return; + + nln = strlen(st.pOD->pz_NAME) + 1; + + if (nln > spaceLeft) + return; + + memcpy(pzFlagName, st.pOD->pz_NAME, nln); + do_env_opt(&st, zEnvName, pOpts, type); } } diff --git a/sntp/libopts/file.c b/sntp/libopts/file.c new file mode 100644 index 0000000..bb6adf6 --- /dev/null +++ b/sntp/libopts/file.c @@ -0,0 +1,173 @@ + +/** + * \file file.c + * + * Time-stamp: "2010-07-10 11:00:59 bkorb" + * + * This file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved + * + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. + * + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" + * + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" + * + * These files have the following md5sums: + * + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + */ + +/*=export_func optionFileCheck + * private: + * + * what: Decipher a boolean value + * arg: + tOptions* + pOpts + program options descriptor + + * arg: + tOptDesc* + pOptDesc + the descriptor for this arg + + * arg: + teOptFileType + ftype + File handling type + + * arg: + tuFileMode + mode + file open mode (if needed) + + * + * doc: + * Make sure the named file conforms with the file type mode. + * The mode specifies if the file must exist, must not exist or may + * (or may not) exist. The mode may also specify opening the + * file: don't, open just the descriptor (fd), or open as a stream + * (FILE* pointer). +=*/ +void +optionFileCheck(tOptions* pOpts, tOptDesc* pOD, + teOptFileType ftype, tuFileMode mode) +{ + if (pOpts <= OPTPROC_EMIT_LIMIT) { + if (pOpts != OPTPROC_EMIT_USAGE) + return; + + switch (ftype & FTYPE_MODE_EXIST_MASK) { + case FTYPE_MODE_MUST_NOT_EXIST: + fputs(zFileCannotExist, option_usage_fp); + break; + + case FTYPE_MODE_MUST_EXIST: + fputs(zFileMustExist, option_usage_fp); + break; + } + return; + } + + if ((pOD->fOptState & OPTST_RESET) != 0) { + if (pOD->optCookie != NULL) + AGFREE(pOD->optCookie); + return; + } + + { + struct stat sb; + + errno = 0; + + switch (ftype & FTYPE_MODE_EXIST_MASK) { + case FTYPE_MODE_MUST_NOT_EXIST: + if ( (stat(pOD->optArg.argString, &sb) == 0) + || (errno != ENOENT) ){ + if (errno == 0) + errno = EINVAL; + fprintf(stderr, zFSOptError, errno, strerror(errno), + zFSOptErrNoExist, pOD->optArg.argString, pOD->pz_Name); + pOpts->pUsageProc(pOpts, EXIT_FAILURE); + /* NOTREACHED */ + } + /* FALLTHROUGH */ + + default: + case FTYPE_MODE_MAY_EXIST: + { + char * p = strrchr(pOD->optArg.argString, DIRCH); + if (p == NULL) + break; /* assume "." always exists. */ + + *p = NUL; + if ( (stat(pOD->optArg.argString, &sb) != 0) + || (errno = EINVAL, ! S_ISDIR(sb.st_mode)) ){ + fprintf(stderr, zFSOptError, errno, strerror(errno), + zFSOptErrMayExist, pOD->optArg.argString, pOD->pz_Name); + pOpts->pUsageProc(pOpts, EXIT_FAILURE); + /* NOTREACHED */ + } + if (p != NULL) + *p = DIRCH; + break; + } + + case FTYPE_MODE_MUST_EXIST: + if ( (stat(pOD->optArg.argString, &sb) != 0) + || (errno = EINVAL, ! S_ISREG(sb.st_mode)) ){ + fprintf(stderr, zFSOptError, errno, strerror(errno), + zFSOptErrMustExist, pOD->optArg.argString, + pOD->pz_Name); + pOpts->pUsageProc(pOpts, EXIT_FAILURE); + /* NOTREACHED */ + } + break; + } + } + + switch (ftype & FTYPE_MODE_OPEN_MASK) { + default: + case FTYPE_MODE_NO_OPEN: + break; + + case FTYPE_MODE_OPEN_FD: + { + int fd = open(pOD->optArg.argString, mode.file_flags); + if (fd < 0) { + fprintf(stderr, zFSOptError, errno, strerror(errno), + zFSOptErrOpen, pOD->optArg.argString, pOD->pz_Name); + pOpts->pUsageProc(pOpts, EXIT_FAILURE); + /* NOTREACHED */ + } + + if ((pOD->fOptState & OPTST_ALLOC_ARG) != 0) + pOD->optCookie = (void *)pOD->optArg.argString; + else + AGDUPSTR(pOD->optCookie, pOD->optArg.argString, "file name"); + + pOD->optArg.argFd = fd; + pOD->fOptState &= ~OPTST_ALLOC_ARG; + break; + } + + case FTYPE_MODE_FOPEN_FP: + { + FILE* fp = fopen(pOD->optArg.argString, mode.file_mode); + if (fp == NULL) { + fprintf(stderr, zFSOptError, errno, strerror(errno), + zFSOptErrFopen, pOD->optArg.argString, pOD->pz_Name); + pOpts->pUsageProc(pOpts, EXIT_FAILURE); + /* NOTREACHED */ + } + + if ((pOD->fOptState & OPTST_ALLOC_ARG) != 0) + pOD->optCookie = (void *)pOD->optArg.argString; + else + AGDUPSTR(pOD->optCookie, pOD->optArg.argString, "file name"); + + pOD->optArg.argFp = fp; + pOD->fOptState &= ~OPTST_ALLOC_ARG; + break; + } + } +} +/* + * Local Variables: + * mode: C + * c-file-style: "stroustrup" + * indent-tabs-mode: nil + * End: + * end of autoopts/file.c */ diff --git a/sntp/libopts/genshell.c b/sntp/libopts/genshell.c index de098a5..05f2f1d 100644 --- a/sntp/libopts/genshell.c +++ b/sntp/libopts/genshell.c @@ -2,45 +2,44 @@ * * DO NOT EDIT THIS FILE (genshell.c) * - * It has been AutoGen-ed Saturday May 5, 2007 at 12:02:35 PM PDT + * It has been AutoGen-ed April 29, 2011 at 03:43:59 PM by AutoGen 5.11.9 * From the definitions genshell.def * and the template file options * - * Generated from AutoOpts 29:0:4 templates. - */ - -/* - * This file was produced by an AutoOpts template. AutoOpts is a - * copyrighted work. This source file is not encumbered by AutoOpts - * licensing, but is provided under the licensing terms chosen by the - * genshellopt author or copyright holder. AutoOpts is licensed under - * the terms of the LGPL. The redistributable library (``libopts'') is - * licensed under the terms of either the LGPL or, at the users discretion, - * the BSD license. See the AutoOpts and/or libopts sources for details. + * Generated from AutoOpts 35:0:10 templates. + * + * AutoOpts is a copyrighted work. This source file is not encumbered + * by AutoOpts licensing, but is provided under the licensing terms chosen + * by the genshellopt author or copyright holder. AutoOpts is + * licensed under the terms of the LGPL. The redistributable library + * (``libopts'') is licensed under the terms of either the LGPL or, at the + * users discretion, the BSD license. See the AutoOpts and/or libopts sources + * for details. * * This source file is copyrighted and licensed under the following terms: * - * genshellopt copyright 1999-2007 Bruce Korb - all rights reserved + * genshellopt copyright (c) 1999-2011 Bruce Korb - all rights reserved * - * genshellopt is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * genshellopt is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * genshellopt is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * genshellopt 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 Lesser General Public - * License along with genshellopt. If not, write to: - * The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor - * Boston, MA 02110-1301, USA. + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include <sys/types.h> #include <limits.h> +#include <stdio.h> +#include <stdlib.h> #define OPTION_CODE_COMPILE 1 #include "genshell.h" @@ -48,51 +47,53 @@ #ifdef __cplusplus extern "C" { #endif -tSCC zCopyright[] = - "genshellopt copyright (c) 1999-2007 Bruce Korb, all rights reserved"; -tSCC zCopyrightNotice[] = - "genshellopt is free software; you can redistribute it and/or\n\ -modify it under the terms of the GNU Lesser General Public\n\ -License as published by the Free Software Foundation; either\n\ -version 2.1 of the License, or (at your option) any later version.\n\n\ -genshellopt is distributed in the hope that it will be useful,\n\ -but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n\ -Lesser General Public License for more details.\n\n\ -You should have received a copy of the GNU Lesser General Public\n\ -License along with genshellopt. If not, write to:\n\ -\tThe Free Software Foundation, Inc.,\n\ -\t51 Franklin Street, Fifth Floor\n\ -\tBoston, MA 02110-1301, USA."; +extern FILE * option_usage_fp; + +/* TRANSLATORS: choose the translation for option names wisely because you + cannot ever change your mind. */ +static char const zCopyright[260] = +"genshellopt 1\n\ +Copyright (C) 1999-2011 Bruce Korb, all rights reserved.\n\ +This is free software. It is licensed for use, modification and\n\ +redistribution under the terms of the\n\ +GNU General Public License, version 3 or later\n\ + <http://gnu.org/licenses/gpl.html>\n"; +static char const zCopyrightNotice[611] = +"genshellopt is free software: you can redistribute it and/or modify it\n\ +under the terms of the GNU General Public License as published by the\n\ +Free Software Foundation, either version 3 of the License, or (at your\n\ +option) any later version.\n\n\ +genshellopt is distributed in the hope that it will be useful, but WITHOUT\n\ +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n\ +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n\ +for more details.\n\n\ +You should have received a copy of the GNU General Public License along\n\ +with this program. If not, see <http://www.gnu.org/licenses/>.\n"; + extern tUsageProc genshelloptUsage; #ifndef NULL # define NULL 0 #endif -#ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -#endif -#ifndef EXIT_FAILURE -# define EXIT_FAILURE 1 -#endif + /* * Script option description: */ -tSCC zScriptText[] = +static char const zScriptText[] = "Output Script File"; -tSCC zScript_NAME[] = "SCRIPT"; -tSCC zScript_Name[] = "script"; +static char const zScript_NAME[] = "SCRIPT"; +static char const zScript_Name[] = "script"; #define SCRIPT_FLAGS (OPTST_DISABLED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) /* * Shell option description: */ -tSCC zShellText[] = +static char const zShellText[] = "Shell name (follows \"#!\" magic)"; -tSCC zShell_NAME[] = "SHELL"; -tSCC zNotShell_Name[] = "no-shell"; -tSCC zNotShell_Pfx[] = "no"; +static char const zShell_NAME[] = "SHELL"; +static char const zNotShell_Name[] = "no-shell"; +static char const zNotShell_Pfx[] = "no"; #define zShell_Name (zNotShell_Name + 3) #define SHELL_FLAGS (OPTST_INITENABLED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) @@ -100,19 +101,34 @@ tSCC zNotShell_Pfx[] = "no"; /* * Help/More_Help/Version option descriptions: */ -tSCC zHelpText[] = "Display usage information and exit"; -tSCC zHelp_Name[] = "help"; - -tSCC zMore_HelpText[] = "Extended usage information passed thru pager"; -tSCC zMore_Help_Name[] = "more-help"; +static char const zHelpText[] = "Display extended usage information and exit"; +static char const zHelp_Name[] = "help"; +#ifdef HAVE_WORKING_FORK +#define OPTST_MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT) +static char const zMore_Help_Name[] = "more-help"; +static char const zMore_HelpText[] = "Extended usage information passed thru pager"; +#else +#define OPTST_MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT) +#define zMore_Help_Name NULL +#define zMore_HelpText NULL +#endif +#ifdef NO_OPTIONAL_OPT_ARGS +# define OPTST_VERSION_FLAGS OPTST_IMM | OPTST_NO_INIT +#else +# define OPTST_VERSION_FLAGS OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \ + OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT +#endif -tSCC zVersionText[] = "Output version information and exit"; -tSCC zVersion_Name[] = "version"; +static char const zVersionText[] = "Output version information and exit"; +static char const zVersion_Name[] = "version"; /* * Declare option callback procedures */ extern tOptProc - optionPagedUsage, optionPrintVersion; + optionBooleanVal, optionNestedVal, optionNumericVal, + optionPagedUsage, optionPrintVersion, optionResetOpt, + optionStackArg, optionTimeDate, optionTimeVal, + optionUnstackArg, optionVersionStderr; static tOptProc doUsageOpt; @@ -120,9 +136,9 @@ static tOptProc * * Define the Genshellopt Option Descriptions. */ -static tOptDesc optDesc[ OPTION_CT ] = { - { /* entry idx, value */ 0, VALUE_OPT_SCRIPT, - /* equiv idx, value */ 0, VALUE_OPT_SCRIPT, +static tOptDesc optDesc[GENSHELL_OPTION_CT] = { + { /* entry idx, value */ 0, VALUE_GENSHELL_OPT_SCRIPT, + /* equiv idx, value */ 0, VALUE_GENSHELL_OPT_SCRIPT, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ SCRIPT_FLAGS, 0, @@ -133,8 +149,8 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* desc, NAME, name */ zScriptText, zScript_NAME, zScript_Name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 1, VALUE_OPT_SHELL, - /* equiv idx, value */ 1, VALUE_OPT_SHELL, + { /* entry idx, value */ 1, VALUE_GENSHELL_OPT_SHELL, + /* equiv idx, value */ 1, VALUE_GENSHELL_OPT_SHELL, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ SHELL_FLAGS, 0, @@ -145,18 +161,11 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* desc, NAME, name */ zShellText, zShell_NAME, zShell_Name, /* disablement strs */ zNotShell_Name, zNotShell_Pfx }, -#ifdef NO_OPTIONAL_OPT_ARGS -# define VERSION_OPT_FLAGS OPTST_IMM | OPTST_NO_INIT -#else -# define VERSION_OPT_FLAGS OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \ - OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT -#endif - - { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION, + { /* entry idx, value */ INDEX_GENSHELL_OPT_VERSION, VALUE_GENSHELL_OPT_VERSION, /* equiv idx value */ NO_EQUIVALENT, 0, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ VERSION_OPT_FLAGS, 0, + /* opt state flags */ OPTST_VERSION_FLAGS, 0, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, @@ -164,10 +173,9 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* desc, NAME, name */ zVersionText, NULL, zVersion_Name, /* disablement strs */ NULL, NULL }, -#undef VERSION_OPT_FLAGS - { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP, + { /* entry idx, value */ INDEX_GENSHELL_OPT_HELP, VALUE_GENSHELL_OPT_HELP, /* equiv idx value */ NO_EQUIVALENT, 0, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, @@ -179,11 +187,11 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* desc, NAME, name */ zHelpText, NULL, zHelp_Name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP, + { /* entry idx, value */ INDEX_GENSHELL_OPT_MORE_HELP, VALUE_GENSHELL_OPT_MORE_HELP, /* equiv idx value */ NO_EQUIVALENT, 0, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0, + /* opt state flags */ OPTST_MORE_HELP_FLAGS, 0, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, @@ -196,24 +204,24 @@ static tOptDesc optDesc[ OPTION_CT ] = { * * Define the Genshellopt Option Environment */ -tSCC zPROGNAME[] = "GENSHELLOPT"; -tSCC zUsageTitle[] = +static char const zPROGNAME[12] = "GENSHELLOPT"; +static char const zUsageTitle[121] = "genshellopt - Generate Shell Option Processing Script - Ver. 1\n\ USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n"; #define zRcName NULL #define apzHomeList NULL -tSCC zBugsAddr[] = "autogen-users@lists.sourceforge.net"; -tSCC zExplain[] = "\n\ -Note that `shell' is only useful if the output file does not already\n\ -exist. If it does, then the shell name and optional first argument\n\ -will be extracted from the script file.\n"; -tSCC zDetail[] = "\n\ +static char const zBugsAddr[36] = "autogen-users@lists.sourceforge.net"; +static char const zExplain[] = "\n\ +Note that ``shell'' is only useful if the output file does not already\n\ +exist. If it does, then the shell name and optional first argument will\n\ +be extracted from the script file.\n"; +static char const zDetail[237] = "\n\ If the script file already exists and contains Automated Option Processing\n\ text, the second line of the file through the ending tag will be replaced\n\ -by the newly generated text. The first `#!' line will be regenerated.\n"; -tSCC zFullVersion[] = GENSHELLOPT_FULL_VERSION; -/* extracted from optcode.tpl near line 408 */ +by the newly generated text. The first ``#!'' line will be regenerated.\n"; +static char const zFullVersion[] = GENSHELLOPT_FULL_VERSION; +/* extracted from optcode.tlib near line 515 */ #if defined(ENABLE_NLS) # define OPTPROC_BASE OPTPROC_TRANSLATE @@ -223,6 +231,29 @@ tSCC zFullVersion[] = GENSHELLOPT_FULL_VERSION; # define translate_option_strings NULL #endif /* ENABLE_NLS */ + +#define genshellopt_full_usage NULL +#define genshellopt_short_usage NULL +#ifndef PKGDATADIR +# define PKGDATADIR "" +#endif + +#ifndef WITH_PACKAGER +# define genshellopt_packager_info NULL +#else +static char const genshellopt_packager_info[] = + "Packaged by " WITH_PACKAGER + +# ifdef WITH_PACKAGER_VERSION + " ("WITH_PACKAGER_VERSION")" +# endif + +# ifdef WITH_PACKAGER_BUG_REPORTS + "\nReport genshellopt bugs to " WITH_PACKAGER_BUG_REPORTS +# endif + "\n"; +#endif + tOptions genshelloptOptions = { OPTIONS_STRUCT_VERSION, 0, NULL, /* original argc + argv */ @@ -240,30 +271,32 @@ tOptions genshelloptOptions = { zExplain, zDetail, optDesc, zBugsAddr, /* address to send bugs to */ NULL, NULL, /* extensions/saved state */ - genshelloptUsage, /* usage procedure */ + genshelloptUsage, /* usage procedure */ translate_option_strings, /* translation procedure */ /* * Indexes to special options */ - { INDEX_OPT_MORE_HELP, - 0 /* no option state saving */, - NO_EQUIVALENT /* index of '-#' option */, + { INDEX_GENSHELL_OPT_MORE_HELP, /* more-help option index */ + NO_EQUIVALENT, /* save option index */ + NO_EQUIVALENT, /* '-#' option index */ NO_EQUIVALENT /* index of default opt */ }, - 5 /* full option count */, 2 /* user option count */ + 5 /* full option count */, 2 /* user option count */, + genshellopt_full_usage, genshellopt_short_usage, + NULL, NULL, + PKGDATADIR, genshellopt_packager_info }; /* * Create the static procedure(s) declared above. */ static void -doUsageOpt( - tOptions* pOptions, - tOptDesc* pOptDesc ) +doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc) { - USAGE( EXIT_SUCCESS ); + (void)pOptions; + GENSHELL_USAGE(GENSHELLOPT_EXIT_SUCCESS); } -/* extracted from optcode.tpl near line 514 */ +/* extracted from optcode.tlib near line 666 */ #if ENABLE_NLS #include <stdio.h> @@ -272,11 +305,11 @@ doUsageOpt( #include <unistd.h> #include <autoopts/usage-txt.h> -static char* AO_gettext( char const* pz ); +static char* AO_gettext(char const* pz); static void coerce_it(void** s); static char* -AO_gettext( char const* pz ) +AO_gettext(char const* pz) { char* pzRes; if (pz == NULL) @@ -284,66 +317,68 @@ AO_gettext( char const* pz ) pzRes = _(pz); if (pzRes == pz) return pzRes; - pzRes = strdup( pzRes ); + pzRes = strdup(pzRes); if (pzRes == NULL) { - fputs( _("No memory for duping translated strings\n"), stderr ); - exit( EXIT_FAILURE ); + fputs(_("No memory for duping translated strings\n"), stderr); + exit(GENSHELLOPT_EXIT_FAILURE); } return pzRes; } -static void coerce_it(void** s) { *s = AO_gettext(*s); } -#define COERSION(_f) \ - coerce_it((void*)&(genshelloptOptions._f)) +static void coerce_it(void** s) { *s = AO_gettext(*s); +} /* * This invokes the translation code (e.g. gettext(3)). */ static void -translate_option_strings( void ) +translate_option_strings(void) { + tOptions * const pOpt = &genshelloptOptions; + /* * Guard against re-translation. It won't work. The strings will have * been changed by the first pass through this code. One shot only. */ - if (option_usage_text.field_ct == 0) - return; - /* - * Do the translations. The first pointer follows the field count field. - * The field count field is the size of a pointer. - */ - { - char** ppz = (char**)(void*)&(option_usage_text); - int ix = option_usage_text.field_ct; + if (option_usage_text.field_ct != 0) { + /* + * Do the translations. The first pointer follows the field count + * field. The field count field is the size of a pointer. + */ + tOptDesc * pOD = pOpt->pOptDesc; + char ** ppz = (char**)(void*)&(option_usage_text); + int ix = option_usage_text.field_ct; do { ppz++; *ppz = AO_gettext(*ppz); } while (--ix > 0); + + coerce_it((void*)&(pOpt->pzCopyright)); + coerce_it((void*)&(pOpt->pzCopyNotice)); + coerce_it((void*)&(pOpt->pzFullVersion)); + coerce_it((void*)&(pOpt->pzUsageTitle)); + coerce_it((void*)&(pOpt->pzExplain)); + coerce_it((void*)&(pOpt->pzDetail)); + coerce_it((void*)&(pOpt->pzPackager)); + option_usage_text.field_ct = 0; + + for (ix = pOpt->optCt; ix > 0; ix--, pOD++) + coerce_it((void*)&(pOD->pzText)); } - option_usage_text.field_ct = 0; - - { - tOptDesc* pOD = genshelloptOptions.pOptDesc; - int ix = genshelloptOptions.optCt; - - for (;;) { - pOD->pzText = AO_gettext(pOD->pzText); - pOD->pz_NAME = AO_gettext(pOD->pz_NAME); - pOD->pz_Name = AO_gettext(pOD->pz_Name); - pOD->pz_DisableName = AO_gettext(pOD->pz_DisableName); - pOD->pz_DisablePfx = AO_gettext(pOD->pz_DisablePfx); - if (--ix <= 0) - break; - pOD++; + + if ((pOpt->fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) { + tOptDesc * pOD = pOpt->pOptDesc; + int ix; + + for (ix = pOpt->optCt; ix > 0; ix--, pOD++) { + coerce_it((void*)&(pOD->pz_Name)); + coerce_it((void*)&(pOD->pz_DisableName)); + coerce_it((void*)&(pOD->pz_DisablePfx)); } + /* prevent re-translation */ + genshelloptOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT; } - COERSION(pzCopyright); - COERSION(pzCopyNotice); - COERSION(pzFullVersion); - COERSION(pzUsageTitle); - COERSION(pzExplain); - COERSION(pzDetail); } #endif /* ENABLE_NLS */ diff --git a/sntp/libopts/genshell.h b/sntp/libopts/genshell.h index b57677d..e5457a7 100644 --- a/sntp/libopts/genshell.h +++ b/sntp/libopts/genshell.h @@ -2,41 +2,37 @@ * * DO NOT EDIT THIS FILE (genshell.h) * - * It has been AutoGen-ed Saturday May 5, 2007 at 12:02:35 PM PDT + * It has been AutoGen-ed April 29, 2011 at 03:43:59 PM by AutoGen 5.11.9 * From the definitions genshell.def * and the template file options * - * Generated from AutoOpts 29:0:4 templates. - */ - -/* - * This file was produced by an AutoOpts template. AutoOpts is a - * copyrighted work. This header file is not encumbered by AutoOpts - * licensing, but is provided under the licensing terms chosen by the - * genshellopt author or copyright holder. AutoOpts is licensed under - * the terms of the LGPL. The redistributable library (``libopts'') is - * licensed under the terms of either the LGPL or, at the users discretion, - * the BSD license. See the AutoOpts and/or libopts sources for details. + * Generated from AutoOpts 35:0:10 templates. + * + * AutoOpts is a copyrighted work. This header file is not encumbered + * by AutoOpts licensing, but is provided under the licensing terms chosen + * by the genshellopt author or copyright holder. AutoOpts is + * licensed under the terms of the LGPL. The redistributable library + * (``libopts'') is licensed under the terms of either the LGPL or, at the + * users discretion, the BSD license. See the AutoOpts and/or libopts sources + * for details. * * This source file is copyrighted and licensed under the following terms: * - * genshellopt copyright 1999-2007 Bruce Korb - all rights reserved + * genshellopt copyright (c) 1999-2011 Bruce Korb - all rights reserved * - * genshellopt is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * genshellopt is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * genshellopt is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * genshellopt 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 Lesser General Public - * License along with genshellopt. If not, write to: - * The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor - * Boston, MA 02110-1301, USA. + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ /* * This file contains the programmatic interface to the Automated @@ -45,7 +41,7 @@ * "AutoOpts" chapter. Please refer to that doc for usage help. */ #ifndef AUTOOPTS_GENSHELL_H_GUARD -#define AUTOOPTS_GENSHELL_H_GUARD +#define AUTOOPTS_GENSHELL_H_GUARD 1 #include <autoopts/options.h> /* @@ -55,7 +51,7 @@ * tolerable version is at least as old as what was current when the header * template was released. */ -#define AO_TEMPLATE_VERSION 118784 +#define AO_TEMPLATE_VERSION 143360 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) # error option template version mismatches autoopts/options.h header @@ -66,81 +62,108 @@ * Enumeration of each option: */ typedef enum { - INDEX_OPT_SCRIPT = 0, - INDEX_OPT_SHELL = 1, - INDEX_OPT_VERSION = 2, - INDEX_OPT_HELP = 3, - INDEX_OPT_MORE_HELP = 4 -} teOptIndex; + INDEX_GENSHELL_OPT_SCRIPT = 0, + INDEX_GENSHELL_OPT_SHELL = 1, + INDEX_GENSHELL_OPT_VERSION = 2, + INDEX_GENSHELL_OPT_HELP = 3, + INDEX_GENSHELL_OPT_MORE_HELP = 4 +} teGenshell_OptIndex; -#define OPTION_CT 5 +#define GENSHELL_OPTION_CT 5 #define GENSHELLOPT_VERSION "1" -#define GENSHELLOPT_FULL_VERSION "genshellopt - Generate Shell Option Processing Script - Ver. 1" +#define GENSHELLOPT_FULL_VERSION "genshellopt 1" /* * Interface defines for all options. Replace "n" with the UPPER_CASED - * option name (as in the teOptIndex enumeration above). - * e.g. HAVE_OPT( SCRIPT ) + * option name (as in the teGenshell_OptIndex enumeration above). + * e.g. HAVE_GENSHELL_OPT(SCRIPT) */ -#define DESC(n) (genshelloptOptions.pOptDesc[INDEX_OPT_## n]) -#define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) -#define OPT_ARG(n) (DESC(n).optArg.argString) -#define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK) -#define COUNT_OPT(n) (DESC(n).optOccCt) -#define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n))) -#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n))) -#define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n))) -#define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) -#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) -#define CLEAR_OPT(n) STMTS( \ - DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ - if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \ - DESC(n).fOptState |= OPTST_DISABLED; \ - DESC(n).optCookie = NULL ) +#define GENSHELL_DESC(n) (genshelloptOptions.pOptDesc[INDEX_GENSHELL_OPT_## n]) +#define HAVE_GENSHELL_OPT(n) (! UNUSED_OPT(& GENSHELL_DESC(n))) +#define GENSHELL_OPT_ARG(n) (GENSHELL_DESC(n).optArg.argString) +#define STATE_GENSHELL_OPT(n) (GENSHELL_DESC(n).fOptState & OPTST_SET_MASK) +#define COUNT_GENSHELL_OPT(n) (GENSHELL_DESC(n).optOccCt) +#define ISSEL_GENSHELL_OPT(n) (SELECTED_OPT(&GENSHELL_DESC(n))) +#define ISUNUSED_GENSHELL_OPT(n) (UNUSED_OPT(& GENSHELL_DESC(n))) +#define ENABLED_GENSHELL_OPT(n) (! DISABLED_OPT(& GENSHELL_DESC(n))) +#define STACKCT_GENSHELL_OPT(n) (((tArgList*)(GENSHELL_DESC(n).optCookie))->useCt) +#define STACKLST_GENSHELL_OPT(n) (((tArgList*)(GENSHELL_DESC(n).optCookie))->apzArgs) +#define CLEAR_GENSHELL_OPT(n) STMTS( \ + GENSHELL_DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ + if ((GENSHELL_DESC(n).fOptState & OPTST_INITENABLED) == 0) \ + GENSHELL_DESC(n).fOptState |= OPTST_DISABLED; \ + GENSHELL_DESC(n).optCookie = NULL ) -/* +/* * * * * * + * + * Enumeration of genshellopt exit codes + */ +typedef enum { + GENSHELLOPT_EXIT_SUCCESS = 0, + GENSHELLOPT_EXIT_FAILURE = 1 +} genshellopt_exit_code_t; +/* * * * * * + * * Interface defines for specific options. */ -#define VALUE_OPT_SCRIPT 'o' -#define VALUE_OPT_SHELL 's' - -#define VALUE_OPT_VERSION 'v' -#define VALUE_OPT_HELP '?' -#define VALUE_OPT_MORE_HELP '!' +#define VALUE_GENSHELL_OPT_SCRIPT 'o' +#define VALUE_GENSHELL_OPT_SHELL 's' +#define VALUE_GENSHELL_OPT_HELP '?' +#define VALUE_GENSHELL_OPT_MORE_HELP '!' +#define VALUE_GENSHELL_OPT_VERSION 'v' /* * Interface defines not associated with particular options */ -#define ERRSKIP_OPTERR STMTS( genshelloptOptions.fOptSet &= ~OPTPROC_ERRSTOP ) -#define ERRSTOP_OPTERR STMTS( genshelloptOptions.fOptSet |= OPTPROC_ERRSTOP ) -#define RESTART_OPT(n) STMTS( \ +#define ERRSKIP_GENSHELL_OPTERR STMTS(genshelloptOptions.fOptSet &= ~OPTPROC_ERRSTOP) +#define ERRSTOP_GENSHELL_OPTERR STMTS(genshelloptOptions.fOptSet |= OPTPROC_ERRSTOP) +#define RESTART_GENSHELL_OPT(n) STMTS( \ genshelloptOptions.curOptIdx = (n); \ genshelloptOptions.pzCurOpt = NULL ) -#define START_OPT RESTART_OPT(1) -#define USAGE(c) (*genshelloptOptions.pUsageProc)( &genshelloptOptions, c ) -/* extracted from opthead.tpl near line 360 */ +#define START_GENSHELL_OPT RESTART_GENSHELL_OPT(1) +#define GENSHELL_USAGE(c) (*genshelloptOptions.pUsageProc)(&genshelloptOptions, c) +/* extracted from opthead.tlib near line 451 */ + +#ifdef __cplusplus +extern "C" { +#endif /* * * * * * * * Declare the genshellopt option descriptor. */ -#ifdef __cplusplus -extern "C" { -#endif +extern tOptions genshelloptOptions; -extern tOptions genshelloptOptions; +#if defined(ENABLE_NLS) +# ifndef _ +# include <stdio.h> + static inline char* aoGetsText(char const* pz) { + if (pz == NULL) return NULL; + return (char*)gettext(pz); + } +# define _(s) aoGetsText(s) +# endif /* _() */ -#ifndef _ -# if ENABLE_NLS -# include <stdio.h> - static inline char* aoGetsText( char const* pz ) { - if (pz == NULL) return NULL; - return (char*)gettext( pz ); - } -# define _(s) aoGetsText(s) -# else /* ENABLE_NLS */ -# define _(s) s -# endif /* ENABLE_NLS */ -#endif +# define OPT_NO_XLAT_CFG_NAMES STMTS(genshelloptOptions.fOptSet |= \ + OPTPROC_NXLAT_OPT_CFG;) +# define OPT_NO_XLAT_OPT_NAMES STMTS(genshelloptOptions.fOptSet |= \ + OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;) + +# define OPT_XLAT_CFG_NAMES STMTS(genshelloptOptions.fOptSet &= \ + ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);) +# define OPT_XLAT_OPT_NAMES STMTS(genshelloptOptions.fOptSet &= \ + ~OPTPROC_NXLAT_OPT;) + +#else /* ENABLE_NLS */ +# define OPT_NO_XLAT_CFG_NAMES +# define OPT_NO_XLAT_OPT_NAMES + +# define OPT_XLAT_CFG_NAMES +# define OPT_XLAT_OPT_NAMES + +# ifndef _ +# define _(_s) _s +# endif +#endif /* ENABLE_NLS */ #ifdef __cplusplus } diff --git a/sntp/libopts/libopts.c b/sntp/libopts/libopts.c index feb7557..15a070d 100644 --- a/sntp/libopts/libopts.c +++ b/sntp/libopts/libopts.c @@ -1,17 +1,26 @@ -#define AUTOOPTS_INTERNAL +#include "autoopts/project.h" +#define AUTOOPTS_INTERNAL 1 #include "compat/compat.h" -#define LOCAL static +#define LOCAL static #include "autoopts/options.h" #include "autoopts/usage-txt.h" #include "genshell.h" +#include "xat-attribute.h" +#include "value-type.h" +#include "ag-char-map.h" #include "autoopts.h" #include "proto.h" +#include "parse-duration.h" +#include "parse-duration.c" +#include "value-type.c" +#include "xat-attribute.c" #include "autoopts.c" #include "boolean.c" #include "configfile.c" #include "cook.c" #include "enumeration.c" #include "environment.c" +#include "file.c" #include "genshell.c" #include "load.c" #include "makeshell.c" @@ -19,6 +28,7 @@ #include "numeric.c" #include "pgusage.c" #include "putshell.c" +#include "reset.c" #include "restore.c" #include "save.c" #include "sort.c" @@ -26,5 +36,6 @@ #include "streqvcmp.c" #include "text_mmap.c" #include "tokenize.c" +#include "time.c" #include "usage.c" #include "version.c" diff --git a/sntp/libopts/load.c b/sntp/libopts/load.c index eeeb125..024dce9 100644 --- a/sntp/libopts/load.c +++ b/sntp/libopts/load.c @@ -1,76 +1,44 @@ -/* - * $Id: load.c,v 4.20 2007/02/04 22:17:39 bkorb Exp $ - * Time-stamp: "2007-02-04 11:54:57 bkorb" +/** + * \file load.c + * Time-stamp: "2010-12-18 11:46:07 bkorb" * * This file contains the routines that deal with processing text strings * for options, either from a NUL-terminated string passed in or from an * rc/ini file. - */ - -/* - * Automated Options copyright 1992-2007 Bruce Korb - * - * Automated Options is free software. - * You may 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. - * - * Automated Options 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 Automated Options. See the file "COPYING". If not, - * write to: The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * This file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved * - * As a special exception, Bruce Korb gives permission for additional - * uses of the text contained in his release of AutoOpts. + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. * - * The exception is that, if you link the AutoOpts library with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the AutoOpts library code into it. + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" * - * This exception applies only to the code released by Bruce Korb under - * the name AutoOpts. If you copy code from other sources under the - * General Public License into a copy of AutoOpts, as the General Public - * License permits, the exception does not apply to the code that you add - * in this way. To avoid misleading anyone as to the status of such - * modified files, you must delete this exception notice from them. + * These files have the following md5sums: * - * If you write modifications of your own for AutoOpts, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd */ -tOptionLoadMode option_load_mode = OPTION_LOAD_UNCOOKED; - /* = = = START-STATIC-FORWARD = = = */ -/* static forward declarations maintained by :mkfwd */ static ag_bool -insertProgramPath( - char* pzBuf, - int bufSize, - tCC* pzName, - tCC* pzProgPath ); +insertProgramPath(char * pzBuf, int bufSize, char const * pzName, + char const * pzProgPath); static ag_bool -insertEnvVal( - char* pzBuf, - int bufSize, - tCC* pzName, - tCC* pzProgPath ); +insertEnvVal(char * pzBuf, int bufSize, char const * pzName, + char const * pzProgPath); static char* -assembleArgValue( char* pzTxt, tOptionLoadMode mode ); +assembleArgValue(char* pzTxt, tOptionLoadMode mode); /* = = = END-STATIC-FORWARD = = = */ /*=export_func optionMakePath @@ -86,13 +54,13 @@ assembleArgValue( char* pzTxt, tOptionLoadMode mode ); * ret-desc: AG_TRUE if the name was handled, otherwise AG_FALSE. * If the name does not start with ``$'', then it is handled * simply by copying the input name to the output buffer and - * resolving the name with either @code{canonicalize_file_name(3GLIBC)} - * or @code{realpath(3C)}. + * resolving the name with either + * @code{canonicalize_file_name(3GLIBC)} or @code{realpath(3C)}. * * doc: * - * This routine will copy the @code{pzName} input name into the @code{pzBuf} - * output buffer, carefully not exceeding @code{bufSize} bytes. If the + * This routine will copy the @code{pzName} input name into the + * @code{pzBuf} output buffer, not exceeding @code{bufSize} bytes. If the * first character of the input name is a @code{'$'} character, then there * is special handling: * @* @@ -125,30 +93,19 @@ assembleArgValue( char* pzTxt, tOptionLoadMode mode ); * errors (cannot resolve the resulting path). =*/ ag_bool -optionMakePath( - char* pzBuf, - int bufSize, - tCC* pzName, - tCC* pzProgPath ) +optionMakePath(char * pzBuf, int bufSize, char const * pzName, + char const * pzProgPath) { - size_t name_len = strlen( pzName ); - -# ifndef PKGDATADIR -# define PKGDATADIR "" -# endif - - tSCC pkgdatadir[] = PKGDATADIR; + size_t name_len = strlen(pzName); - ag_bool res = AG_TRUE; - - if (bufSize <= name_len) + if ((bufSize <= name_len) || (name_len == 0)) return AG_FALSE; /* * IF not an environment variable, just copy the data */ if (*pzName != '$') { - tCC* pzS = pzName; + char const* pzS = pzName; char* pzD = pzBuf; int ct = bufSize; @@ -170,46 +127,52 @@ optionMakePath( return AG_FALSE; case '$': - res = insertProgramPath( pzBuf, bufSize, pzName, pzProgPath ); + if (! insertProgramPath(pzBuf, bufSize, pzName, pzProgPath)) + return AG_FALSE; break; case '@': - if (pkgdatadir[0] == NUL) + if (program_pkgdatadir[0] == NUL) return AG_FALSE; - if (name_len + sizeof (pkgdatadir) > bufSize) + if (snprintf(pzBuf, bufSize, "%s%s", program_pkgdatadir, pzName + 2) + >= bufSize) return AG_FALSE; - - strcpy(pzBuf, pkgdatadir); - strcpy(pzBuf + sizeof(pkgdatadir) - 1, pzName + 2); break; default: - res = insertEnvVal( pzBuf, bufSize, pzName, pzProgPath ); + if (! insertEnvVal(pzBuf, bufSize, pzName, pzProgPath)) + return AG_FALSE; } - if (! res) - return AG_FALSE; - #if defined(HAVE_CANONICALIZE_FILE_NAME) { - char* pz = canonicalize_file_name(pzBuf); + char * pz = canonicalize_file_name(pzBuf); if (pz == NULL) return AG_FALSE; - if (strlen(pz) < bufSize) - strcpy(pzBuf, pz); + + name_len = strlen(pz); + if (name_len >= bufSize) { + free(pz); + return AG_FALSE; + } + + memcpy(pzBuf, pz, name_len + 1); free(pz); } #elif defined(HAVE_REALPATH) { - char z[ PATH_MAX+1 ]; + char z[PATH_MAX+1]; + + if (realpath(pzBuf, z) == NULL) + return AG_FALSE; - if (realpath( pzBuf, z ) == NULL) + name_len = strlen(z); + if (name_len >= bufSize) return AG_FALSE; - if (strlen(z) < bufSize) - strcpy( pzBuf, z ); + memcpy(pzBuf, z, name_len + 1); } #endif @@ -218,14 +181,11 @@ optionMakePath( static ag_bool -insertProgramPath( - char* pzBuf, - int bufSize, - tCC* pzName, - tCC* pzProgPath ) +insertProgramPath(char * pzBuf, int bufSize, char const * pzName, + char const * pzProgPath) { - tCC* pzPath; - tCC* pz; + char const* pzPath; + char const* pz; int skip = 2; switch (pzName[2]) { @@ -242,16 +202,16 @@ insertProgramPath( * If it is, we're done. Otherwise, we have to hunt * for the program using "pathfind". */ - if (strchr( pzProgPath, DIRCH ) != NULL) + if (strchr(pzProgPath, DIRCH) != NULL) pzPath = pzProgPath; else { - pzPath = pathfind( getenv( "PATH" ), (char*)pzProgPath, "rx" ); + pzPath = pathfind(getenv("PATH"), (char*)pzProgPath, "rx"); if (pzPath == NULL) return AG_FALSE; } - pz = strrchr( pzPath, DIRCH ); + pz = strrchr(pzPath, DIRCH); /* * IF we cannot find a directory name separator, @@ -269,31 +229,28 @@ insertProgramPath( if ((pz - pzPath)+1 + strlen(pzName) >= bufSize) return AG_FALSE; - memcpy( pzBuf, pzPath, (size_t)((pz - pzPath)+1) ); - strcpy( pzBuf + (pz - pzPath) + 1, pzName ); + memcpy(pzBuf, pzPath, (size_t)((pz - pzPath)+1)); + strcpy(pzBuf + (pz - pzPath) + 1, pzName); /* * If the "pzPath" path was gotten from "pathfind()", then it was * allocated and we need to deallocate it. */ if (pzPath != pzProgPath) - free( (void*)pzPath ); + AGFREE(pzPath); return AG_TRUE; } static ag_bool -insertEnvVal( - char* pzBuf, - int bufSize, - tCC* pzName, - tCC* pzProgPath ) +insertEnvVal(char * pzBuf, int bufSize, char const * pzName, + char const * pzProgPath) { char* pzDir = pzBuf; for (;;) { int ch = (int)*++pzName; - if (! ISNAMECHAR( ch )) + if (! IS_VALUE_NAME_CHAR(ch)) break; *(pzDir++) = (char)ch; } @@ -303,7 +260,7 @@ insertEnvVal( *pzDir = NUL; - pzDir = getenv( pzBuf ); + pzDir = getenv(pzBuf); /* * Environment value not found -- skip the home list entry @@ -311,32 +268,32 @@ insertEnvVal( if (pzDir == NULL) return AG_FALSE; - if (strlen( pzDir ) + 1 + strlen( pzName ) >= bufSize) + if (strlen(pzDir) + 1 + strlen(pzName) >= bufSize) return AG_FALSE; - sprintf( pzBuf, "%s%s", pzDir, pzName ); + sprintf(pzBuf, "%s%s", pzDir, pzName); return AG_TRUE; } LOCAL void -mungeString( char* pzTxt, tOptionLoadMode mode ) +mungeString(char* pzTxt, tOptionLoadMode mode) { char* pzE; if (mode == OPTION_LOAD_KEEP) return; - if (isspace( (int)*pzTxt )) { + if (IS_WHITESPACE_CHAR(*pzTxt)) { char* pzS = pzTxt; char* pzD = pzTxt; - while (isspace( (int)*++pzS )) ; + while (IS_WHITESPACE_CHAR(*++pzS)) ; while ((*(pzD++) = *(pzS++)) != NUL) ; pzE = pzD-1; } else - pzE = pzTxt + strlen( pzTxt ); + pzE = pzTxt + strlen(pzTxt); - while ((pzE > pzTxt) && isspace( (int)pzE[-1] )) pzE--; + while ((pzE > pzTxt) && IS_WHITESPACE_CHAR(pzE[-1])) pzE--; *pzE = NUL; if (mode == OPTION_LOAD_UNCOOKED) @@ -354,15 +311,15 @@ mungeString( char* pzTxt, tOptionLoadMode mode ) case '\'': break; } - (void)ao_string_cook( pzTxt, NULL ); + (void)ao_string_cook(pzTxt, NULL); } static char* -assembleArgValue( char* pzTxt, tOptionLoadMode mode ) +assembleArgValue(char* pzTxt, tOptionLoadMode mode) { - tSCC zBrk[] = " \t:="; - char* pzEnd = strpbrk( pzTxt, zBrk ); + static char const zBrk[] = " \t\n:="; + char* pzEnd = strpbrk(pzTxt, zBrk); int space_break; /* @@ -386,11 +343,11 @@ assembleArgValue( char* pzTxt, tOptionLoadMode mode ) * because we'll have to skip over an immediately following ':' or '=' * (and the white space following *that*). */ - space_break = isspace((int)*pzEnd); + space_break = IS_WHITESPACE_CHAR(*pzEnd); *(pzEnd++) = NUL; - while (isspace((int)*pzEnd)) pzEnd++; + while (IS_WHITESPACE_CHAR(*pzEnd)) pzEnd++; if (space_break && ((*pzEnd == ':') || (*pzEnd == '='))) - while (isspace((int)*++pzEnd)) ; + while (IS_WHITESPACE_CHAR(*++pzEnd)) ; return pzEnd; } @@ -410,12 +367,12 @@ loadOptionLine( tDirection direction, tOptionLoadMode load_mode ) { - while (isspace( (int)*pzLine )) pzLine++; + while (IS_WHITESPACE_CHAR(*pzLine)) pzLine++; { - char* pzArg = assembleArgValue( pzLine, load_mode ); + char* pzArg = assembleArgValue(pzLine, load_mode); - if (! SUCCESSFUL( longOptionFind( pOpts, pzLine, pOS ))) + if (! SUCCESSFUL(longOptionFind(pOpts, pzLine, pOS))) return; if (pOS->flags & OPTST_NO_INIT) return; @@ -496,7 +453,7 @@ loadOptionLine( if (*pOS->pzOptArg == NUL) pOS->pzOptArg = NULL; else { - AGDUPSTR( pOS->pzOptArg, pOS->pzOptArg, "option argument" ); + AGDUPSTR(pOS->pzOptArg, pOS->pzOptArg, "option argument"); pOS->flags |= OPTST_ALLOC_ARG; } @@ -504,7 +461,7 @@ loadOptionLine( if (*pOS->pzOptArg == NUL) pOS->pzOptArg = zNil; else { - AGDUPSTR( pOS->pzOptArg, pOS->pzOptArg, "option argument" ); + AGDUPSTR(pOS->pzOptArg, pOS->pzOptArg, "option argument"); pOS->flags |= OPTST_ALLOC_ARG; } } @@ -512,7 +469,7 @@ loadOptionLine( { tOptionLoadMode sv = option_load_mode; option_load_mode = load_mode; - handleOption( pOpts, pOS ); + handle_opt(pOpts, pOS); option_load_mode = sv; } } @@ -544,15 +501,13 @@ loadOptionLine( * will cause a warning to print, but the function should return. =*/ void -optionLoadLine( - tOptions* pOpts, - tCC* pzLine ) +optionLoadLine(tOptions * pOpts, char const * pzLine) { tOptState st = OPTSTATE_INITIALIZER(SET); char* pz; - AGDUPSTR( pz, pzLine, "user option line" ); - loadOptionLine( pOpts, &st, pz, DIRECTION_PROCESS, OPTION_LOAD_COOKED ); - AGFREE( pz ); + AGDUPSTR(pz, pzLine, "user option line"); + loadOptionLine(pOpts, &st, pz, DIRECTION_PROCESS, OPTION_LOAD_COOKED); + AGFREE(pz); } /* * Local Variables: diff --git a/sntp/libopts/m4/libopts.m4 b/sntp/libopts/m4/libopts.m4 index adc3235..7a52b5e 100644 --- a/sntp/libopts/m4/libopts.m4 +++ b/sntp/libopts/m4/libopts.m4 @@ -2,30 +2,52 @@ dnl -*- buffer-read-only: t -*- vi: set ro: dnl dnl DO NOT EDIT THIS FILE (libopts.m4) dnl -dnl It has been AutoGen-ed Saturday May 5, 2007 at 12:02:37 PM PDT +dnl It has been AutoGen-ed April 29, 2011 at 03:43:56 PM by AutoGen 5.11.9 dnl From the definitions libopts.def dnl and the template file conftest.tpl dnl dnl do always before generated macros: dnl AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[ -[if test X${INVOKE_LIBOPTS_MACROS_FIRST_done} != Xyes ; then] - # ================= - # AC_HEADER_STDC - # ================= - AC_HEADER_STDC - # ================= - # AC_HEADER_DIRENT - # ================= + AC_REQUIRE([AC_HEADER_STDC]) AC_HEADER_DIRENT # ================= # AC_CHECK_HEADERS # ================= - AC_CHECK_HEADERS(dlfcn.h errno.h fcntl.h libgen.h memory.h netinet/in.h \ - setjmp.h sys/mman.h sys/param.h sys/poll.h sys/procset.h sys/select.h \ - sys/socket.h sys/stropts.h sys/time.h sys/un.h sys/wait.h unistd.h \ - utime.h sysexits.h) + AC_CHECK_HEADERS([ \ + dlfcn.h errno.h fcntl.h libgen.h \ + memory.h netinet/in.h setjmp.h sys/mman.h \ + sys/param.h sys/poll.h sys/procset.h sys/select.h \ + sys/socket.h sys/stropts.h sys/time.h sys/un.h \ + sys/wait.h unistd.h utime.h sysexits.h ]) + + AC_CHECK_HEADERS([stdarg.h varargs.h], + [lo_have_arg_hdr=true;break], + [lo_have_arg_hdr=false]) + + AC_CHECK_HEADERS([string.h strings.h], + [lo_have_str_hdr=true;break], + [lo_have_str_hdr=false]) + + AC_CHECK_HEADERS([limits.h sys/limits.h values.h], + [lo_have_lim_hdr=true;break], + [lo_have_lim_hdr=false]) + + AC_CHECK_HEADERS([inttypes.h stdint.h], + [lo_have_typ_hdr=true;break], + [lo_have_typ_hdr=false]) + + # ---------------------------------------------------------------------- + # check for various programs used during the build. + # On OS/X, "wchar.h" needs "runetype.h" to work properly. + # ---------------------------------------------------------------------- + AC_CHECK_HEADERS([runetype.h wchar.h], [], [],[ + AC_INCLUDES_DEFAULT + #if HAVE_RUNETYPE_H + # include <runetype.h> + #endif + ]) # -------------------------------------------- # Verify certain entries from AC_CHECK_HEADERS @@ -33,51 +55,46 @@ AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[ [for f in sys_types sys_mman sys_param sys_stat sys_wait \ string errno stdlib memory setjmp do eval as_ac_var=\${ac_cv_header_${f}_h+set} - test "${as_ac_var}" = set] || \ - AC_MSG_ERROR([You must have ${f}.h on your system]) + test "${as_ac_var}" = set || { + ]AC_MSG_ERROR([You must have ${f}.h on your system])[ + } done - # ================================================ - # AC_CHECK_HEADERS: stdarg.h is present define HAVE_STDARG_H, otherwise - # if varargs.h is present define HAVE_VARARGS_H. - # ================================================ - AC_CHECK_HEADERS(stdarg.h varargs.h, break) - [if test `eval echo '${'$as_ac_Header'}'` != yes; then] - AC_MSG_ERROR([You must have stdarg.h or varargs.h on your system]) - fi + ${lo_have_arg_hdr} || \ + ]AC_MSG_ERROR([You must have stdarg.h or varargs.h on your system])[ - # ================================================ - # Similarly for the string.h and strings.h headers - # ================================================ - AC_CHECK_HEADERS(string.h strings.h, break) - [if test `eval echo '${'$as_ac_Header'}'` != yes; then] - AC_MSG_ERROR([You must have string.h or strings.h on your system]) - fi + ${lo_have_str_hdr} || \ + ]AC_MSG_ERROR([You must have string.h or strings.h on your system])[ - # ===================== - # ...and limits headers - # ===================== - AC_CHECK_HEADERS(limits.h sys/limits.h values.h, break) - [if test `eval echo '${'$as_ac_Header'}'` != yes; then] - AC_MSG_ERROR([You must have one of limits.h, sys/limits.h or values.h]) - fi + ${lo_have_lim_hdr} || \ + ]AC_MSG_ERROR( + [You must have one of limits.h, sys/limits.h or values.h])[ - # ======================== - # ...and int types headers - # ======================== - AC_CHECK_HEADERS(stdint.h inttypes.h, break) + ${lo_have_typ_hdr} || \ + ]AC_MSG_ERROR([You must have inttypes.h or stdint.h on your system]) + + # ---------------------------------------------------------------------- + # Checks for typedefs + # ---------------------------------------------------------------------- + AC_CHECK_TYPES(wchar_t) + AC_CHECK_TYPES(wint_t, [], [], [ + AC_INCLUDES_DEFAULT + #if HAVE_RUNETYPE_H + # include <runetype.h> + #endif + #if HAVE_WCHAR_H + # include <wchar.h> + #endif + ]) AC_CHECK_TYPES([int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, - intptr_t, uint_t]) + intptr_t, uintptr_t, uint_t, pid_t, size_t]) - # ==================== - # uintptr type & sizes - # ==================== - AC_CHECK_TYPES([uintptr_t], , - [AC_DEFINE([uintptr_t], unsigned long, - [Alternate uintptr_t for systems without it.])]) - AC_CHECK_SIZEOF(char*, 4) + # ===== + # sizes + # ===== + AC_CHECK_SIZEOF(char*, 8) AC_CHECK_SIZEOF(int, 4) - AC_CHECK_SIZEOF(long, 4) + AC_CHECK_SIZEOF(long, 8) AC_CHECK_SIZEOF(short, 2) # ---------------------------------------------------------------------- @@ -85,9 +102,29 @@ AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[ # ---------------------------------------------------------------------- AC_CHECK_LIB(gen, pathfind) AC_FUNC_VPRINTF - AC_CHECK_FUNCS([mmap canonicalize_file_name snprintf strdup strchr strrchr]) -[ INVOKE_LIBOPTS_MACROS_FIRST_done=yes -fi]]) + AC_FUNC_FORK + AC_CHECK_FUNCS([mmap canonicalize_file_name snprintf strdup strchr \ + strrchr strsignal]) + AC_PROG_SED + [while : + do + POSIX_SHELL=`which bash` + test -x "$POSIX_SHELL" && break + POSIX_SHELL=`which dash` + test -x "$POSIX_SHELL" && break + POSIX_SHELL=/usr/xpg4/bin/sh + test -x "$POSIX_SHELL" && break + POSIX_SHELL=`/bin/sh -c ' + exec 2>/dev/null + if ! true ; then exit 1 ; fi + echo /bin/sh'` + test -x "$POSIX_SHELL" && break + ]AC_ERROR([Cannot locate a working POSIX shell])[ + done] + AC_DEFINE_UNQUOTED([POSIX_SHELL], ["${POSIX_SHELL}"], + [define to a working POSIX compliant shell]) + AC_SUBST([POSIX_SHELL]) +]) dnl dnl @synopsis INVOKE_LIBOPTS_MACROS @@ -97,12 +134,11 @@ dnl that have not been disabled with "omit-invocation". dnl AC_DEFUN([LIBOPTS_WITH_REGEX_HEADER],[ AC_ARG_WITH([regex-header], - AC_HELP_STRING([--with-regex-header], [a reg expr header is specified]), + AS_HELP_STRING([--with-regex-header], [a reg expr header is specified]), [libopts_cv_with_regex_header=${with_regex_header}], AC_CACHE_CHECK([whether a reg expr header is specified], libopts_cv_with_regex_header, libopts_cv_with_regex_header=no) ) # end of AC_ARG_WITH - if test "X${libopts_cv_with_regex_header}" != Xno then AC_DEFINE_UNQUOTED([REGEX_HEADER],[<${libopts_cv_with_regex_header}>]) @@ -115,13 +151,13 @@ AC_DEFUN([LIBOPTS_WITH_REGEX_HEADER],[ AC_DEFUN([LIBOPTS_WITHLIB_REGEX],[ AC_ARG_WITH([libregex], - AC_HELP_STRING([--with-libregex], [libregex installation prefix]), + AS_HELP_STRING([--with-libregex], [libregex installation prefix]), [libopts_cv_with_libregex_root=${with_libregex}], AC_CACHE_CHECK([whether with-libregex was specified], libopts_cv_with_libregex_root, libopts_cv_with_libregex_root=no) ) # end of AC_ARG_WITH libregex - if test "${with_libguile+set}" = set && \ + if test "${with_libregex+set}" = set && \ test "${withval}" = no then ## disabled by request libopts_cv_with_libregex_root=no @@ -130,14 +166,14 @@ AC_DEFUN([LIBOPTS_WITHLIB_REGEX],[ else AC_ARG_WITH([libregex-cflags], - AC_HELP_STRING([--with-libregex-cflags], [libregex compile flags]), + AS_HELP_STRING([--with-libregex-cflags], [libregex compile flags]), [libopts_cv_with_libregex_cflags=${with_regex_cflags}], AC_CACHE_CHECK([whether with-libregex-cflags was specified], libopts_cv_with_libregex_cflags, libopts_cv_with_libregex_cflags=no) ) # end of AC_ARG_WITH libregex-cflags AC_ARG_WITH([libregex-libs], - AC_HELP_STRING([--with-libregex-libs], [libregex link command arguments]), + AS_HELP_STRING([--with-libregex-libs], [libregex link command arguments]), [libopts_cv_with_libregex_libs=${with_regex_libs}], AC_CACHE_CHECK([whether with-libregex-libs was specified], libopts_cv_with_libregex_libs, libopts_cv_with_libregex_libs=no) @@ -200,7 +236,6 @@ int main() { [libopts_cv_with_libregex=no]) # end of AC_TRY_RUN ]) # end of AC_CACHE_VAL for libopts_cv_with_libregex AC_MSG_RESULT([${libopts_cv_with_libregex}]) - if test "X${libopts_cv_with_libregex}" != Xno then AC_DEFINE([WITH_LIBREGEX],[1], @@ -226,7 +261,6 @@ int main (int argc, char** argv) { ) # end of TRY_RUN ]) # end of AC_CACHE_VAL for libopts_cv_run_pathfind AC_MSG_RESULT([${libopts_cv_run_pathfind}]) - if test "X${libopts_cv_run_pathfind}" != Xno then AC_DEFINE([HAVE_PATHFIND],[1], @@ -243,14 +277,11 @@ AC_DEFUN([LIBOPTS_TEST_DEV_ZERO],[ dzero=\`ls -lL /dev/zero | egrep ^c......r\` test -z "${dzero}" && exit 1 echo ${dzero}` - if test $? -ne 0 - then libopts_cv_test_dev_zero=no - elif test -z "$libopts_cv_test_dev_zero" + if test $? -ne 0 || test -z "$libopts_cv_test_dev_zero" then libopts_cv_test_dev_zero=no fi ]) # end of CACHE_VAL of libopts_cv_test_dev_zero AC_MSG_RESULT([${libopts_cv_test_dev_zero}]) - if test "X${libopts_cv_test_dev_zero}" != Xno then AC_DEFINE([HAVE_DEV_ZERO],[1], @@ -278,7 +309,6 @@ choke me!! ) # end of TRY_RUN ]) # end of AC_CACHE_VAL for libopts_cv_run_realpath AC_MSG_RESULT([${libopts_cv_run_realpath}]) - if test "X${libopts_cv_run_realpath}" != Xno then AC_DEFINE([HAVE_REALPATH],[1], @@ -312,7 +342,6 @@ int main() { ) # end of TRY_RUN ]) # end of AC_CACHE_VAL for libopts_cv_run_strftime AC_MSG_RESULT([${libopts_cv_run_strftime}]) - if test "X${libopts_cv_run_strftime}" != Xno then AC_DEFINE([HAVE_STRFTIME],[1], @@ -333,7 +362,6 @@ return (fp == NULL) ? 1 : fclose(fp); }], ) # end of TRY_RUN ]) # end of AC_CACHE_VAL for libopts_cv_run_fopen_binary AC_MSG_RESULT([${libopts_cv_run_fopen_binary}]) - if test "X${libopts_cv_run_fopen_binary}" != Xno then AC_DEFINE([FOPEN_BINARY_FLAG],"b", @@ -357,7 +385,6 @@ return (fp == NULL) ? 1 : fclose(fp); }], ) # end of TRY_RUN ]) # end of AC_CACHE_VAL for libopts_cv_run_fopen_text AC_MSG_RESULT([${libopts_cv_run_fopen_text}]) - if test "X${libopts_cv_run_fopen_text}" != Xno then AC_DEFINE([FOPEN_TEXT_FLAG],"t", @@ -372,12 +399,11 @@ return (fp == NULL) ? 1 : fclose(fp); }], AC_DEFUN([LIBOPTS_DISABLE_OPTIONAL_ARGS],[ AC_ARG_ENABLE([optional-args], - AC_HELP_STRING([--disable-optional-args], [not wanting optional option args]), + AS_HELP_STRING([--disable-optional-args], [not wanting optional option args]), [libopts_cv_enable_optional_args=${enable_optional_args}], AC_CACHE_CHECK([whether not wanting optional option args], libopts_cv_enable_optional_args, libopts_cv_enable_optional_args=yes) ) # end of AC_ARG_ENABLE - if test "X${libopts_cv_enable_optional_args}" = Xno then AC_DEFINE([NO_OPTIONAL_OPT_ARGS], [1], @@ -388,7 +414,7 @@ AC_DEFUN([LIBOPTS_DISABLE_OPTIONAL_ARGS],[ AC_DEFUN([INVOKE_LIBOPTS_MACROS],[ - INVOKE_LIBOPTS_MACROS_FIRST + AC_REQUIRE([INVOKE_LIBOPTS_MACROS_FIRST]) # Check to see if a reg expr header is specified. LIBOPTS_WITH_REGEX_HEADER @@ -420,21 +446,36 @@ AC_DEFUN([INVOKE_LIBOPTS_MACROS],[ dnl @synopsis LIBOPTS_CHECK dnl -dnl Time-stamp: "2006-09-23 19:36:24 bkorb" -dnl Last Committed: $Date: 2006/09/24 02:59:00 $ +dnl Time-stamp: "2010-11-29 15:45:54 bkorb" dnl dnl If autoopts-config works, add the linking information to LIBS. dnl Otherwise, add ``libopts-${ao_rev}'' to SUBDIRS and run all dnl the config tests that the library needs. Invoke the dnl "INVOKE_LIBOPTS_MACROS" macro iff we are building libopts. dnl +dnl This file is part of AutoGen. +dnl AutoGen Copyright (c) 1992-2011 by Bruce Korb - all rights reserved +dnl +dnl AutoGen is free software: you can redistribute it and/or modify it +dnl under the terms of the GNU General Public License as published by the +dnl Free Software Foundation, either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl AutoGen is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +dnl See the GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License along +dnl with this program. If not, see <http://www.gnu.org/licenses/>. +dnl dnl Default to system libopts dnl -AC_DEFUN([LIBOPTS_CHECK],[ +AC_DEFUN([LIBOPTS_CHECK_COMMON],[ + AC_REQUIRE([INVOKE_LIBOPTS_MACROS_FIRST]) [NEED_LIBOPTS_DIR=''] m4_pushdef([AO_Libopts_Dir], [ifelse($1, , [libopts], [$1])]) - AC_SUBST(LIBOPTS_DIR, AO_Libopts_Dir) AC_ARG_ENABLE([local-libopts], AC_HELP_STRING([--enable-local-libopts], [Force using the supplied libopts tearoff code]),[ @@ -491,19 +532,51 @@ AC_DEFUN([LIBOPTS_CHECK],[ LIBOPTS_CFLAGS='-I$(top_srcdir)/]AO_Libopts_Dir[' NEED_LIBOPTS_DIR=true fi - fi # end of if test -z "${NEED_LIBOPTS_DIR}"] - + fi # end of if test -z "${NEED_LIBOPTS_DIR}" + if test -n "${LIBOPTS_BUILD_BLOCKED}" ; then + NEED_LIBOPTS_DIR='' + fi] AM_CONDITIONAL([NEED_LIBOPTS], [test -n "${NEED_LIBOPTS_DIR}"]) AC_SUBST(LIBOPTS_LDADD) AC_SUBST(LIBOPTS_CFLAGS) AC_SUBST(LIBOPTS_DIR, AO_Libopts_Dir) - AC_CONFIG_FILES(AO_Libopts_Dir/Makefile) m4_popdef([AO_Libopts_Dir]) - - [if test -n "${NEED_LIBOPTS_DIR}" ; then] +[# end of AC_DEFUN of LIBOPTS_CHECK_COMMON] +]) +dnl AC_CONFIG_FILES conditionalization requires using AM_COND_IF, however +dnl AM_COND_IF is new to Automake 1.11. To use it on new Automake without +dnl requiring same, a fallback implementation for older Automake is provided. +dnl Note that disabling of AC_CONFIG_FILES requires Automake 1.11, this code +dnl is correct only in terms of m4sh generated script. +m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF], [ +if test -z "$$1_TRUE"; then : + m4_n([$2])[]dnl +m4_ifval([$3], +[else + $3 +])dnl +fi[]dnl +])]) +dnl +AC_DEFUN([LIBOPTS_CHECK_NOBUILD], [ + m4_pushdef([AO_Libopts_Dir], + [ifelse($1, , [libopts], [$1])]) + LIBOPTS_BUILD_BLOCKED=true + LIBOPTS_CHECK_COMMON(AO_Libopts_Dir) + m4_popdef([AO_Libopts_Dir])dnl +# end of AC_DEFUN of LIBOPTS_CHECK_NOBUILD +]) +dnl +AC_DEFUN([LIBOPTS_CHECK], [ + m4_pushdef([AO_Libopts_Dir], + [ifelse($1, , [libopts], [$1])]) + LIBOPTS_BUILD_BLOCKED='' + LIBOPTS_CHECK_COMMON(AO_Libopts_Dir) + AM_COND_IF([NEED_LIBOPTS], [ INVOKE_LIBOPTS_MACROS - else - INVOKE_LIBOPTS_MACROS_FIRST - [fi -# end of AC_DEFUN of LIBOPTS_CHECK] + AC_CONFIG_FILES(AO_Libopts_Dir/Makefile) + ])dnl + m4_popdef([AO_Libopts_Dir])dnl +# end of AC_DEFUN of LIBOPTS_CHECK ]) + diff --git a/sntp/libopts/m4/liboptschk.m4 b/sntp/libopts/m4/liboptschk.m4 index 14e7f27..48e4ceb 100644 --- a/sntp/libopts/m4/liboptschk.m4 +++ b/sntp/libopts/m4/liboptschk.m4 @@ -1,42 +1,29 @@ -# liboptschk.m4 serial 1 (autogen - 5.7.3) -dnl Copyright (C) 2005 Free Software Foundation, Inc. +# liboptschk.m4 serial 2 (autogen - 5.11.4) +dnl Copyright (c) 2005-2011 by Bruce Korb - all rights reserved +dnl dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. - -dnl Time-stamp: "2006-09-23 19:42:31 bkorb" -dnl Last Committed: $Date: 2006/09/24 02:59:00 $ - -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 <drepper@cygnus.com>, 1995-2000. -dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003. - -AC_PREREQ(2.50) - +dnl +dnl Time-stamp: "2010-12-07 12:57:56 bkorb" +dnl AC_DEFUN([ag_FIND_LIBOPTS], - [if test "X${ac_cv_header_autoopts_options_h}" == Xno + [if test "X${ac_cv_header_autoopts_options_h}" = Xno + then : + else + f=`autoopts-config cflags` 2>/dev/null + if test X"${f}" = X then : else - f=`autoopts-config cflags` 2>/dev/null - test X"${f}" = X && f=`libopts-config cflags` 2>/dev/null - if test X"${f}" = X - then - : - else - AC_DEFINE([HAVE_LIBOPTS],[1],[define if we can find libopts]) - CFLAGS="${CFLAGS} ${f}" - f=`autoopts-config ldflags` 2>/dev/null - test X"${f}" = X && f=`libopts-config ldflags` 2>/dev/null - LIBS="${LIBS} ${f}" - fi - fi]) + AC_DEFINE([HAVE_LIBOPTS],[1],[define if we can find libopts]) + CFLAGS="${CFLAGS} ${f}" + ao_CFLAGS="${f}" + AC_SUBST(ao_CFLAGS) + + f=`autoopts-config ldflags` 2>/dev/null + LIBS="${LIBS} ${f}" + ao_LIBS="${f}" + AC_SUBST(ao_LIBS) + fi + fi]) diff --git a/sntp/libopts/makeshell.c b/sntp/libopts/makeshell.c index 8447d45..7b9b6cd 100644 --- a/sntp/libopts/makeshell.c +++ b/sntp/libopts/makeshell.c @@ -1,74 +1,52 @@ -/* - * $Id: makeshell.c,v 4.20 2007/02/04 17:44:12 bkorb Exp $ - * Time-stamp: "2007-01-27 06:05:45 bkorb" +/** + * \file makeshell.c + * + * Time-stamp: "2011-04-20 11:06:57 bkorb" * * This module will interpret the options set in the tOptions * structure and create a Bourne shell script capable of parsing them. - */ - -/* - * Automated Options copyright 1992-2007 Bruce Korb * - * Automated Options is free software. - * You may 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 file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved * - * Automated Options 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. + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. * - * You should have received a copy of the GNU General Public License - * along with Automated Options. See the file "COPYING". If not, - * write to: The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" * - * As a special exception, Bruce Korb gives permission for additional - * uses of the text contained in his release of AutoOpts. + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" * - * The exception is that, if you link the AutoOpts library with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the AutoOpts library code into it. + * These files have the following md5sums: * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. - * - * This exception applies only to the code released by Bruce Korb under - * the name AutoOpts. If you copy code from other sources under the - * General Public License into a copy of AutoOpts, as the General Public - * License permits, the exception does not apply to the code that you add - * in this way. To avoid misleading anyone as to the status of such - * modified files, you must delete this exception notice from them. - * - * If you write modifications of your own for AutoOpts, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd */ -tOptions* pShellParseOptions = NULL; +tOptions * optionParseShellOptions = NULL; /* * * * * * * * * * * * * * * * * * * * * * * Setup Format Strings */ -tSCC zStartMarker[] = +static char const zStartMarker[] = "# # # # # # # # # # -- do not modify this marker --\n#\n" "# DO NOT EDIT THIS SECTION"; -tSCC zPreamble[] = +static char const zPreamble[] = "%s OF %s\n#\n" "# From here to the next `-- do not modify this marker --',\n" "# the text has been generated %s\n"; -tSCC zEndPreamble[] = +static char const zEndPreamble[] = "# From the %s option definitions\n#\n"; -tSCC zMultiDef[] = "\n" +static char const zMultiDef[] = "\n" "if test -z \"${%1$s_%2$s}\"\n" "then\n" " %1$s_%2$s_CT=0\n" @@ -78,12 +56,12 @@ tSCC zMultiDef[] = "\n" "fi\n" "export %1$s_%2$s_CT"; -tSCC zSingleDef[] = "\n" +static char const zSingleDef[] = "\n" "%1$s_%2$s=\"${%1$s_%2$s-'%3$s'}\"\n" "%1$s_%2$s_set=false\n" "export %1$s_%2$s\n"; -tSCC zSingleNoDef[] = "\n" +static char const zSingleNoDef[] = "\n" "%1$s_%2$s=\"${%1$s_%2$s}\"\n" "%1$s_%2$s_set=false\n" "export %1$s_%2$s\n"; @@ -96,7 +74,7 @@ tSCC zSingleNoDef[] = "\n" * all options are named options (loop only) * regular, marked option processing. */ -tSCC zLoopCase[] = "\n" +static char const zLoopCase[] = "\n" "OPT_PROCESS=true\n" "OPT_ARG=\"$1\"\n\n" "while ${OPT_PROCESS} && [ $# -gt 0 ]\ndo\n" @@ -111,7 +89,7 @@ tSCC zLoopCase[] = "\n" " shift\n" " ;;\n\n"; -tSCC zLoopOnly[] = "\n" +static char const zLoopOnly[] = "\n" "OPT_ARG=\"$1\"\n\n" "while [ $# -gt 0 ]\ndo\n" " OPT_ELEMENT=''\n" @@ -126,16 +104,16 @@ tSCC zLoopOnly[] = "\n" * then we must have selectors for each acceptable option * type (long option, flag character and non-option) */ -tSCC zLongSelection[] = +static char const zLongSelection[] = " --* )\n"; -tSCC zFlagSelection[] = +static char const zFlagSelection[] = " -* )\n"; -tSCC zEndSelection[] = +static char const zEndSelection[] = " ;;\n\n"; -tSCC zNoSelection[] = +static char const zNoSelection[] = " * )\n" " OPT_PROCESS=false\n" " ;;\n" @@ -145,7 +123,7 @@ tSCC zNoSelection[] = * * LOOP END */ -tSCC zLoopEnd[] = +static char const zLoopEnd[] = " if [ -n \"${OPT_ARG_VAL}\" ]\n" " then\n" " eval %1$s_${OPT_NAME}${OPT_ELEMENT}=\"'${OPT_ARG_VAL}'\"\n" @@ -160,7 +138,7 @@ tSCC zLoopEnd[] = "unset OPT_CODE || :\n" "unset OPT_ARG_VAL || :\n%2$s"; -tSCC zTrailerMarker[] = "\n" +static char const zTrailerMarker[] = "\n" "# # # # # # # # # #\n#\n" "# END OF AUTOMATED OPTION PROCESSING\n" "#\n# # # # # # # # # # -- do not modify this marker --\n"; @@ -169,22 +147,22 @@ tSCC zTrailerMarker[] = "\n" * * OPTION SELECTION */ -tSCC zOptionCase[] = +static char const zOptionCase[] = " case \"${OPT_CODE}\" in\n"; -tSCC zOptionPartName[] = +static char const zOptionPartName[] = " '%s' | \\\n"; -tSCC zOptionFullName[] = +static char const zOptionFullName[] = " '%s' )\n"; -tSCC zOptionFlag[] = +static char const zOptionFlag[] = " '%c' )\n"; -tSCC zOptionEndSelect[] = +static char const zOptionEndSelect[] = " ;;\n\n"; -tSCC zOptionUnknown[] = +static char const zOptionUnknown[] = " * )\n" " echo Unknown %s: \"${OPT_CODE}\" >&2\n" " echo \"$%s_USAGE_TEXT\"\n" @@ -198,29 +176,29 @@ tSCC zOptionUnknown[] = * * Formats for emitting the text for handling particular options */ -tSCC zTextExit[] = +static char const zTextExit[] = " echo \"$%s_%s_TEXT\"\n" " exit 0\n"; -tSCC zPagedUsageExit[] = +static char const zPagedUsageExit[] = " echo \"$%s_LONGUSAGE_TEXT\" | ${PAGER-more}\n" " exit 0\n"; -tSCC zCmdFmt[] = +static char const zCmdFmt[] = " %s\n"; -tSCC zCountTest[] = +static char const zCountTest[] = " if [ $%1$s_%2$s_CT -ge %3$d ] ; then\n" " echo Error: more than %3$d %2$s options >&2\n" " echo \"$%1$s_USAGE_TEXT\"\n" " exit 1 ; fi\n"; -tSCC zMultiArg[] = +static char const zMultiArg[] = " %1$s_%2$s_CT=`expr ${%1$s_%2$s_CT} + 1`\n" " OPT_ELEMENT=\"_${%1$s_%2$s_CT}\"\n" " OPT_NAME='%2$s'\n"; -tSCC zSingleArg[] = +static char const zSingleArg[] = " if [ -n \"${%1$s_%2$s}\" ] && ${%1$s_%2$s_set} ; then\n" " echo Error: duplicate %2$s option >&2\n" " echo \"$%1$s_USAGE_TEXT\"\n" @@ -228,14 +206,14 @@ tSCC zSingleArg[] = " %1$s_%2$s_set=true\n" " OPT_NAME='%2$s'\n"; -tSCC zNoMultiArg[] = +static char const zNoMultiArg[] = " %1$s_%2$s_CT=0\n" " OPT_ELEMENT=''\n" " %1$s_%2$s='%3$s'\n" " export %1$s_%2$s\n" " OPT_NAME='%2$s'\n"; -tSCC zNoSingleArg[] = +static char const zNoSingleArg[] = " if [ -n \"${%1$s_%2$s}\" ] && ${%1$s_%2$s_set} ; then\n" " echo Error: duplicate %2$s option >&2\n" " echo \"$%1$s_USAGE_TEXT\"\n" @@ -245,15 +223,15 @@ tSCC zNoSingleArg[] = " export %1$s_%2$s\n" " OPT_NAME='%2$s'\n"; -tSCC zMayArg[] = +static char const zMayArg[] = " eval %1$s_%2$s${OPT_ELEMENT}=true\n" " export %1$s_%2$s${OPT_ELEMENT}\n" " OPT_ARG_NEEDED=OK\n"; -tSCC zMustArg[] = +static char const zMustArg[] = " OPT_ARG_NEEDED=YES\n"; -tSCC zCantArg[] = +static char const zCantArg[] = " eval %1$s_%2$s${OPT_ELEMENT}=true\n" " export %1$s_%2$s${OPT_ELEMENT}\n" " OPT_ARG_NEEDED=NO\n"; @@ -264,7 +242,7 @@ tSCC zCantArg[] = * * Formats for emitting the text for handling long option types */ -tSCC zLongOptInit[] = +static char const zLongOptInit[] = " OPT_CODE=`echo \"X${OPT_ARG}\"|sed 's/^X-*//'`\n" " shift\n" " OPT_ARG=\"$1\"\n\n" @@ -272,7 +250,7 @@ tSCC zLongOptInit[] = " OPT_ARG_VAL=`echo \"${OPT_CODE}\"|sed 's/^[^=]*=//'`\n" " OPT_CODE=`echo \"${OPT_CODE}\"|sed 's/=.*$//'` ;; esac\n\n"; -tSCC zLongOptArg[] = +static char const zLongOptArg[] = " case \"${OPT_ARG_NEEDED}\" in\n" " NO )\n" " OPT_ARG_VAL=''\n" @@ -308,11 +286,11 @@ tSCC zLongOptArg[] = * * Formats for emitting the text for handling flag option types */ -tSCC zFlagOptInit[] = +static char const zFlagOptInit[] = " OPT_CODE=`echo \"X${OPT_ARG}\" | sed 's/X-\\(.\\).*/\\1/'`\n" " OPT_ARG=` echo \"X${OPT_ARG}\" | sed 's/X-.//'`\n\n"; -tSCC zFlagOptArg[] = +static char const zFlagOptArg[] = " case \"${OPT_ARG_NEEDED}\" in\n" " NO )\n" " if [ -n \"${OPT_ARG}\" ]\n" @@ -364,33 +342,35 @@ static char* pzLeader = NULL; static char* pzTrailer = NULL; /* = = = START-STATIC-FORWARD = = = */ -/* static forward declarations maintained by :mkfwd */ static void -textToVariable( tOptions* pOpts, teTextTo whichVar, tOptDesc* pOD ); +emit_var_text(char const * prog, char const * var, int fdin); + +static void +textToVariable(tOptions * pOpts, teTextTo whichVar, tOptDesc * pOD); static void -emitUsage( tOptions* pOpts ); +emitUsage(tOptions* pOpts); static void -emitSetup( tOptions* pOpts ); +emitSetup(tOptions* pOpts); static void -printOptionAction( tOptions* pOpts, tOptDesc* pOptDesc ); +printOptionAction(tOptions* pOpts, tOptDesc* pOptDesc); static void -printOptionInaction( tOptions* pOpts, tOptDesc* pOptDesc ); +printOptionInaction(tOptions* pOpts, tOptDesc* pOptDesc); static void -emitFlag( tOptions* pOpts ); +emitFlag(tOptions* pOpts); static void -emitMatchExpr( tCC* pzMatchName, tOptDesc* pCurOpt, tOptions* pOpts ); +emitMatchExpr(tCC* pzMatchName, tOptDesc* pCurOpt, tOptions* pOpts); static void -emitLong( tOptions* pOpts ); +emitLong(tOptions* pOpts); static void -openOutput( char const* pzFile ); +openOutput(char const* pzFile); /* = = = END-STATIC-FORWARD = = = */ /*=export_func optionParseShell @@ -403,146 +383,205 @@ openOutput( char const* pzFile ); * Emit a shell script that will parse the command line options. =*/ void -optionParseShell( tOptions* pOpts ) +optionParseShell(tOptions* pOpts) { /* * Check for our SHELL option now. * IF the output file contains the "#!" magic marker, * it will override anything we do here. */ - if (HAVE_OPT( SHELL )) - pzShell = OPT_ARG( SHELL ); + if (HAVE_GENSHELL_OPT(SHELL)) + pzShell = GENSHELL_OPT_ARG(SHELL); - else if (! ENABLED_OPT( SHELL )) + else if (! ENABLED_GENSHELL_OPT(SHELL)) pzShell = NULL; - else if ((pzShell = getenv( "SHELL" )), + else if ((pzShell = getenv("SHELL")), pzShell == NULL) - pzShell = "/bin/sh"; + pzShell = POSIX_SHELL; /* * Check for a specified output file */ - if (HAVE_OPT( SCRIPT )) - openOutput( OPT_ARG( SCRIPT )); + if (HAVE_GENSHELL_OPT(SCRIPT)) + openOutput(GENSHELL_OPT_ARG(SCRIPT)); - emitUsage( pOpts ); - emitSetup( pOpts ); + emitUsage(pOpts); + emitSetup(pOpts); /* * There are four modes of option processing. */ switch (pOpts->fOptSet & (OPTPROC_LONGOPT|OPTPROC_SHORTOPT)) { case OPTPROC_LONGOPT: - fputs( zLoopCase, stdout ); + fputs(zLoopCase, stdout); - fputs( zLongSelection, stdout ); - fputs( zLongOptInit, stdout ); - emitLong( pOpts ); - printf( zLongOptArg, pOpts->pzPROGNAME ); - fputs( zEndSelection, stdout ); + fputs(zLongSelection, stdout); + fputs(zLongOptInit, stdout); + emitLong(pOpts); + printf(zLongOptArg, pOpts->pzPROGNAME); + fputs(zEndSelection, stdout); - fputs( zNoSelection, stdout ); + fputs(zNoSelection, stdout); break; case 0: - fputs( zLoopOnly, stdout ); - fputs( zLongOptInit, stdout ); - emitLong( pOpts ); - printf( zLongOptArg, pOpts->pzPROGNAME ); + fputs(zLoopOnly, stdout); + fputs(zLongOptInit, stdout); + emitLong(pOpts); + printf(zLongOptArg, pOpts->pzPROGNAME); break; case OPTPROC_SHORTOPT: - fputs( zLoopCase, stdout ); + fputs(zLoopCase, stdout); - fputs( zFlagSelection, stdout ); - fputs( zFlagOptInit, stdout ); - emitFlag( pOpts ); - printf( zFlagOptArg, pOpts->pzPROGNAME ); - fputs( zEndSelection, stdout ); + fputs(zFlagSelection, stdout); + fputs(zFlagOptInit, stdout); + emitFlag(pOpts); + printf(zFlagOptArg, pOpts->pzPROGNAME); + fputs(zEndSelection, stdout); - fputs( zNoSelection, stdout ); + fputs(zNoSelection, stdout); break; case OPTPROC_LONGOPT|OPTPROC_SHORTOPT: - fputs( zLoopCase, stdout ); + fputs(zLoopCase, stdout); - fputs( zLongSelection, stdout ); - fputs( zLongOptInit, stdout ); - emitLong( pOpts ); - printf( zLongOptArg, pOpts->pzPROGNAME ); - fputs( zEndSelection, stdout ); + fputs(zLongSelection, stdout); + fputs(zLongOptInit, stdout); + emitLong(pOpts); + printf(zLongOptArg, pOpts->pzPROGNAME); + fputs(zEndSelection, stdout); - fputs( zFlagSelection, stdout ); - fputs( zFlagOptInit, stdout ); - emitFlag( pOpts ); - printf( zFlagOptArg, pOpts->pzPROGNAME ); - fputs( zEndSelection, stdout ); + fputs(zFlagSelection, stdout); + fputs(zFlagOptInit, stdout); + emitFlag(pOpts); + printf(zFlagOptArg, pOpts->pzPROGNAME); + fputs(zEndSelection, stdout); - fputs( zNoSelection, stdout ); + fputs(zNoSelection, stdout); break; } - printf( zLoopEnd, pOpts->pzPROGNAME, zTrailerMarker ); + printf(zLoopEnd, pOpts->pzPROGNAME, zTrailerMarker); if ((pzTrailer != NULL) && (*pzTrailer != '\0')) - fputs( pzTrailer, stdout ); - else if (ENABLED_OPT( SHELL )) - printf( "\nenv | grep '^%s_'\n", pOpts->pzPROGNAME ); + fputs(pzTrailer, stdout); + else if (ENABLED_GENSHELL_OPT(SHELL)) + printf("\nenv | grep '^%s_'\n", pOpts->pzPROGNAME); + + fflush(stdout); + fchmod(STDOUT_FILENO, 0755); + fclose(stdout); + if (ferror(stdout)) { + fputs(zOutputFail, stderr); + exit(EXIT_FAILURE); + } +} + +#ifdef HAVE_WORKING_FORK +static void +emit_var_text(char const * prog, char const * var, int fdin) +{ + FILE * fp = fdopen(fdin, "r" FOPEN_BINARY_FLAG); + int nlct = 0; /* defer newlines and skip trailing ones */ + + printf("%s_%s_TEXT='", prog, var); + if (fp == NULL) + goto skip_text; + + for (;;) { + int ch = fgetc(fp); + switch (ch) { + + case '\n': + nlct++; + break; + + case '\'': + while (nlct > 0) { + fputc('\n', stdout); + nlct--; + } + fputs("'\\''", stdout); + break; + + case EOF: + goto endCharLoop; + + default: + while (nlct > 0) { + fputc('\n', stdout); + nlct--; + } + fputc(ch, stdout); + break; + } + } endCharLoop:; - fflush( stdout ); - fchmod( STDOUT_FILENO, 0755 ); - fclose( stdout ); + fclose(fp); + +skip_text: + + fputs("'\n\n", stdout); } +#endif +/* + * The purpose of this function is to assign "long usage", short usage + * and version information to a shell variable. Rather than wind our + * way through all the logic necessary to emit the text directly, we + * fork(), have our child process emit the text the normal way and + * capture the output in the parent process. + */ static void -textToVariable( tOptions* pOpts, teTextTo whichVar, tOptDesc* pOD ) +textToVariable(tOptions * pOpts, teTextTo whichVar, tOptDesc * pOD) { -# define _TT_(n) tSCC z ## n [] = #n; +# define _TT_(n) static char const z ## n [] = #n; TEXTTO_TABLE # undef _TT_ # define _TT_(n) z ## n , - static char const* apzTTNames[] = { TEXTTO_TABLE }; + static char const * apzTTNames[] = { TEXTTO_TABLE }; # undef _TT_ -#if defined(__windows__) && !defined(__CYGWIN__) - printf( "%1$s_%2$s_TEXT='no %2$s text'\n", - pOpts->pzPROGNAME, apzTTNames[ whichVar ]); +#if ! defined(HAVE_WORKING_FORK) + printf("%1$s_%2$s_TEXT='no %2$s text'\n", + pOpts->pzPROGNAME, apzTTNames[ whichVar ]); #else - int nlHoldCt = 0; int pipeFd[2]; - FILE* fp; - printf( "%s_%s_TEXT='", pOpts->pzPROGNAME, apzTTNames[ whichVar ]); - fflush( stdout ); + fflush(stdout); + fflush(stderr); - if (pipe( pipeFd ) != 0) { - fprintf( stderr, zBadPipe, errno, strerror( errno )); - exit( EXIT_FAILURE ); + if (pipe(pipeFd) != 0) { + fprintf(stderr, zBadPipe, errno, strerror(errno)); + exit(EXIT_FAILURE); } switch (fork()) { case -1: - fprintf( stderr, zForkFail, errno, strerror(errno), pOpts->pzProgName); - exit( EXIT_FAILURE ); + fprintf(stderr, zForkFail, errno, strerror(errno), pOpts->pzProgName); + exit(EXIT_FAILURE); break; case 0: - dup2( pipeFd[1], STDERR_FILENO ); - dup2( pipeFd[1], STDOUT_FILENO ); - close( pipeFd[0] ); + /* + * Send both stderr and stdout to the pipe. No matter which + * descriptor is used, we capture the output on the read end. + */ + dup2(pipeFd[1], STDERR_FILENO); + dup2(pipeFd[1], STDOUT_FILENO); + close(pipeFd[0]); switch (whichVar) { case TT_LONGUSAGE: - (*(pOpts->pUsageProc))( pOpts, EXIT_SUCCESS ); + (*(pOpts->pUsageProc))(pOpts, EXIT_SUCCESS); /* NOTREACHED */ - exit( EXIT_FAILURE ); case TT_USAGE: - (*(pOpts->pUsageProc))( pOpts, EXIT_FAILURE ); + (*(pOpts->pUsageProc))(pOpts, EXIT_FAILURE); /* NOTREACHED */ - exit( EXIT_FAILURE ); case TT_VERSION: if (pOD->fOptState & OPTST_ALLOC_ARG) { @@ -550,57 +589,26 @@ textToVariable( tOptions* pOpts, teTextTo whichVar, tOptDesc* pOD ) pOD->fOptState &= ~OPTST_ALLOC_ARG; } pOD->optArg.argString = "c"; - optionPrintVersion( pOpts, pOD ); + optionPrintVersion(pOpts, pOD); /* NOTREACHED */ default: - exit( EXIT_FAILURE ); + exit(EXIT_FAILURE); } default: - close( pipeFd[1] ); - fp = fdopen( pipeFd[0], "r" FOPEN_BINARY_FLAG ); + close(pipeFd[1]); } - for (;;) { - int ch = fgetc( fp ); - switch (ch) { - - case '\n': - nlHoldCt++; - break; - - case '\'': - while (nlHoldCt > 0) { - fputc( '\n', stdout ); - nlHoldCt--; - } - fputs( "'\\''", stdout ); - break; - - case EOF: - goto endCharLoop; - - default: - while (nlHoldCt > 0) { - fputc( '\n', stdout ); - nlHoldCt--; - } - fputc( ch, stdout ); - break; - } - } endCharLoop:; - - fputs( "'\n\n", stdout ); - close( pipeFd[0] ); + emit_var_text(pOpts->pzPROGNAME, apzTTNames[whichVar], pipeFd[0]); #endif } static void -emitUsage( tOptions* pOpts ) +emitUsage(tOptions* pOpts) { - char zTimeBuf[ AO_NAME_SIZE ]; + char zTimeBuf[AO_NAME_SIZE]; /* * First, switch stdout to the output file name. @@ -609,45 +617,52 @@ emitUsage( tOptions* pOpts ) * executable name). Down case the upper cased name. */ if (pzLeader != NULL) - fputs( pzLeader, stdout ); + fputs(pzLeader, stdout); { tSCC zStdout[] = "stdout"; tCC* pzOutName; { - time_t curTime = time( NULL ); - struct tm* pTime = localtime( &curTime ); + time_t curTime = time(NULL); + struct tm* pTime = localtime(&curTime); strftime(zTimeBuf, AO_NAME_SIZE, "%A %B %e, %Y at %r %Z", pTime ); } - if (HAVE_OPT( SCRIPT )) - pzOutName = OPT_ARG( SCRIPT ); + if (HAVE_GENSHELL_OPT(SCRIPT)) + pzOutName = GENSHELL_OPT_ARG(SCRIPT); else pzOutName = zStdout; if ((pzLeader == NULL) && (pzShell != NULL)) - printf( "#! %s\n", pzShell ); + printf("#! %s\n", pzShell); - printf( zPreamble, zStartMarker, pzOutName, zTimeBuf ); + printf(zPreamble, zStartMarker, pzOutName, zTimeBuf); } + printf(zEndPreamble, pOpts->pzPROGNAME); + /* - * Get a copy of the original program name in lower case + * Get a copy of the original program name in lower case and + * fill in an approximation of the program name from it. */ { - char* pzPN = zTimeBuf; - tCC* pz = pOpts->pzPROGNAME; + char * pzPN = zTimeBuf; + char const * pz = pOpts->pzPROGNAME; + char ** pp; + for (;;) { - if ((*pzPN++ = tolower( *pz++ )) == '\0') + if ((*pzPN++ = tolower(*pz++)) == '\0') break; } - } - printf( zEndPreamble, pOpts->pzPROGNAME ); + pp = (char **)(void *)&(pOpts->pzProgPath); + *pp = zTimeBuf; + pp = (char **)(void *)&(pOpts->pzProgName); + *pp = zTimeBuf; + } - pOpts->pzProgPath = pOpts->pzProgName = zTimeBuf; - textToVariable( pOpts, TT_LONGUSAGE, NULL ); - textToVariable( pOpts, TT_USAGE, NULL ); + textToVariable(pOpts, TT_LONGUSAGE, NULL); + textToVariable(pOpts, TT_USAGE, NULL); { tOptDesc* pOptDesc = pOpts->pOptDesc; @@ -655,7 +670,7 @@ emitUsage( tOptions* pOpts ) for (;;) { if (pOptDesc->pOptProc == optionPrintVersion) { - textToVariable( pOpts, TT_VERSION, pOptDesc ); + textToVariable(pOpts, TT_VERSION, pOptDesc); break; } @@ -668,7 +683,7 @@ emitUsage( tOptions* pOpts ) static void -emitSetup( tOptions* pOpts ) +emitSetup(tOptions* pOpts) { tOptDesc* pOptDesc = pOpts->pOptDesc; int optionCt = pOpts->presetOptCt; @@ -695,7 +710,7 @@ emitSetup( tOptions* pOpts ) */ switch (OPTST_GET_ARGTYPE(pOptDesc->fOptState)) { case OPARG_TYPE_ENUMERATION: - (*(pOptDesc->pOptProc))( (tOptions*)2UL, pOptDesc ); + (*(pOptDesc->pOptProc))(OPTPROC_EMIT_SHELL, pOptDesc ); pzDefault = pOptDesc->optArg.argString; break; @@ -703,14 +718,14 @@ emitSetup( tOptions* pOpts ) * Numeric and membership bit options are just printed as a number. */ case OPARG_TYPE_NUMERIC: - snprintf( zVal, sizeof( zVal ), "%d", - (int)pOptDesc->optArg.argInt ); + snprintf(zVal, sizeof(zVal), "%d", + (int)pOptDesc->optArg.argInt); pzDefault = zVal; break; case OPARG_TYPE_MEMBERSHIP: - snprintf( zVal, sizeof( zVal ), "%lu", - (unsigned long)pOptDesc->optArg.argIntptr ); + snprintf(zVal, sizeof(zVal), "%lu", + (unsigned long)pOptDesc->optArg.argIntptr); pzDefault = zVal; break; @@ -728,99 +743,99 @@ emitSetup( tOptions* pOpts ) pzDefault = pOptDesc->optArg.argString; } - printf( pzFmt, pOpts->pzPROGNAME, pOptDesc->pz_NAME, pzDefault ); + printf(pzFmt, pOpts->pzPROGNAME, pOptDesc->pz_NAME, pzDefault); } } static void -printOptionAction( tOptions* pOpts, tOptDesc* pOptDesc ) +printOptionAction(tOptions* pOpts, tOptDesc* pOptDesc) { if (pOptDesc->pOptProc == optionPrintVersion) - printf( zTextExit, pOpts->pzPROGNAME, "VERSION" ); + printf(zTextExit, pOpts->pzPROGNAME, "VERSION"); else if (pOptDesc->pOptProc == optionPagedUsage) - printf( zPagedUsageExit, pOpts->pzPROGNAME ); + printf(zPagedUsageExit, pOpts->pzPROGNAME); else if (pOptDesc->pOptProc == optionLoadOpt) { - printf( zCmdFmt, "echo 'Warning: Cannot load options files' >&2" ); - printf( zCmdFmt, "OPT_ARG_NEEDED=YES" ); + printf(zCmdFmt, "echo 'Warning: Cannot load options files' >&2"); + printf(zCmdFmt, "OPT_ARG_NEEDED=YES"); } else if (pOptDesc->pz_NAME == NULL) { if (pOptDesc->pOptProc == NULL) { - printf( zCmdFmt, "echo 'Warning: Cannot save options files' " - ">&2" ); - printf( zCmdFmt, "OPT_ARG_NEEDED=OK" ); + printf(zCmdFmt, "echo 'Warning: Cannot save options files' " + ">&2"); + printf(zCmdFmt, "OPT_ARG_NEEDED=OK"); } else - printf( zTextExit, pOpts->pzPROGNAME, "LONGUSAGE" ); + printf(zTextExit, pOpts->pzPROGNAME, "LONGUSAGE"); } else { if (pOptDesc->optMaxCt == 1) - printf( zSingleArg, pOpts->pzPROGNAME, pOptDesc->pz_NAME ); + printf(zSingleArg, pOpts->pzPROGNAME, pOptDesc->pz_NAME); else { if ((unsigned)pOptDesc->optMaxCt < NOLIMIT) - printf( zCountTest, pOpts->pzPROGNAME, - pOptDesc->pz_NAME, pOptDesc->optMaxCt ); + printf(zCountTest, pOpts->pzPROGNAME, + pOptDesc->pz_NAME, pOptDesc->optMaxCt); - printf( zMultiArg, pOpts->pzPROGNAME, pOptDesc->pz_NAME ); + printf(zMultiArg, pOpts->pzPROGNAME, pOptDesc->pz_NAME); } /* * Fix up the args. */ if (OPTST_GET_ARGTYPE(pOptDesc->fOptState) == OPARG_TYPE_NONE) { - printf( zCantArg, pOpts->pzPROGNAME, pOptDesc->pz_NAME ); + printf(zCantArg, pOpts->pzPROGNAME, pOptDesc->pz_NAME); } else if (pOptDesc->fOptState & OPTST_ARG_OPTIONAL) { - printf( zMayArg, pOpts->pzPROGNAME, pOptDesc->pz_NAME ); + printf(zMayArg, pOpts->pzPROGNAME, pOptDesc->pz_NAME); } else { - fputs( zMustArg, stdout ); + fputs(zMustArg, stdout); } } - fputs( zOptionEndSelect, stdout ); + fputs(zOptionEndSelect, stdout); } static void -printOptionInaction( tOptions* pOpts, tOptDesc* pOptDesc ) +printOptionInaction(tOptions* pOpts, tOptDesc* pOptDesc) { if (pOptDesc->pOptProc == optionLoadOpt) { - printf( zCmdFmt, "echo 'Warning: Cannot suppress the loading of " - "options files' >&2" ); + printf(zCmdFmt, "echo 'Warning: Cannot suppress the loading of " + "options files' >&2"); } else if (pOptDesc->optMaxCt == 1) - printf( zNoSingleArg, pOpts->pzPROGNAME, - pOptDesc->pz_NAME, pOptDesc->pz_DisablePfx ); + printf(zNoSingleArg, pOpts->pzPROGNAME, + pOptDesc->pz_NAME, pOptDesc->pz_DisablePfx); else - printf( zNoMultiArg, pOpts->pzPROGNAME, - pOptDesc->pz_NAME, pOptDesc->pz_DisablePfx ); + printf(zNoMultiArg, pOpts->pzPROGNAME, + pOptDesc->pz_NAME, pOptDesc->pz_DisablePfx); - printf( zCmdFmt, "OPT_ARG_NEEDED=NO" ); - fputs( zOptionEndSelect, stdout ); + printf(zCmdFmt, "OPT_ARG_NEEDED=NO"); + fputs(zOptionEndSelect, stdout); } static void -emitFlag( tOptions* pOpts ) +emitFlag(tOptions* pOpts) { tOptDesc* pOptDesc = pOpts->pOptDesc; int optionCt = pOpts->optCt; - fputs( zOptionCase, stdout ); + fputs(zOptionCase, stdout); for (;optionCt > 0; pOptDesc++, --optionCt) { if (SKIP_OPT(pOptDesc)) continue; - if (isprint( pOptDesc->optValue )) { - printf( zOptionFlag, pOptDesc->optValue ); - printOptionAction( pOpts, pOptDesc ); + if (IS_GRAPHIC_CHAR(pOptDesc->optValue)) { + printf(zOptionFlag, pOptDesc->optValue); + printOptionAction(pOpts, pOptDesc); } } - printf( zOptionUnknown, "flag", pOpts->pzPROGNAME ); + printf(zOptionUnknown, "flag", pOpts->pzPROGNAME); } @@ -828,7 +843,7 @@ emitFlag( tOptions* pOpts ) * Emit the match text for a long option */ static void -emitMatchExpr( tCC* pzMatchName, tOptDesc* pCurOpt, tOptions* pOpts ) +emitMatchExpr(tCC* pzMatchName, tOptDesc* pCurOpt, tOptions* pOpts) { tOptDesc* pOD = pOpts->pOptDesc; int oCt = pOpts->optCt; @@ -854,8 +869,8 @@ emitMatchExpr( tCC* pzMatchName, tOptDesc* pCurOpt, tOptions* pOpts ) * They must not be the same. They cannot be, because it would * not compile correctly if they were. */ - while ( toupper( pOD->pz_Name[matchCt] ) - == toupper( pzMatchName[matchCt] )) + while ( toupper(pOD->pz_Name[matchCt]) + == toupper(pzMatchName[matchCt])) matchCt++; if (matchCt > min) @@ -866,8 +881,8 @@ emitMatchExpr( tCC* pzMatchName, tOptDesc* pCurOpt, tOptions* pOpts ) */ if (pOD->pz_DisableName != NULL) { matchCt = 0; - while ( toupper( pOD->pz_DisableName[matchCt] ) - == toupper( pzMatchName[matchCt] )) + while ( toupper(pOD->pz_DisableName[matchCt]) + == toupper(pzMatchName[matchCt])) matchCt++; if (matchCt > min) min = matchCt; @@ -883,7 +898,7 @@ emitMatchExpr( tCC* pzMatchName, tOptDesc* pCurOpt, tOptions* pOpts ) */ if ( (pzMatchName[min ] == NUL) || (pzMatchName[min+1] == NUL) ) - printf( zOptionFullName, pzMatchName ); + printf(zOptionFullName, pzMatchName); else { int matchCt = 0; @@ -892,11 +907,11 @@ emitMatchExpr( tCC* pzMatchName, tOptDesc* pCurOpt, tOptions* pOpts ) for (;;) { *pz = NUL; - printf( zOptionPartName, zName ); + printf(zOptionPartName, zName); *pz++ = pzMatchName[matchCt++]; if (pzMatchName[matchCt] == NUL) { *pz = NUL; - printf( zOptionFullName, zName ); + printf(zOptionFullName, zName); break; } } @@ -908,12 +923,12 @@ emitMatchExpr( tCC* pzMatchName, tOptDesc* pCurOpt, tOptions* pOpts ) * Emit GNU-standard long option handling code */ static void -emitLong( tOptions* pOpts ) +emitLong(tOptions* pOpts) { tOptDesc* pOD = pOpts->pOptDesc; int ct = pOpts->optCt; - fputs( zOptionCase, stdout ); + fputs(zOptionCase, stdout); /* * do each option, ... @@ -925,24 +940,24 @@ emitLong( tOptions* pOpts ) if (SKIP_OPT(pOD)) continue; - emitMatchExpr( pOD->pz_Name, pOD, pOpts ); - printOptionAction( pOpts, pOD ); + emitMatchExpr(pOD->pz_Name, pOD, pOpts); + printOptionAction(pOpts, pOD); /* * Now, do the same thing for the disablement version of the option. */ if (pOD->pz_DisableName != NULL) { - emitMatchExpr( pOD->pz_DisableName, pOD, pOpts ); - printOptionInaction( pOpts, pOD ); + emitMatchExpr(pOD->pz_DisableName, pOD, pOpts); + printOptionInaction(pOpts, pOD); } } while (pOD++, --ct > 0); - printf( zOptionUnknown, "option", pOpts->pzPROGNAME ); + printf(zOptionUnknown, "option", pOpts->pzPROGNAME); } static void -openOutput( char const* pzFile ) +openOutput(char const* pzFile) { FILE* fp; char* pzData = NULL; @@ -957,19 +972,19 @@ openOutput( char const* pzFile ) * THEN assume we are creating a new file. * Skip the loading of the old data. */ - if (stat( pzFile, &stbf ) != 0) + if (stat(pzFile, &stbf) != 0) break; /* * The file must be a regular file */ - if (! S_ISREG( stbf.st_mode )) { - fprintf( stderr, zNotFile, pzFile ); - exit( EXIT_FAILURE ); + if (! S_ISREG(stbf.st_mode)) { + fprintf(stderr, zNotFile, pzFile); + exit(EXIT_FAILURE); } pzData = AGALOC(stbf.st_size + 1, "file data"); - fp = fopen( pzFile, "r" FOPEN_BINARY_FLAG ); + fp = fopen(pzFile, "r" FOPEN_BINARY_FLAG); sizeLeft = (unsigned)stbf.st_size; pzScan = pzData; @@ -978,7 +993,7 @@ openOutput( char const* pzFile ) * Read in all the data as fast as our OS will let us. */ for (;;) { - int inct = fread( (void*)pzScan, (size_t)1, sizeLeft, fp); + int inct = fread((void*)pzScan, (size_t)1, sizeLeft, fp); if (inct == 0) break; @@ -993,29 +1008,32 @@ openOutput( char const* pzFile ) * NUL-terminate the leader and look for the trailer */ *pzScan = '\0'; - fclose( fp ); - pzScan = strstr( pzData, zStartMarker ); + fclose(fp); + pzScan = strstr(pzData, zStartMarker); if (pzScan == NULL) { pzTrailer = pzData; break; } *(pzScan++) = NUL; - pzScan = strstr( pzScan, zTrailerMarker ); + pzScan = strstr(pzScan, zTrailerMarker); if (pzScan == NULL) { pzTrailer = pzData; break; } /* - * Check to see if the data contains - * our marker. If it does, then we will skip over it + * Check to see if the data contains our marker. + * If it does, then we will skip over it */ - pzTrailer = pzScan + sizeof( zTrailerMarker ) - 1; + pzTrailer = pzScan + sizeof(zTrailerMarker) - 1; pzLeader = pzData; } while (AG_FALSE); - freopen( pzFile, "w" FOPEN_BINARY_FLAG, stdout ); + if (freopen(pzFile, "w" FOPEN_BINARY_FLAG, stdout) != stdout) { + fprintf(stderr, zFreopenFail, errno, strerror(errno)); + exit(EXIT_FAILURE); + } } @@ -1034,19 +1052,21 @@ openOutput( char const* pzFile ) * and create shell script variables containing the two types of text. =*/ void -genshelloptUsage( tOptions* pOpts, int exitCode ) +genshelloptUsage(tOptions * pOpts, int exitCode) { -#if defined(__windows__) && !defined(__CYGWIN__) - optionUsage( pOpts, exitCode ); +#if ! defined(HAVE_WORKING_FORK) + optionUsage(pOpts, exitCode); #else /* * IF not EXIT_SUCCESS, * THEN emit the short form of usage. */ if (exitCode != EXIT_SUCCESS) - optionUsage( pOpts, exitCode ); - fflush( stderr ); - fflush( stdout ); + optionUsage(pOpts, exitCode); + fflush(stderr); + fflush(stdout); + if (ferror(stdout) || ferror(stderr)) + exit(EXIT_FAILURE); option_usage_fp = stdout; @@ -1055,20 +1075,19 @@ genshelloptUsage( tOptions* pOpts, int exitCode ) */ switch (fork()) { case -1: - optionUsage( pOpts, EXIT_FAILURE ); - /*NOTREACHED*/ - _exit( EXIT_FAILURE ); + optionUsage(pOpts, EXIT_FAILURE); + /* NOTREACHED */ case 0: pagerState = PAGER_STATE_CHILD; - optionUsage( pOpts, EXIT_SUCCESS ); - /*NOTREACHED*/ - _exit( EXIT_FAILURE ); + optionUsage(pOpts, EXIT_SUCCESS); + /* NOTREACHED */ + _exit(EXIT_FAILURE); default: { int sts; - wait( &sts ); + wait(&sts); } } @@ -1077,11 +1096,12 @@ genshelloptUsage( tOptions* pOpts, int exitCode ) * gets it from the command line */ { - char* pz; - AGDUPSTR( pz, pShellParseOptions->pzPROGNAME, "program name" ); - pShellParseOptions->pzProgName = pz; + char * pz; + char ** pp = (char **)(void *)&(optionParseShellOptions->pzProgName); + AGDUPSTR(pz, optionParseShellOptions->pzPROGNAME, "program name"); + *pp = pz; while (*pz != NUL) { - *pz = tolower( *pz ); + *pz = tolower(*pz); pz++; } } @@ -1089,8 +1109,8 @@ genshelloptUsage( tOptions* pOpts, int exitCode ) /* * Separate the makeshell usage from the client usage */ - fprintf( option_usage_fp, zGenshell, pShellParseOptions->pzProgName ); - fflush( option_usage_fp ); + fprintf(option_usage_fp, zGenshell, optionParseShellOptions->pzProgName); + fflush(option_usage_fp); /* * Now, print the client usage. @@ -1100,16 +1120,22 @@ genshelloptUsage( tOptions* pOpts, int exitCode ) pagerState = PAGER_STATE_CHILD; /*FALLTHROUGH*/ case -1: - optionUsage( pShellParseOptions, EXIT_FAILURE ); + optionUsage(optionParseShellOptions, EXIT_FAILURE); default: { int sts; - wait( &sts ); + wait(&sts); } } - exit( EXIT_SUCCESS ); + fflush(stdout); + if (ferror(stdout)) { + fputs(zOutputFail, stderr); + exit(EXIT_FAILURE); + } + + exit(EXIT_SUCCESS); #endif } diff --git a/sntp/libopts/nested.c b/sntp/libopts/nested.c index b39f8d1..f9f7e7a 100644 --- a/sntp/libopts/nested.c +++ b/sntp/libopts/nested.c @@ -1,122 +1,123 @@ -/* - * $Id: nested.c,v 4.14 2007/02/04 17:44:12 bkorb Exp $ - * Time-stamp: "2007-01-26 11:04:35 bkorb" +/** + * \file nested.c * - * Automated Options Nested Values module. - */ - -/* - * Automated Options copyright 1992-2007 Bruce Korb - * - * Automated Options is free software. - * You may 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. + * Time-stamp: "2010-08-22 11:17:56 bkorb" * - * Automated Options 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. + * Automated Options Nested Values module. * - * You should have received a copy of the GNU General Public License - * along with Automated Options. See the file "COPYING". If not, - * write to: The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * This file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved * - * As a special exception, Bruce Korb gives permission for additional - * uses of the text contained in his release of AutoOpts. + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. * - * The exception is that, if you link the AutoOpts library with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the AutoOpts library code into it. + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" * - * This exception applies only to the code released by Bruce Korb under - * the name AutoOpts. If you copy code from other sources under the - * General Public License into a copy of AutoOpts, as the General Public - * License permits, the exception does not apply to the code that you add - * in this way. To avoid misleading anyone as to the status of such - * modified files, you must delete this exception notice from them. + * These files have the following md5sums: * - * If you write modifications of your own for AutoOpts, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd */ + +typedef struct { + int xml_ch; + int xml_len; + char xml_txt[8]; +} xml_xlate_t; + +static xml_xlate_t const xml_xlate[] = { + { '&', 4, "amp;" }, + { '<', 3, "lt;" }, + { '>', 3, "gt;" }, + { '"', 5, "quot;" }, + { '\'',5, "apos;" } +}; + /* = = = START-STATIC-FORWARD = = = */ -/* static forward declarations maintained by :mkfwd */ static void -removeBackslashes( char* pzSrc ); +remove_continuation(char* pzSrc); static char const* -scanQuotedString( char const* pzTxt ); +scan_q_str(char const* pzTxt); static tOptionValue* -addStringValue( void** pp, char const* pzName, size_t nameLen, - char const* pzValue, size_t dataLen ); +add_string(void** pp, char const* pzName, size_t nameLen, + char const* pzValue, size_t dataLen); static tOptionValue* -addBoolValue( void** pp, char const* pzName, size_t nameLen, - char const* pzValue, size_t dataLen ); +add_bool(void** pp, char const* pzName, size_t nameLen, + char const* pzValue, size_t dataLen); static tOptionValue* -addNumberValue( void** pp, char const* pzName, size_t nameLen, - char const* pzValue, size_t dataLen ); +add_number(void** pp, char const* pzName, size_t nameLen, + char const* pzValue, size_t dataLen); static tOptionValue* -addNestedValue( void** pp, char const* pzName, size_t nameLen, - char* pzValue, size_t dataLen ); +add_nested(void** pp, char const* pzName, size_t nameLen, + char* pzValue, size_t dataLen); -static char const* -scanNameEntry(char const* pzName, tOptionValue* pRes); +static char const * +scan_name(char const* pzName, tOptionValue* pRes); static char const* -scanXmlEntry( char const* pzName, tOptionValue* pRes ); - -static void -unloadNestedArglist( tArgList* pAL ); +scan_xml(char const* pzName, tOptionValue* pRes); static void -sortNestedList( tArgList* pAL ); +sort_list(tArgList* pAL); /* = = = END-STATIC-FORWARD = = = */ -/* removeBackslashes - * - * This function assumes that all newline characters were preceeded by - * backslashes that need removal. +/** + * Backslashes are used for line continuations. We keep the newline + * characters, but trim out the backslash: */ static void -removeBackslashes( char* pzSrc ) +remove_continuation(char* pzSrc) { - char* pzD = strchr(pzSrc, '\n'); + char* pzD; - if (pzD == NULL) - return; - *--pzD = '\n'; + do { + while (*pzSrc == '\n') pzSrc++; + pzD = strchr(pzSrc, '\n'); + if (pzD == NULL) + return; + /* + * pzD has skipped at least one non-newline character and now + * points to a newline character. It now becomes the source and + * pzD goes to the previous character. + */ + pzSrc = pzD--; + if (*pzD != '\\') + pzD++; + } while (pzD == pzSrc); + + /* + * Start shifting text. + */ for (;;) { char ch = ((*pzD++) = *(pzSrc++)); switch (ch) { - case '\n': *--pzD = ch; break; case NUL: return; - default: - ; + case '\\': + if (*pzSrc == '\n') + --pzD; /* rewrite on next iteration */ } } } - -/* scanQuotedString - * +/** * Find the end of a quoted string, skipping escaped quote characters. */ static char const* -scanQuotedString( char const* pzTxt ) +scan_q_str(char const* pzTxt) { char q = *(pzTxt++); /* remember the type of quote */ @@ -149,18 +150,17 @@ scanQuotedString( char const* pzTxt ) } -/* addStringValue - * +/** * Associate a name with either a string or no value. */ static tOptionValue* -addStringValue( void** pp, char const* pzName, size_t nameLen, - char const* pzValue, size_t dataLen ) +add_string(void** pp, char const* pzName, size_t nameLen, + char const* pzValue, size_t dataLen) { tOptionValue* pNV; size_t sz = nameLen + dataLen + sizeof(*pNV); - pNV = AGALOC( sz, "option name/str value pair" ); + pNV = AGALOC(sz, "option name/str value pair"); if (pNV == NULL) return NULL; @@ -170,178 +170,173 @@ addStringValue( void** pp, char const* pzName, size_t nameLen, } else { pNV->valType = OPARG_TYPE_STRING; - if (dataLen > 0) - memcpy( pNV->v.strVal, pzValue, dataLen ); - pNV->v.strVal[dataLen] = NUL; + if (dataLen > 0) { + char const * pzSrc = pzValue; + char * pzDst = pNV->v.strVal; + int ct = dataLen; + do { + int ch = *(pzSrc++) & 0xFF; + if (ch == NUL) goto data_copy_done; + if (ch == '&') + ch = get_special_char(&pzSrc, &ct); + *(pzDst++) = ch; + } while (--ct > 0); + data_copy_done: + *pzDst = NUL; + + } else { + pNV->v.strVal[0] = NUL; + } + pNV->pzName = pNV->v.strVal + dataLen + 1; } - memcpy( pNV->pzName, pzName, nameLen ); + memcpy(pNV->pzName, pzName, nameLen); pNV->pzName[ nameLen ] = NUL; - addArgListEntry( pp, pNV ); + addArgListEntry(pp, pNV); return pNV; } - -/* addBoolValue - * +/** * Associate a name with either a string or no value. */ static tOptionValue* -addBoolValue( void** pp, char const* pzName, size_t nameLen, - char const* pzValue, size_t dataLen ) +add_bool(void** pp, char const* pzName, size_t nameLen, + char const* pzValue, size_t dataLen) { tOptionValue* pNV; size_t sz = nameLen + sizeof(*pNV) + 1; - pNV = AGALOC( sz, "option name/bool value pair" ); + pNV = AGALOC(sz, "option name/bool value pair"); if (pNV == NULL) return NULL; - while (isspace( (int)*pzValue ) && (dataLen > 0)) { + while (IS_WHITESPACE_CHAR(*pzValue) && (dataLen > 0)) { dataLen--; pzValue++; } if (dataLen == 0) pNV->v.boolVal = 0; - else if (isdigit( (int)*pzValue )) - pNV->v.boolVal = atoi( pzValue ); - else switch (*pzValue) { - case 'f': - case 'F': - case 'n': - case 'N': - pNV->v.boolVal = 0; break; - default: - pNV->v.boolVal = 1; - } + + else if (IS_DEC_DIGIT_CHAR(*pzValue)) + pNV->v.boolVal = atoi(pzValue); + + else pNV->v.boolVal = ! IS_FALSE_TYPE_CHAR(*pzValue); pNV->valType = OPARG_TYPE_BOOLEAN; pNV->pzName = (char*)(pNV + 1); - memcpy( pNV->pzName, pzName, nameLen ); + memcpy(pNV->pzName, pzName, nameLen); pNV->pzName[ nameLen ] = NUL; - addArgListEntry( pp, pNV ); + addArgListEntry(pp, pNV); return pNV; } - -/* addNumberValue - * +/** * Associate a name with either a string or no value. */ static tOptionValue* -addNumberValue( void** pp, char const* pzName, size_t nameLen, - char const* pzValue, size_t dataLen ) +add_number(void** pp, char const* pzName, size_t nameLen, + char const* pzValue, size_t dataLen) { tOptionValue* pNV; size_t sz = nameLen + sizeof(*pNV) + 1; - pNV = AGALOC( sz, "option name/bool value pair" ); + pNV = AGALOC(sz, "option name/bool value pair"); if (pNV == NULL) return NULL; - while (isspace( (int)*pzValue ) && (dataLen > 0)) { + while (IS_WHITESPACE_CHAR(*pzValue) && (dataLen > 0)) { dataLen--; pzValue++; } if (dataLen == 0) - pNV->v.boolVal = 0; + pNV->v.longVal = 0; else - pNV->v.boolVal = atoi( pzValue ); + pNV->v.longVal = strtol(pzValue, 0, 0); pNV->valType = OPARG_TYPE_NUMERIC; - pNV->pzName = (char*)(pNV + 1); - memcpy( pNV->pzName, pzName, nameLen ); + pNV->pzName = (char*)(pNV + 1); + memcpy(pNV->pzName, pzName, nameLen); pNV->pzName[ nameLen ] = NUL; - addArgListEntry( pp, pNV ); + addArgListEntry(pp, pNV); return pNV; } - -/* addNestedValue - * +/** * Associate a name with either a string or no value. */ static tOptionValue* -addNestedValue( void** pp, char const* pzName, size_t nameLen, - char* pzValue, size_t dataLen ) +add_nested(void** pp, char const* pzName, size_t nameLen, + char* pzValue, size_t dataLen) { tOptionValue* pNV; if (dataLen == 0) { size_t sz = nameLen + sizeof(*pNV) + 1; - pNV = AGALOC( sz, "empty nested value pair" ); + pNV = AGALOC(sz, "empty nested value pair"); if (pNV == NULL) return NULL; pNV->v.nestVal = NULL; pNV->valType = OPARG_TYPE_HIERARCHY; pNV->pzName = (char*)(pNV + 1); - memcpy( pNV->pzName, pzName, nameLen ); + memcpy(pNV->pzName, pzName, nameLen); pNV->pzName[ nameLen ] = NUL; } else { - pNV = optionLoadNested( pzValue, pzName, nameLen ); + pNV = optionLoadNested(pzValue, pzName, nameLen); } if (pNV != NULL) - addArgListEntry( pp, pNV ); + addArgListEntry(pp, pNV); return pNV; } - -/* scanNameEntry - * +/** * We have an entry that starts with a name. Find the end of it, cook it * (if called for) and create the name/value association. */ -static char const* -scanNameEntry(char const* pzName, tOptionValue* pRes) +static char const * +scan_name(char const* pzName, tOptionValue* pRes) { tOptionValue* pNV; - char const * pzScan = pzName+1; + char const * pzScan = pzName+1; /* we know first char is a name char */ char const * pzVal; size_t nameLen = 1; size_t dataLen = 0; - while (ISNAMECHAR( (int)*pzScan )) { pzScan++; nameLen++; } + /* + * Scan over characters that name a value. These names may not end + * with a colon, but they may contain colons. + */ + while (IS_VALUE_NAME_CHAR(*pzScan)) { pzScan++; nameLen++; } + if (pzScan[-1] == ':') { pzScan--; nameLen--; } + while (IS_HORIZ_WHITE_CHAR(*pzScan)) pzScan++; - while (isspace( (int)*pzScan )) { - char ch = *(pzScan++); - if ((ch == '\n') || (ch == ',')) { - addStringValue(&(pRes->v.nestVal), pzName, nameLen, NULL,(size_t)0); - return pzScan - 1; - } - } + re_switch: switch (*pzScan) { case '=': case ':': - while (isspace( (int)*++pzScan )) ; - switch (*pzScan) { - case ',': goto comma_char; - case '"': - case '\'': goto quote_char; - case NUL: goto nul_byte; - default: goto default_char; - } + while (IS_HORIZ_WHITE_CHAR((int)*++pzScan)) ; + if ((*pzScan == '=') || (*pzScan == ':')) + goto default_char; + goto re_switch; + case '\n': case ',': - comma_char: pzScan++; /* FALLTHROUGH */ case NUL: - nul_byte: - addStringValue(&(pRes->v.nestVal), pzName, nameLen, NULL, (size_t)0); + add_string(&(pRes->v.nestVal), pzName, nameLen, NULL, (size_t)0); break; case '"': case '\'': - quote_char: pzVal = pzScan; - pzScan = scanQuotedString( pzScan ); + pzScan = scan_q_str(pzScan); dataLen = pzScan - pzVal; - pNV = addStringValue( &(pRes->v.nestVal), pzName, nameLen, pzVal, - dataLen ); + pNV = add_string(&(pRes->v.nestVal), pzName, nameLen, pzVal, + dataLen); if ((pNV != NULL) && (option_load_mode == OPTION_LOAD_COOKED)) - ao_string_cook( pNV->v.strVal, NULL ); + ao_string_cook(pNV->v.strVal, NULL); break; default: @@ -370,10 +365,10 @@ scanNameEntry(char const* pzName, tOptionValue* pRes) case ',': dataLen = (pzScan - pzVal) - 1; string_done: - pNV = addStringValue( &(pRes->v.nestVal), pzName, nameLen, - pzVal, dataLen ); + pNV = add_string(&(pRes->v.nestVal), pzName, nameLen, + pzVal, dataLen); if (pNV != NULL) - removeBackslashes( pNV->v.strVal ); + remove_continuation(pNV->v.strVal); goto leave_scan_name; } } @@ -383,15 +378,13 @@ scanNameEntry(char const* pzName, tOptionValue* pRes) return pzScan; } - -/* scanXmlEntry - * +/** * We've found a '<' character. We ignore this if it is a comment or a * directive. If it is something else, then whatever it is we are looking * at is bogus. Returning NULL stops processing. */ static char const* -scanXmlEntry( char const* pzName, tOptionValue* pRes ) +scan_xml(char const* pzName, tOptionValue* pRes) { size_t nameLen = 1, valLen = 0; char const* pzScan = ++pzName; @@ -400,20 +393,20 @@ scanXmlEntry( char const* pzName, tOptionValue* pRes ) tOptionValue* pNewVal; tOptionLoadMode save_mode = option_load_mode; - if (! isalpha((int)*pzName)) { + if (! IS_VAR_FIRST_CHAR(*pzName)) { switch (*pzName) { default: pzName = NULL; break; case '!': - pzName = strstr( pzName, "-->" ); + pzName = strstr(pzName, "-->"); if (pzName != NULL) pzName += 3; break; case '?': - pzName = strchr( pzName, '>' ); + pzName = strchr(pzName, '>'); if (pzName != NULL) pzName++; break; @@ -421,7 +414,8 @@ scanXmlEntry( char const* pzName, tOptionValue* pRes ) return pzName; } - while (isalpha( (int)*++pzScan )) nameLen++; + pzScan++; + while (IS_VALUE_NAME_CHAR((int)*pzScan)) { pzScan++; nameLen++; } if (nameLen > 64) return NULL; valu.valType = OPARG_TYPE_STRING; @@ -447,9 +441,9 @@ scanXmlEntry( char const* pzName, tOptionValue* pRes ) option_load_mode = save_mode; return NULL; } - addStringValue(&(pRes->v.nestVal), pzName, nameLen, NULL, (size_t)0); + add_string(&(pRes->v.nestVal), pzName, nameLen, NULL, (size_t)0); option_load_mode = save_mode; - return pzScan+2; + return pzScan+1; default: option_load_mode = save_mode; @@ -477,46 +471,46 @@ scanXmlEntry( char const* pzName, tOptionValue* pRes ) *(pzD++) = '>'; *pzD = NUL; - pzScan = strstr( pzScan, z ); + pzScan = strstr(pzScan, z); if (pzScan == NULL) { option_load_mode = save_mode; return NULL; } valLen = (pzScan - pzVal); pzScan += nameLen + 3; - while (isspace( (int)*pzScan )) pzScan++; + while (IS_WHITESPACE_CHAR(*pzScan)) pzScan++; } switch (valu.valType) { case OPARG_TYPE_NONE: - addStringValue( &(pRes->v.nestVal), pzName, nameLen, NULL, (size_t)0); + add_string(&(pRes->v.nestVal), pzName, nameLen, NULL, (size_t)0); break; case OPARG_TYPE_STRING: - pNewVal = addStringValue( + pNewVal = add_string( &(pRes->v.nestVal), pzName, nameLen, pzVal, valLen); if (option_load_mode == OPTION_LOAD_KEEP) break; - mungeString( pNewVal->v.strVal, option_load_mode ); + mungeString(pNewVal->v.strVal, option_load_mode); break; case OPARG_TYPE_BOOLEAN: - addBoolValue( &(pRes->v.nestVal), pzName, nameLen, pzVal, valLen ); + add_bool(&(pRes->v.nestVal), pzName, nameLen, pzVal, valLen); break; case OPARG_TYPE_NUMERIC: - addNumberValue( &(pRes->v.nestVal), pzName, nameLen, pzVal, valLen ); + add_number(&(pRes->v.nestVal), pzName, nameLen, pzVal, valLen); break; case OPARG_TYPE_HIERARCHY: { - char* pz = AGALOC( valLen+1, "hierarchical scan" ); + char* pz = AGALOC(valLen+1, "hierarchical scan"); if (pz == NULL) break; - memcpy( pz, pzVal, valLen ); + memcpy(pz, pzVal, valLen); pz[valLen] = NUL; - addNestedValue( &(pRes->v.nestVal), pzName, nameLen, pz, valLen ); + add_nested(&(pRes->v.nestVal), pzName, nameLen, pz, valLen); AGFREE(pz); break; } @@ -532,15 +526,14 @@ scanXmlEntry( char const* pzName, tOptionValue* pRes ) } -/* unloadNestedArglist - * +/** * Deallocate a list of option arguments. This must have been gotten from * a hierarchical option argument, not a stacked list of strings. It is * an internal call, so it is not validated. The caller is responsible for * knowing what they are doing. */ -static void -unloadNestedArglist( tArgList* pAL ) +LOCAL void +unload_arg_list(tArgList* pAL) { int ct = pAL->useCt; tCC** ppNV = pAL->apzArgs; @@ -548,14 +541,13 @@ unloadNestedArglist( tArgList* pAL ) while (ct-- > 0) { tOptionValue* pNV = (tOptionValue*)(void*)*(ppNV++); if (pNV->valType == OPARG_TYPE_HIERARCHY) - unloadNestedArglist( pNV->v.nestVal ); - AGFREE( pNV ); + unload_arg_list(pNV->v.nestVal); + AGFREE(pNV); } - AGFREE( (void*)pAL ); + AGFREE((void*)pAL); } - /*=export_func optionUnloadNested * * what: Deallocate the memory for a nested value @@ -567,7 +559,7 @@ unloadNestedArglist( tArgList* pAL ) * @pxref{libopts-configFileLoad}). =*/ void -optionUnloadNested( tOptionValue const * pOV ) +optionUnloadNested(tOptionValue const * pOV) { if (pOV == NULL) return; if (pOV->valType != OPARG_TYPE_HIERARCHY) { @@ -575,20 +567,18 @@ optionUnloadNested( tOptionValue const * pOV ) return; } - unloadNestedArglist( pOV->v.nestVal ); + unload_arg_list(pOV->v.nestVal); - AGFREE( (void*)pOV ); + AGFREE((void*)pOV); } - -/* sortNestedList - * +/** * This is a _stable_ sort. The entries are sorted alphabetically, * but within entries of the same name the ordering is unchanged. * Typically, we also hope the input is sorted. */ static void -sortNestedList( tArgList* pAL ) +sort_list(tArgList* pAL) { int ix; int lm = pAL->useCt; @@ -606,7 +596,7 @@ sortNestedList( tArgList* pAL ) * move the old pointer. Stop before trying to extract the * "-1" entry. */ - while (strcmp( pOldNV->pzName, pNewNV->pzName ) > 0) { + while (strcmp(pOldNV->pzName, pNewNV->pzName) > 0) { pAL->apzArgs[iy+1] = (void*)pOldNV; pOldNV = (tOptionValue*)(void*)(pAL->apzArgs[--iy]); if (iy < 0) @@ -621,7 +611,6 @@ sortNestedList( tArgList* pAL ) } } - /* optionLoadNested * private: * @@ -642,7 +631,6 @@ LOCAL tOptionValue* optionLoadNested(char const* pzTxt, char const* pzName, size_t nameLen) { tOptionValue* pRes; - tArgList* pAL; /* * Make sure we have some data and we have space to put what we find. @@ -651,60 +639,65 @@ optionLoadNested(char const* pzTxt, char const* pzName, size_t nameLen) errno = EINVAL; return NULL; } - while (isspace( (int)*pzTxt )) pzTxt++; + while (IS_WHITESPACE_CHAR(*pzTxt)) pzTxt++; if (*pzTxt == NUL) { errno = ENOENT; return NULL; } - pRes = AGALOC( sizeof(*pRes) + nameLen + 1, "nested args" ); + pRes = AGALOC(sizeof(*pRes) + nameLen + 1, "nested args"); if (pRes == NULL) { errno = ENOMEM; return NULL; } pRes->valType = OPARG_TYPE_HIERARCHY; pRes->pzName = (char*)(pRes + 1); - memcpy( pRes->pzName, pzName, nameLen ); - pRes->pzName[ nameLen ] = NUL; + memcpy(pRes->pzName, pzName, nameLen); + pRes->pzName[nameLen] = NUL; - pAL = AGALOC( sizeof(*pAL), "nested arg list" ); - if (pAL == NULL) { - AGFREE( pRes ); - return NULL; + { + tArgList * pAL = AGALOC(sizeof(*pAL), "nested arg list"); + if (pAL == NULL) { + AGFREE(pRes); + return NULL; + } + + pRes->v.nestVal = pAL; + pAL->useCt = 0; + pAL->allocCt = MIN_ARG_ALLOC_CT; } - pRes->v.nestVal = pAL; - pAL->useCt = 0; - pAL->allocCt = MIN_ARG_ALLOC_CT; /* * Scan until we hit a NUL. */ do { - while (isspace( (int)*pzTxt )) pzTxt++; - if (isalpha( (int)*pzTxt )) { - pzTxt = scanNameEntry( pzTxt, pRes ); + while (IS_WHITESPACE_CHAR((int)*pzTxt)) pzTxt++; + if (IS_VAR_FIRST_CHAR((int)*pzTxt)) { + pzTxt = scan_name(pzTxt, pRes); } else switch (*pzTxt) { case NUL: goto scan_done; - case '<': pzTxt = scanXmlEntry( pzTxt, pRes ); + case '<': pzTxt = scan_xml(pzTxt, pRes); + if (pzTxt == NULL) goto woops; if (*pzTxt == ',') pzTxt++; break; - case '#': pzTxt = strchr( pzTxt, '\n' ); break; + case '#': pzTxt = strchr(pzTxt, '\n'); break; default: goto woops; } } while (pzTxt != NULL); scan_done:; - pAL = pRes->v.nestVal; - if (pAL->useCt != 0) { - sortNestedList( pAL ); - return pRes; + { + tArgList * al = pRes->v.nestVal; + if (al->useCt != 0) + sort_list(al); } + return pRes; + woops: - AGFREE( pRes->v.nestVal ); - AGFREE( pRes ); + AGFREE(pRes->v.nestVal); + AGFREE(pRes); return NULL; } - /*=export_func optionNestedVal * private: * @@ -716,14 +709,111 @@ optionLoadNested(char const* pzTxt, char const* pzName, size_t nameLen) * Nested value was found on the command line =*/ void -optionNestedVal( tOptions* pOpts, tOptDesc* pOD ) +optionNestedVal(tOptions* pOpts, tOptDesc* pOD) { - tOptionValue* pOV = optionLoadNested( - pOD->optArg.argString, pOD->pz_Name, strlen(pOD->pz_Name)); + if (pOpts < OPTPROC_EMIT_LIMIT) + return; - if (pOV != NULL) - addArgListEntry( &(pOD->optCookie), (void*)pOV ); + if (pOD->fOptState & OPTST_RESET) { + tArgList* pAL = pOD->optCookie; + int ct; + tCC ** av; + + if (pAL == NULL) + return; + ct = pAL->useCt; + av = pAL->apzArgs; + + while (--ct >= 0) { + void * p = (void *)*(av++); + optionUnloadNested((tOptionValue const *)p); + } + + AGFREE(pOD->optCookie); + + } else { + tOptionValue* pOV = optionLoadNested( + pOD->optArg.argString, pOD->pz_Name, strlen(pOD->pz_Name)); + + if (pOV != NULL) + addArgListEntry(&(pOD->optCookie), (void*)pOV); + } } + +/* + * get_special_char + */ +LOCAL int +get_special_char(char const ** ppz, int * ct) +{ + char const * pz = *ppz; + + if (*ct < 3) + return '&'; + + if (*pz == '#') { + int base = 10; + int retch; + + pz++; + if (*pz == 'x') { + base = 16; + pz++; + } + retch = (int)strtoul(pz, (char **)&pz, base); + if (*pz != ';') + return '&'; + base = ++pz - *ppz; + if (base > *ct) + return '&'; + + *ct -= base; + *ppz = pz; + return retch; + } + + { + int ctr = sizeof(xml_xlate) / sizeof(xml_xlate[0]); + xml_xlate_t const * xlatp = xml_xlate; + + for (;;) { + if ( (*ct >= xlatp->xml_len) + && (strncmp(pz, xlatp->xml_txt, xlatp->xml_len) == 0)) { + *ppz += xlatp->xml_len; + *ct -= xlatp->xml_len; + return xlatp->xml_ch; + } + + if (--ctr <= 0) + break; + xlatp++; + } + } + return '&'; +} + +/* + * emit_special_char + */ +LOCAL void +emit_special_char(FILE * fp, int ch) +{ + int ctr = sizeof(xml_xlate) / sizeof(xml_xlate[0]); + xml_xlate_t const * xlatp = xml_xlate; + + putc('&', fp); + for (;;) { + if (ch == xlatp->xml_ch) { + fputs(xlatp->xml_txt, fp); + return; + } + if (--ctr <= 0) + break; + xlatp++; + } + fprintf(fp, "#x%02X;", (ch & 0xFF)); +} + /* * Local Variables: * mode: C diff --git a/sntp/libopts/numeric.c b/sntp/libopts/numeric.c index 05ee9b5..ff6b2a5 100644 --- a/sntp/libopts/numeric.c +++ b/sntp/libopts/numeric.c @@ -1,56 +1,100 @@ -/* - * $Id: numeric.c,v 4.11 2007/02/04 17:44:12 bkorb Exp $ - * Time-stamp: "2007-01-13 10:28:20 bkorb" - */ - -/* - * Automated Options copyright 1992-2007 Bruce Korb - * - * Automated Options is free software. - * You may 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. +/** + * \file numeric.c * - * Automated Options 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. + * Time-stamp: "2011-03-25 16:26:10 bkorb" * - * You should have received a copy of the GNU General Public License - * along with Automated Options. See the file "COPYING". If not, - * write to: The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * This file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved * - * As a special exception, Bruce Korb gives permission for additional - * uses of the text contained in his release of AutoOpts. + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. * - * The exception is that, if you link the AutoOpts library with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the AutoOpts library code into it. + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" * - * This exception applies only to the code released by Bruce Korb under - * the name AutoOpts. If you copy code from other sources under the - * General Public License into a copy of AutoOpts, as the General Public - * License permits, the exception does not apply to the code that you add - * in this way. To avoid misleading anyone as to the status of such - * modified files, you must delete this exception notice from them. + * These files have the following md5sums: * - * If you write modifications of your own for AutoOpts, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd */ +/*=export_func optionShowRange + * private: + * + * what: + * arg: + tOptions* + pOpts + program options descriptor + + * arg: + tOptDesc* + pOptDesc + the descriptor for this arg + + * arg: + void * + rng_table + the value range tables + + * arg: + int + rng_count + the number of entries + + * + * doc: + * Show information about a numeric option with range constraints. +=*/ +void +optionShowRange(tOptions* pOpts, tOptDesc* pOD, void * rng_table, int rng_ct) +{ + static char const bullet[] = "\t\t\t\t- "; + static char const deepin[] = "\t\t\t\t "; + static char const onetab[] = "\t"; + + const struct {long const rmin, rmax;} * rng = rng_table; + + char const * pz_indent = bullet; + + /* + * The range is shown only for full usage requests and an error + * in this particular option. + */ + if (pOpts != OPTPROC_EMIT_USAGE) { + if (pOpts <= OPTPROC_EMIT_LIMIT) + return; + pz_indent = onetab; + + fprintf(option_usage_fp, zRangeErr, pOpts->pzProgName, + pOD->pz_Name, pOD->optArg.argString); + pz_indent = ""; + } + + if (pOD->fOptState & OPTST_SCALED_NUM) + fprintf(option_usage_fp, zRangeScaled, pz_indent); + + fprintf(option_usage_fp, (rng_ct > 1) ? zRangeLie : zRangeOnly, pz_indent); + pz_indent = (pOpts != OPTPROC_EMIT_USAGE) ? onetab : deepin; + + for (;;) { + if (rng->rmax == LONG_MIN) + fprintf(option_usage_fp, zRangeExact, pz_indent, rng->rmin); + else if (rng->rmin == LONG_MIN) + fprintf(option_usage_fp, zRangeUpto, pz_indent, rng->rmax); + else if (rng->rmax == LONG_MAX) + fprintf(option_usage_fp, zRangeAbove, pz_indent, rng->rmin); + else + fprintf(option_usage_fp, zRange, pz_indent, rng->rmin, + rng->rmax); + + if (--rng_ct <= 0) { + fputc('\n', option_usage_fp); + break; + } + fputs(zRangeOr, option_usage_fp); + rng++; + } + + if (pOpts > OPTPROC_EMIT_LIMIT) + pOpts->pUsageProc(pOpts, EXIT_FAILURE); +} + /*=export_func optionNumericVal * private: * - * what: Decipher a boolean value + * what: process an option with a numeric value. * arg: + tOptions* + pOpts + program options descriptor + * arg: + tOptDesc* + pOptDesc + the descriptor for this arg + * @@ -58,7 +102,7 @@ * Decipher a numeric value. =*/ void -optionNumericVal( tOptions* pOpts, tOptDesc* pOD ) +optionNumericVal(tOptions* pOpts, tOptDesc* pOD ) { char* pz; long val; @@ -66,16 +110,37 @@ optionNumericVal( tOptions* pOpts, tOptDesc* pOD ) /* * Numeric options may have a range associated with it. * If it does, the usage procedure requests that it be - * emitted by passing a NULL pOD pointer. + * emitted by passing a NULL pOD pointer. Also bail out + * if there is no option argument or if we are being reset. */ - if ((pOD == NULL) || (pOD->optArg.argString == NULL)) + if ( (pOD == NULL) + || (pOD->optArg.argString == NULL) + || ((pOD->fOptState & OPTST_RESET) != 0)) return; - val = strtol( pOD->optArg.argString, &pz, 0 ); - if (*pz != NUL) { - fprintf( stderr, zNotNumber, pOpts->pzProgName, pOD->optArg.argString ); - (*(pOpts->pUsageProc))(pOpts, EXIT_FAILURE); - } + errno = 0; + val = strtol(pOD->optArg.argString, &pz, 0); + if ((pz == pOD->optArg.argString) || (errno != 0)) + goto bad_number; + + if ((pOD->fOptState & OPTST_SCALED_NUM) != 0) + switch (*(pz++)) { + case '\0': pz--; break; + case 't': val *= 1000; + case 'g': val *= 1000; + case 'm': val *= 1000; + case 'k': val *= 1000; break; + + case 'T': val *= 1024; + case 'G': val *= 1024; + case 'M': val *= 1024; + case 'K': val *= 1024; break; + + default: goto bad_number; + } + + if (*pz != NUL) + goto bad_number; if (pOD->fOptState & OPTST_ALLOC_ARG) { AGFREE(pOD->optArg.argString); @@ -83,7 +148,18 @@ optionNumericVal( tOptions* pOpts, tOptDesc* pOD ) } pOD->optArg.argInt = val; + return; + + bad_number: + + fprintf( stderr, zNotNumber, pOpts->pzProgName, pOD->optArg.argString ); + if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0) + (*(pOpts->pUsageProc))(pOpts, EXIT_FAILURE); + + errno = EINVAL; + pOD->optArg.argInt = ~0; } + /* * Local Variables: * mode: C diff --git a/sntp/libopts/parse-duration.c b/sntp/libopts/parse-duration.c new file mode 100644 index 0000000..0a8c4ad --- /dev/null +++ b/sntp/libopts/parse-duration.c @@ -0,0 +1,601 @@ +/* Parse a time duration and return a seconds count + Copyright (C) 2008-2011 Free Software Foundation, Inc. + Written by Bruce Korb <bkorb@gnu.org>, 2008. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "parse-duration.h" + +#include <ctype.h> +#include <errno.h> +#include <limits.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifndef NUL +#define NUL '\0' +#endif + +#define cch_t char const + +typedef enum { + NOTHING_IS_DONE, + YEAR_IS_DONE, + MONTH_IS_DONE, + WEEK_IS_DONE, + DAY_IS_DONE, + HOUR_IS_DONE, + MINUTE_IS_DONE, + SECOND_IS_DONE +} whats_done_t; + +#define SEC_PER_MIN 60 +#define SEC_PER_HR (SEC_PER_MIN * 60) +#define SEC_PER_DAY (SEC_PER_HR * 24) +#define SEC_PER_WEEK (SEC_PER_DAY * 7) +#define SEC_PER_MONTH (SEC_PER_DAY * 30) +#define SEC_PER_YEAR (SEC_PER_DAY * 365) + +#define TIME_MAX 0x7FFFFFFF + +/* Wrapper around strtoul that does not require a cast. */ +static unsigned long inline +str_const_to_ul (cch_t * str, cch_t ** ppz, int base) +{ + return strtoul (str, (char **)ppz, base); +} + +/* Wrapper around strtol that does not require a cast. */ +static long inline +str_const_to_l (cch_t * str, cch_t ** ppz, int base) +{ + return strtol (str, (char **)ppz, base); +} + +/* Returns BASE + VAL * SCALE, interpreting BASE = BAD_TIME + with errno set as an error situation, and returning BAD_TIME + with errno set in an error situation. */ +static time_t inline +scale_n_add (time_t base, time_t val, int scale) +{ + if (base == BAD_TIME) + { + if (errno == 0) + errno = EINVAL; + return BAD_TIME; + } + + if (val > TIME_MAX / scale) + { + errno = ERANGE; + return BAD_TIME; + } + + val *= scale; + if (base > TIME_MAX - val) + { + errno = ERANGE; + return BAD_TIME; + } + + return base + val; +} + +/* After a number HH has been parsed, parse subsequent :MM or :MM:SS. */ +static time_t +parse_hr_min_sec (time_t start, cch_t * pz) +{ + int lpct = 0; + + errno = 0; + + /* For as long as our scanner pointer points to a colon *AND* + we've not looped before, then keep looping. (two iterations max) */ + while ((*pz == ':') && (lpct++ <= 1)) + { + unsigned long v = str_const_to_ul (pz+1, &pz, 10); + + if (errno != 0) + return BAD_TIME; + + start = scale_n_add (v, start, 60); + + if (errno != 0) + return BAD_TIME; + } + + /* allow for trailing spaces */ + while (isspace ((unsigned char)*pz)) + pz++; + if (*pz != NUL) + { + errno = EINVAL; + return BAD_TIME; + } + + return start; +} + +/* Parses a value and returns BASE + value * SCALE, interpreting + BASE = BAD_TIME with errno set as an error situation, and returning + BAD_TIME with errno set in an error situation. */ +static time_t +parse_scaled_value (time_t base, cch_t ** ppz, cch_t * endp, int scale) +{ + cch_t * pz = *ppz; + time_t val; + + if (base == BAD_TIME) + return base; + + errno = 0; + val = str_const_to_ul (pz, &pz, 10); + if (errno != 0) + return BAD_TIME; + while (isspace ((unsigned char)*pz)) + pz++; + if (pz != endp) + { + errno = EINVAL; + return BAD_TIME; + } + + *ppz = pz; + return scale_n_add (base, val, scale); +} + +/* Parses the syntax YEAR-MONTH-DAY. + PS points into the string, after "YEAR", before "-MONTH-DAY". */ +static time_t +parse_year_month_day (cch_t * pz, cch_t * ps) +{ + time_t res = 0; + + res = parse_scaled_value (0, &pz, ps, SEC_PER_YEAR); + + pz++; /* over the first '-' */ + ps = strchr (pz, '-'); + if (ps == NULL) + { + errno = EINVAL; + return BAD_TIME; + } + res = parse_scaled_value (res, &pz, ps, SEC_PER_MONTH); + + pz++; /* over the second '-' */ + ps = pz + strlen (pz); + return parse_scaled_value (res, &pz, ps, SEC_PER_DAY); +} + +/* Parses the syntax YYYYMMDD. */ +static time_t +parse_yearmonthday (cch_t * in_pz) +{ + time_t res = 0; + char buf[8]; + cch_t * pz; + + if (strlen (in_pz) != 8) + { + errno = EINVAL; + return BAD_TIME; + } + + memcpy (buf, in_pz, 4); + buf[4] = NUL; + pz = buf; + res = parse_scaled_value (0, &pz, buf + 4, SEC_PER_YEAR); + + memcpy (buf, in_pz + 4, 2); + buf[2] = NUL; + pz = buf; + res = parse_scaled_value (res, &pz, buf + 2, SEC_PER_MONTH); + + memcpy (buf, in_pz + 6, 2); + buf[2] = NUL; + pz = buf; + return parse_scaled_value (res, &pz, buf + 2, SEC_PER_DAY); +} + +/* Parses the syntax yy Y mm M ww W dd D. */ +static time_t +parse_YMWD (cch_t * pz) +{ + time_t res = 0; + cch_t * ps = strchr (pz, 'Y'); + if (ps != NULL) + { + res = parse_scaled_value (0, &pz, ps, SEC_PER_YEAR); + pz++; + } + + ps = strchr (pz, 'M'); + if (ps != NULL) + { + res = parse_scaled_value (res, &pz, ps, SEC_PER_MONTH); + pz++; + } + + ps = strchr (pz, 'W'); + if (ps != NULL) + { + res = parse_scaled_value (res, &pz, ps, SEC_PER_WEEK); + pz++; + } + + ps = strchr (pz, 'D'); + if (ps != NULL) + { + res = parse_scaled_value (res, &pz, ps, SEC_PER_DAY); + pz++; + } + + while (isspace ((unsigned char)*pz)) + pz++; + if (*pz != NUL) + { + errno = EINVAL; + return BAD_TIME; + } + + return res; +} + +/* Parses the syntax HH:MM:SS. + PS points into the string, after "HH", before ":MM:SS". */ +static time_t +parse_hour_minute_second (cch_t * pz, cch_t * ps) +{ + time_t res = 0; + + res = parse_scaled_value (0, &pz, ps, SEC_PER_HR); + + pz++; + ps = strchr (pz, ':'); + if (ps == NULL) + { + errno = EINVAL; + return BAD_TIME; + } + + res = parse_scaled_value (res, &pz, ps, SEC_PER_MIN); + + pz++; + ps = pz + strlen (pz); + return parse_scaled_value (res, &pz, ps, 1); +} + +/* Parses the syntax HHMMSS. */ +static time_t +parse_hourminutesecond (cch_t * in_pz) +{ + time_t res = 0; + char buf[4]; + cch_t * pz; + + if (strlen (in_pz) != 6) + { + errno = EINVAL; + return BAD_TIME; + } + + memcpy (buf, in_pz, 2); + buf[2] = NUL; + pz = buf; + res = parse_scaled_value (0, &pz, buf + 2, SEC_PER_HR); + + memcpy (buf, in_pz + 2, 2); + buf[2] = NUL; + pz = buf; + res = parse_scaled_value (res, &pz, buf + 2, SEC_PER_MIN); + + memcpy (buf, in_pz + 4, 2); + buf[2] = NUL; + pz = buf; + return parse_scaled_value (res, &pz, buf + 2, 1); +} + +/* Parses the syntax hh H mm M ss S. */ +static time_t +parse_HMS (cch_t * pz) +{ + time_t res = 0; + cch_t * ps = strchr (pz, 'H'); + if (ps != NULL) + { + res = parse_scaled_value (0, &pz, ps, SEC_PER_HR); + pz++; + } + + ps = strchr (pz, 'M'); + if (ps != NULL) + { + res = parse_scaled_value (res, &pz, ps, SEC_PER_MIN); + pz++; + } + + ps = strchr (pz, 'S'); + if (ps != NULL) + { + res = parse_scaled_value (res, &pz, ps, 1); + pz++; + } + + while (isspace ((unsigned char)*pz)) + pz++; + if (*pz != NUL) + { + errno = EINVAL; + return BAD_TIME; + } + + return res; +} + +/* Parses a time (hours, minutes, seconds) specification in either syntax. */ +static time_t +parse_time (cch_t * pz) +{ + cch_t * ps; + time_t res = 0; + + /* + * Scan for a hyphen + */ + ps = strchr (pz, ':'); + if (ps != NULL) + { + res = parse_hour_minute_second (pz, ps); + } + + /* + * Try for a 'H', 'M' or 'S' suffix + */ + else if (ps = strpbrk (pz, "HMS"), + ps == NULL) + { + /* Its a YYYYMMDD format: */ + res = parse_hourminutesecond (pz); + } + + else + res = parse_HMS (pz); + + return res; +} + +/* Returns a substring of the given string, with spaces at the beginning and at + the end destructively removed, per SNOBOL. */ +static char * +trim (char * pz) +{ + /* trim leading white space */ + while (isspace ((unsigned char)*pz)) + pz++; + + /* trim trailing white space */ + { + char * pe = pz + strlen (pz); + while ((pe > pz) && isspace ((unsigned char)pe[-1])) + pe--; + *pe = NUL; + } + + return pz; +} + +/* + * Parse the year/months/days of a time period + */ +static time_t +parse_period (cch_t * in_pz) +{ + char * pT; + char * ps; + char * pz = strdup (in_pz); + void * fptr = pz; + time_t res = 0; + + if (pz == NULL) + { + errno = ENOMEM; + return BAD_TIME; + } + + pT = strchr (pz, 'T'); + if (pT != NULL) + { + *(pT++) = NUL; + pz = trim (pz); + pT = trim (pT); + } + + /* + * Scan for a hyphen + */ + ps = strchr (pz, '-'); + if (ps != NULL) + { + res = parse_year_month_day (pz, ps); + } + + /* + * Try for a 'Y', 'M' or 'D' suffix + */ + else if (ps = strpbrk (pz, "YMWD"), + ps == NULL) + { + /* Its a YYYYMMDD format: */ + res = parse_yearmonthday (pz); + } + + else + res = parse_YMWD (pz); + + if ((errno == 0) && (pT != NULL)) + { + time_t val = parse_time (pT); + res = scale_n_add (res, val, 1); + } + + free (fptr); + return res; +} + +static time_t +parse_non_iso8601 (cch_t * pz) +{ + whats_done_t whatd_we_do = NOTHING_IS_DONE; + + time_t res = 0; + + do { + time_t val; + + errno = 0; + val = str_const_to_l (pz, &pz, 10); + if (errno != 0) + goto bad_time; + + /* IF we find a colon, then we're going to have a seconds value. + We will not loop here any more. We cannot already have parsed + a minute value and if we've parsed an hour value, then the result + value has to be less than an hour. */ + if (*pz == ':') + { + if (whatd_we_do >= MINUTE_IS_DONE) + break; + + val = parse_hr_min_sec (val, pz); + + if ((whatd_we_do == HOUR_IS_DONE) && (val >= SEC_PER_HR)) + break; + + return scale_n_add (res, val, 1); + } + + { + unsigned int mult; + + /* Skip over white space following the number we just parsed. */ + while (isspace ((unsigned char)*pz)) + pz++; + + switch (*pz) + { + default: goto bad_time; + case NUL: + return scale_n_add (res, val, 1); + + case 'y': case 'Y': + if (whatd_we_do >= YEAR_IS_DONE) + goto bad_time; + mult = SEC_PER_YEAR; + whatd_we_do = YEAR_IS_DONE; + break; + + case 'M': + if (whatd_we_do >= MONTH_IS_DONE) + goto bad_time; + mult = SEC_PER_MONTH; + whatd_we_do = MONTH_IS_DONE; + break; + + case 'W': + if (whatd_we_do >= WEEK_IS_DONE) + goto bad_time; + mult = SEC_PER_WEEK; + whatd_we_do = WEEK_IS_DONE; + break; + + case 'd': case 'D': + if (whatd_we_do >= DAY_IS_DONE) + goto bad_time; + mult = SEC_PER_DAY; + whatd_we_do = DAY_IS_DONE; + break; + + case 'h': + if (whatd_we_do >= HOUR_IS_DONE) + goto bad_time; + mult = SEC_PER_HR; + whatd_we_do = HOUR_IS_DONE; + break; + + case 'm': + if (whatd_we_do >= MINUTE_IS_DONE) + goto bad_time; + mult = SEC_PER_MIN; + whatd_we_do = MINUTE_IS_DONE; + break; + + case 's': + mult = 1; + whatd_we_do = SECOND_IS_DONE; + break; + } + + res = scale_n_add (res, val, mult); + + pz++; + while (isspace ((unsigned char)*pz)) + pz++; + if (*pz == NUL) + return res; + + if (! isdigit ((unsigned char)*pz)) + break; + } + + } while (whatd_we_do < SECOND_IS_DONE); + + bad_time: + errno = EINVAL; + return BAD_TIME; +} + +time_t +parse_duration (char const * pz) +{ + while (isspace ((unsigned char)*pz)) + pz++; + + switch (*pz) + { + case 'P': + return parse_period (pz + 1); + + case 'T': + return parse_time (pz + 1); + + default: + if (isdigit ((unsigned char)*pz)) + return parse_non_iso8601 (pz); + + errno = EINVAL; + return BAD_TIME; + } +} + +/* + * Local Variables: + * mode: C + * c-file-style: "gnu" + * indent-tabs-mode: nil + * End: + * end of parse-duration.c */ diff --git a/sntp/libopts/parse-duration.h b/sntp/libopts/parse-duration.h new file mode 100644 index 0000000..9fd2a36 --- /dev/null +++ b/sntp/libopts/parse-duration.h @@ -0,0 +1,90 @@ +/* Parse a time duration and return a seconds count + Copyright (C) 2008-2011 Free Software Foundation, Inc. + Written by Bruce Korb <bkorb@gnu.org>, 2008. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* + + Readers and users of this function are referred to the ISO-8601 + specification, with particular attention to "Durations". + + At the time of writing, this worked: + + http://en.wikipedia.org/wiki/ISO_8601#Durations + + The string must start with a 'P', 'T' or a digit. + + ==== if it is a digit + + the string may contain: NNN Y NNN M NNN W NNN d NNN h NNN m NNN s + This represents NNN years, NNN months, NNN weeks, NNN days, NNN hours, + NNN minutes and NNN seconds. + The embeded white space is optional. + These terms must appear in this order. + Case is significant: 'M' is months and 'm' is minutes. + The final "s" is optional. + All of the terms ("NNN" plus designator) are optional. + Minutes and seconds may optionally be represented as NNN:NNN. + Also, hours, minute and seconds may be represented as NNN:NNN:NNN. + There is no limitation on the value of any of the terms, except + that the final result must fit in a time_t value. + + ==== if it is a 'P' or 'T', please see ISO-8601 for a rigorous definition. + + The 'P' term may be followed by any of three formats: + yyyymmdd + yy-mm-dd + yy Y mm M ww W dd D + + or it may be empty and followed by a 'T'. The "yyyymmdd" must be eight + digits long. + + NOTE! Months are always 30 days and years are always 365 days long. + 5 years is always 1825 days, not 1826 or 1827 depending on leap year + considerations. 3 months is always 90 days. There is no consideration + for how many days are in the current, next or previous months. + + For the final format: + * Embedded white space is allowed, but it is optional. + * All of the terms are optional. Any or all-but-one may be omitted. + * The meanings are yy years, mm months, ww weeks and dd days. + * The terms must appear in this order. + + ==== The 'T' term may be followed by any of these formats: + + hhmmss + hh:mm:ss + hh H mm M ss S + + For the final format: + * Embedded white space is allowed, but it is optional. + * All of the terms are optional. Any or all-but-one may be omitted. + * The terms must appear in this order. + + */ +#ifndef GNULIB_PARSE_DURATION_H +#define GNULIB_PARSE_DURATION_H + +#include <time.h> + +/* Return value when a valid duration cannot be parsed. */ +#define BAD_TIME ((time_t)~0) + +/* Parses the given string. If it has the syntax of a valid duration, + this duration is returned. Otherwise, the return value is BAD_TIME, + and errno is set to either EINVAL (bad syntax) or ERANGE (out of range). */ +extern time_t parse_duration (char const * in_pz); + +#endif /* GNULIB_PARSE_DURATION_H */ diff --git a/sntp/libopts/pgusage.c b/sntp/libopts/pgusage.c index c417c63..2e21948 100644 --- a/sntp/libopts/pgusage.c +++ b/sntp/libopts/pgusage.c @@ -1,59 +1,35 @@ -/* - * $Id: pgusage.c,v 4.12 2007/04/28 22:19:23 bkorb Exp $ - * Time-stamp: "2006-07-16 08:13:26 bkorb" +/** + * \file pgusage.c + * + * Time-stamp: "2011-03-25 17:54:41 bkorb" * * Automated Options Paged Usage module. * * This routine will run run-on options through a pager so the * user may examine, print or edit them at their leisure. - */ - -/* - * Automated Options copyright 1992-2007 Bruce Korb * - * Automated Options is free software. - * You may 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 file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved * - * Automated Options 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. + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. * - * You should have received a copy of the GNU General Public License - * along with Automated Options. See the file "COPYING". If not, - * write to: The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" * - * As a special exception, Bruce Korb gives permission for additional - * uses of the text contained in his release of AutoOpts. + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" * - * The exception is that, if you link the AutoOpts library with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the AutoOpts library code into it. + * These files have the following md5sums: * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. - * - * This exception applies only to the code released by Bruce Korb under - * the name AutoOpts. If you copy code from other sources under the - * General Public License into a copy of AutoOpts, as the General Public - * License permits, the exception does not apply to the code that you add - * in this way. To avoid misleading anyone as to the status of such - * modified files, you must delete this exception notice from them. - * - * If you write modifications of your own for AutoOpts, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd */ -tePagerState pagerState = PAGER_STATE_INITIAL; - /*=export_func optionPagedUsage * private: * @@ -64,12 +40,16 @@ tePagerState pagerState = PAGER_STATE_INITIAL; * doc: * Run the usage output through a pager. * This is very handy if it is very long. + * This is disabled on platforms without a working fork() function. =*/ void -optionPagedUsage( tOptions* pOptions, tOptDesc* pOD ) +optionPagedUsage(tOptions* pOptions, tOptDesc* pOD) { -#if defined(__windows__) && !defined(__CYGWIN__) - (*pOptions->pUsageProc)( pOptions, EXIT_SUCCESS ); +#if ! defined(HAVE_WORKING_FORK) + if ((pOD->fOptState & OPTST_RESET) != 0) + return; + + (*pOptions->pUsageProc)(pOptions, EXIT_SUCCESS); #else static pid_t my_pid; char zPageUsage[ 1024 ]; @@ -82,42 +62,45 @@ optionPagedUsage( tOptions* pOptions, tOptDesc* pOD ) switch (pagerState) { case PAGER_STATE_INITIAL: { + if ((pOD->fOptState & OPTST_RESET) != 0) + return; + my_pid = getpid(); #ifdef HAVE_SNPRINTF snprintf(zPageUsage, sizeof(zPageUsage), "/tmp/use.%lu", (tAoUL)my_pid); #else - sprintf( zPageUsage, "/tmp/use.%lu", (tAoUL)my_pid ); + sprintf(zPageUsage, "/tmp/use.%lu", (tAoUL)my_pid); #endif - unlink( zPageUsage ); + unlink(zPageUsage); /* * Set usage output to this temporary file */ - option_usage_fp = fopen( zPageUsage, "w" FOPEN_BINARY_FLAG ); + option_usage_fp = fopen(zPageUsage, "w" FOPEN_BINARY_FLAG); if (option_usage_fp == NULL) - _exit( EXIT_FAILURE ); + _exit(EXIT_FAILURE); pagerState = PAGER_STATE_READY; /* * Set up so this routine gets called during the exit logic */ - atexit( (void(*)(void))optionPagedUsage ); + atexit((void(*)(void))optionPagedUsage); /* * The usage procedure will now put the usage information into * the temporary file we created above. */ - (*pOptions->pUsageProc)( pOptions, EXIT_SUCCESS ); + (*pOptions->pUsageProc)(pOptions, EXIT_SUCCESS); - /*NOTREACHED*/ - _exit( EXIT_FAILURE ); + /* NOTREACHED */ + _exit(EXIT_FAILURE); } case PAGER_STATE_READY: { tSCC zPage[] = "%1$s /tmp/use.%2$lu ; rm -f /tmp/use.%2$lu"; - tCC* pzPager = (tCC*)getenv( "PAGER" ); + tCC* pzPager = (tCC*)getenv("PAGER"); /* * Use the "more(1)" program if "PAGER" has not been defined @@ -131,12 +114,12 @@ optionPagedUsage( tOptions* pOptions, tOptDesc* pOD ) #ifdef HAVE_SNPRINTF snprintf(zPageUsage, sizeof(zPageUsage), zPage, pzPager, (tAoUL)my_pid); #else - sprintf( zPageUsage, zPage, pzPager, (tAoUL)my_pid ); + sprintf(zPageUsage, zPage, pzPager, (tAoUL)my_pid); #endif - fclose( stderr ); - dup2( STDOUT_FILENO, STDERR_FILENO ); + fclose(stderr); + dup2(STDOUT_FILENO, STDERR_FILENO); - (void)system( zPageUsage ); + (void)system(zPageUsage); } case PAGER_STATE_CHILD: diff --git a/sntp/libopts/proto.h b/sntp/libopts/proto.h index e87ab87..13843c8 100644 --- a/sntp/libopts/proto.h +++ b/sntp/libopts/proto.h @@ -1,47 +1,49 @@ /* -*- buffer-read-only: t -*- vi: set ro: * * Prototypes for autoopts - * Generated Sat May 5 12:02:36 PDT 2007 + * Generated Fri Apr 29 15:44:06 PDT 2011 */ #ifndef AUTOOPTS_PROTO_H_GUARD #define AUTOOPTS_PROTO_H_GUARD 1 + #ifndef LOCAL # define LOCAL extern # define REDEF_LOCAL 1 #else # undef REDEF_LOCAL #endif -/*\n * Extracted from autoopts.c\n */ +/* + * Extracted from autoopts.c + */ LOCAL void * -ao_malloc( size_t sz ); +ao_malloc(size_t sz); LOCAL void * -ao_realloc( void *p, size_t sz ); - -LOCAL void -ao_free( void *p ); +ao_realloc(void *p, size_t sz); LOCAL char * -ao_strdup( char const *str ); +ao_strdup(char const *str); LOCAL tSuccess -handleOption( tOptions* pOpts, tOptState* pOptState ); +handle_opt(tOptions* pOpts, tOptState* pOptState); LOCAL tSuccess -longOptionFind( tOptions* pOpts, char* pzOptName, tOptState* pOptState ); +longOptionFind(tOptions* pOpts, char* pzOptName, tOptState* pOptState); LOCAL tSuccess -shortOptionFind( tOptions* pOpts, uint_t optValue, tOptState* pOptState ); +shortOptionFind(tOptions* pOpts, uint_t optValue, tOptState* pOptState); LOCAL tSuccess -doImmediateOpts( tOptions* pOpts ); +doImmediateOpts(tOptions* pOpts); LOCAL tSuccess -doRegularOpts( tOptions* pOpts ); +doRegularOpts(tOptions* pOpts); -/*\n * Extracted from configfile.c\n */ +/* + * Extracted from configfile.c + */ LOCAL void -internalFileLoad( tOptions* pOpts ); +internalFileLoad(tOptions* pOpts); LOCAL char* parseAttributes( @@ -51,18 +53,22 @@ parseAttributes( tOptionValue* pType ); LOCAL tSuccess -validateOptionsStruct( tOptions* pOpts, char const* pzProgram ); +validateOptionsStruct(tOptions* pOpts, char const* pzProgram); -/*\n * Extracted from environment.c\n */ +/* + * Extracted from environment.c + */ LOCAL void -doPrognameEnv( tOptions* pOpts, teEnvPresetType type ); +doPrognameEnv(tOptions* pOpts, teEnvPresetType type); LOCAL void -doEnvPresets( tOptions* pOpts, teEnvPresetType type ); +doEnvPresets(tOptions* pOpts, teEnvPresetType type); -/*\n * Extracted from load.c\n */ +/* + * Extracted from load.c + */ LOCAL void -mungeString( char* pzTxt, tOptionLoadMode mode ); +mungeString(char* pzTxt, tOptionLoadMode mode); LOCAL void loadOptionLine( @@ -72,17 +78,32 @@ loadOptionLine( tDirection direction, tOptionLoadMode load_mode ); -/*\n * Extracted from nested.c\n */ +/* + * Extracted from nested.c + */ +LOCAL void +unload_arg_list(tArgList* pAL); + LOCAL tOptionValue* optionLoadNested(char const* pzTxt, char const* pzName, size_t nameLen); -/*\n * Extracted from sort.c\n */ +LOCAL int +get_special_char(char const ** ppz, int * ct); + LOCAL void -optionSort( tOptions* pOpts ); +emit_special_char(FILE * fp, int ch); -/*\n * Extracted from stack.c\n */ +/* + * Extracted from sort.c + */ +LOCAL void +optionSort(tOptions* pOpts); + +/* + * Extracted from stack.c + */ LOCAL void -addArgListEntry( void** ppAL, void* entry ); +addArgListEntry(void** ppAL, void* entry); #ifdef REDEF_LOCAL # undef LOCAL diff --git a/sntp/libopts/putshell.c b/sntp/libopts/putshell.c index 93d9ef5..f15284f 100644 --- a/sntp/libopts/putshell.c +++ b/sntp/libopts/putshell.c @@ -1,60 +1,52 @@ -/* - * $Id: putshell.c,v 4.18 2007/02/04 17:44:12 bkorb Exp $ - * Time-stamp: "2007-01-13 10:29:39 bkorb" +/** + * \file putshell.c + * + * Time-stamp: "2010-09-05 06:10:56 bkorb" * * This module will interpret the options set in the tOptions * structure and print them to standard out in a fashion that * will allow them to be interpreted by the Bourne or Korn shells. - */ - -/* - * Automated Options copyright 1992-2007 Bruce Korb * - * Automated Options is free software. - * You may 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 file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved * - * Automated Options 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. + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. * - * You should have received a copy of the GNU General Public License - * along with Automated Options. See the file "COPYING". If not, - * write to: The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" * - * As a special exception, Bruce Korb gives permission for additional - * uses of the text contained in his release of AutoOpts. + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" * - * The exception is that, if you link the AutoOpts library with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the AutoOpts library code into it. + * These files have the following md5sums: * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. - * - * This exception applies only to the code released by Bruce Korb under - * the name AutoOpts. If you copy code from other sources under the - * General Public License into a copy of AutoOpts, as the General Public - * License permits, the exception does not apply to the code that you add - * in this way. To avoid misleading anyone as to the status of such - * modified files, you must delete this exception notice from them. - * - * If you write modifications of your own for AutoOpts, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd */ +static char const zOptValFmt[] = "%s_%s="; +static char const zOptEnd[] = "\nexport %s_%s\n"; +static char const zOptNumFmt[] = "%1$s_%2$s=%3$d # 0x%3$X\nexport %1$s_%2$s\n"; /* = = = START-STATIC-FORWARD = = = */ -/* static forward declarations maintained by :mkfwd */ static void -putQuotedStr( tCC* pzStr ); +print_quot_str(tCC* pzStr); + +static void +print_enumeration(tOptions * pOpts, tOptDesc * pOD); + +static void +print_membership(tOptions * pOpts, tOptDesc * pOD); + +static void +print_stacked_arg(tOptions * pOpts, tOptDesc * pOD); + +static void +print_reordering(tOptions * pOpts); /* = = = END-STATIC-FORWARD = = = */ /* @@ -62,13 +54,13 @@ putQuotedStr( tCC* pzStr ); * been emitted and the closing quote will be upon return. */ static void -putQuotedStr( tCC* pzStr ) +print_quot_str(tCC* pzStr) { /* * Handle empty strings to make the rest of the logic simpler. */ if ((pzStr == NULL) || (*pzStr == NUL)) { - fputs( "''", stdout ); + fputs("''", stdout); return; } @@ -77,7 +69,7 @@ putQuotedStr( tCC* pzStr ) * bail if that is all we need to do. */ while (*pzStr == '\'') { - fputs( "\\'", stdout ); + fputs("\\'", stdout); pzStr++; } if (*pzStr == NUL) @@ -86,38 +78,144 @@ putQuotedStr( tCC* pzStr ) /* * Start the single quote string */ - fputc( '\'', stdout ); + fputc('\'', stdout); for (;;) { - tCC* pz = strchr( pzStr, '\'' ); + tCC* pz = strchr(pzStr, '\''); if (pz == NULL) break; /* * Emit the string up to the single quote (apostrophe) we just found. */ - (void)fwrite( pzStr, (size_t)(pz - pzStr), (size_t)1, stdout ); - fputc( '\'', stdout ); + (void)fwrite(pzStr, (size_t)(pz - pzStr), (size_t)1, stdout); + fputc('\'', stdout); pzStr = pz; /* * Emit an escaped apostrophe for every one we find. * If that ends the string, do not re-open the single quotes. */ - while (*++pzStr == '\'') fputs( "\\'", stdout ); + while (*++pzStr == '\'') fputs("\\'", stdout); if (*pzStr == NUL) return; - fputc( '\'', stdout ); + fputc('\'', stdout); } /* * If we broke out of the loop, we must still emit the remaining text * and then close the single quote string. */ - fputs( pzStr, stdout ); - fputc( '\'', stdout ); + fputs(pzStr, stdout); + fputc('\'', stdout); } +static void +print_enumeration(tOptions * pOpts, tOptDesc * pOD) +{ + uintptr_t e_val = pOD->optArg.argEnum; + printf(zOptValFmt, pOpts->pzPROGNAME, pOD->pz_NAME); + + /* + * Convert value to string, print that and restore numeric value. + */ + (*(pOD->pOptProc))(OPTPROC_RETURN_VALNAME, pOD); + printf("'%s'", pOD->optArg.argString); + if (pOD->fOptState & OPTST_ALLOC_ARG) + AGFREE(pOD->optArg.argString); + pOD->optArg.argEnum = e_val; + + printf(zOptEnd, pOpts->pzPROGNAME, pOD->pz_NAME); +} + +static void +print_membership(tOptions * pOpts, tOptDesc * pOD) +{ + char const * pz; + uintptr_t val = 1; + printf(zOptNumFmt, pOpts->pzPROGNAME, pOD->pz_NAME, + (int)(uintptr_t)(pOD->optCookie)); + pOD->optCookie = (void*)(uintptr_t)~0UL; + (*(pOD->pOptProc))(OPTPROC_RETURN_VALNAME, pOD); + + /* + * We are building the typeset list. The list returned starts with + * 'none + ' for use by option saving stuff. We must ignore that. + */ + pz = pOD->optArg.argString + 7; + while (*pz != NUL) { + printf("typeset -x -i %s_", pOD->pz_NAME); + while (IS_PLUS_N_SPACE_CHAR(*pz)) pz++; + + for (;;) { + int ch = *(pz++); + if (IS_LOWER_CASE_CHAR(ch)) fputc(toupper(ch), stdout); + else if (IS_UPPER_CASE_CHAR(ch)) fputc(ch, stdout); + else if (IS_PLUS_N_SPACE_CHAR(ch)) goto name_done; + else if (ch == NUL) { pz--; goto name_done; } + else fputc('_', stdout); + } name_done:; + printf("=%1$lu # 0x%1$lX\n", (unsigned long)val); + val <<= 1; + } + + AGFREE(pOD->optArg.argString); + pOD->optArg.argString = NULL; + pOD->fOptState &= ~OPTST_ALLOC_ARG; +} + +static void +print_stacked_arg(tOptions * pOpts, tOptDesc * pOD) +{ + tSCC zOptCookieCt[] = "%1$s_%2$s_CT=%3$d\nexport %1$s_%2$s_CT\n"; + + tArgList* pAL = (tArgList*)pOD->optCookie; + tCC** ppz = pAL->apzArgs; + int ct = pAL->useCt; + + printf(zOptCookieCt, pOpts->pzPROGNAME, pOD->pz_NAME, ct); + + while (--ct >= 0) { + tSCC numarg_z[] = "%s_%s_%d="; + tSCC end_z[] = "\nexport %s_%s_%d\n"; + + printf(numarg_z, pOpts->pzPROGNAME, pOD->pz_NAME, + pAL->useCt - ct); + print_quot_str(*(ppz++)); + printf(end_z, pOpts->pzPROGNAME, pOD->pz_NAME, + pAL->useCt - ct); + } +} + +static void +print_reordering(tOptions * pOpts) +{ + int optIx; + + fputs("set --", stdout); + + for (optIx = pOpts->curOptIdx; optIx < pOpts->origArgCt; optIx++) { + + char* pzArg = pOpts->origArgVect[ optIx ]; + + if (strchr(pzArg, '\'') == NULL) + printf(" '%s'", pzArg); + + else { + fputs(" '", stdout); + for (;;) { + char ch = *(pzArg++); + switch (ch) { + case '\'': fputs("'\\''", stdout); break; + case NUL: goto arg_done; + default: fputc(ch, stdout); break; + } + } arg_done:; + fputc('\'', stdout); + } + } + fputs("\nOPTION_CT=0\n", stdout); +} /*=export_func optionPutShell * what: write a portable shell script to parse options @@ -127,18 +225,15 @@ putQuotedStr( tCC* pzStr ) * the options described in the option definitions. =*/ void -optionPutShell( tOptions* pOpts ) +optionPutShell(tOptions* pOpts) { int optIx = 0; tSCC zOptCtFmt[] = "OPTION_CT=%d\nexport OPTION_CT\n"; - tSCC zOptNumFmt[] = "%1$s_%2$s=%3$d # 0x%3$X\nexport %1$s_%2$s\n"; tSCC zOptDisabl[] = "%1$s_%2$s=%3$s\nexport %1$s_%2$s\n"; - tSCC zOptValFmt[] = "%s_%s="; - tSCC zOptEnd[] = "\nexport %s_%s\n"; tSCC zFullOptFmt[]= "%1$s_%2$s='%3$s'\nexport %1$s_%2$s\n"; tSCC zEquivMode[] = "%1$s_%2$s_MODE='%3$s'\nexport %1$s_%2$s_MODE\n"; - printf( zOptCtFmt, pOpts->curOptIdx-1 ); + printf(zOptCtFmt, pOpts->curOptIdx-1); do { tOptDesc* pOD = pOpts->pOptDesc + optIx; @@ -166,7 +261,7 @@ optionPutShell( tOptions* pOpts ) p->optArg = pOD->optArg; p->fOptState &= OPTST_PERSISTENT_MASK; p->fOptState |= pOD->fOptState & ~OPTST_PERSISTENT_MASK; - printf( zEquivMode, pOpts->pzPROGNAME, pOD->pz_NAME, p->pz_NAME ); + printf(zEquivMode, pOpts->pzPROGNAME, pOD->pz_NAME, p->pz_NAME); pOD = p; } @@ -176,37 +271,7 @@ optionPutShell( tOptions* pOpts ) * of bitmask value and we need to emit the bit values. */ if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_MEMBERSHIP) { - char const * pz; - uintptr_t val = 1; - printf( zOptNumFmt, pOpts->pzPROGNAME, pOD->pz_NAME, - (int)(uintptr_t)(pOD->optCookie) ); - pOD->optCookie = (void*)(uintptr_t)~0UL; - (*(pOD->pOptProc))( (tOptions*)2UL, pOD ); - - /* - * We are building the typeset list. The list returned starts with - * 'none + ' for use by option saving stuff. We must ignore that. - */ - pz = pOD->optArg.argString + 7; - while (*pz != NUL) { - printf( "typeset -x -i %s_", pOD->pz_NAME ); - pz += strspn( pz, " +\t\n\f" ); - for (;;) { - int ch = *(pz++); - if (islower( ch )) fputc( toupper( ch ), stdout ); - else if (isalnum( ch )) fputc( ch, stdout ); - else if (isspace( ch ) - || (ch == '+')) goto name_done; - else if (ch == NUL) { pz--; goto name_done; } - else fputc( '_', stdout ); - } name_done:; - printf( "=%1$lu # 0x%1$lX\n", (unsigned long)val ); - val <<= 1; - } - - AGFREE(pOD->optArg.argString); - pOD->optArg.argString = NULL; - pOD->fOptState &= ~OPTST_ALLOC_ARG; + print_membership(pOpts, pOD); continue; } @@ -216,114 +281,86 @@ optionPutShell( tOptions* pOpts ) * The idea is that if someone defines an option to initialize * enabled, we should tell our shell script that it is enabled. */ - if (UNUSED_OPT( pOD ) && DISABLED_OPT( pOD )) + if (UNUSED_OPT(pOD) && DISABLED_OPT(pOD)) { continue; + } /* * Handle stacked arguments */ if ( (pOD->fOptState & OPTST_STACKED) && (pOD->optCookie != NULL) ) { - tSCC zOptCookieCt[] = "%1$s_%2$s_CT=%3$d\nexport %1$s_%2$s_CT\n"; - - tArgList* pAL = (tArgList*)pOD->optCookie; - tCC** ppz = pAL->apzArgs; - int ct = pAL->useCt; - - printf( zOptCookieCt, pOpts->pzPROGNAME, pOD->pz_NAME, ct ); - - while (--ct >= 0) { - tSCC numarg_z[] = "%s_%s_%d="; - tSCC end_z[] = "\nexport %s_%s_%d\n"; - - printf( numarg_z, pOpts->pzPROGNAME, pOD->pz_NAME, - pAL->useCt - ct ); - putQuotedStr( *(ppz++) ); - printf( end_z, pOpts->pzPROGNAME, pOD->pz_NAME, - pAL->useCt - ct ); - } + print_stacked_arg(pOpts, pOD); + continue; } /* * If the argument has been disabled, * Then set its value to the disablement string */ - else if ((pOD->fOptState & OPTST_DISABLED) != 0) - printf( zOptDisabl, pOpts->pzPROGNAME, pOD->pz_NAME, - (pOD->pz_DisablePfx != NULL) - ? pOD->pz_DisablePfx : "false" ); + if ((pOD->fOptState & OPTST_DISABLED) != 0) { + printf(zOptDisabl, pOpts->pzPROGNAME, pOD->pz_NAME, + (pOD->pz_DisablePfx != NULL) + ? pOD->pz_DisablePfx : "false"); + continue; + } /* * If the argument type is numeric, the last arg pointer * is really the VALUE of the string that was pointed to. */ - else if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_NUMERIC) - printf( zOptNumFmt, pOpts->pzPROGNAME, pOD->pz_NAME, - (int)pOD->optArg.argInt ); + if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_NUMERIC) { + printf(zOptNumFmt, pOpts->pzPROGNAME, pOD->pz_NAME, + (int)pOD->optArg.argInt); + continue; + } /* * If the argument type is an enumeration, then it is much * like a text value, except we call the callback function * to emit the value corresponding to the "optArg" number. */ - else if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_ENUMERATION) { - printf( zOptValFmt, pOpts->pzPROGNAME, pOD->pz_NAME ); - fputc( '\'', stdout ); - (*(pOD->pOptProc))( (tOptions*)1UL, pOD ); - fputc( '\'', stdout ); - printf( zOptEnd, pOpts->pzPROGNAME, pOD->pz_NAME ); + if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_ENUMERATION) { + print_enumeration(pOpts, pOD); + continue; } /* * If the argument type is numeric, the last arg pointer * is really the VALUE of the string that was pointed to. */ - else if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_BOOLEAN) - printf( zFullOptFmt, pOpts->pzPROGNAME, pOD->pz_NAME, - (pOD->optArg.argBool == 0) ? "false" : "true" ); + if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_BOOLEAN) { + printf(zFullOptFmt, pOpts->pzPROGNAME, pOD->pz_NAME, + (pOD->optArg.argBool == 0) ? "false" : "true"); + continue; + } /* * IF the option has an empty value, * THEN we set the argument to the occurrence count. */ - else if ( (pOD->optArg.argString == NULL) - || (pOD->optArg.argString[0] == NUL) ) + if ( (pOD->optArg.argString == NULL) + || (pOD->optArg.argString[0] == NUL) ) { - printf( zOptNumFmt, pOpts->pzPROGNAME, pOD->pz_NAME, - pOD->optOccCt ); + printf(zOptNumFmt, pOpts->pzPROGNAME, pOD->pz_NAME, + pOD->optOccCt); + continue; + } /* * This option has a text value */ - else { - printf( zOptValFmt, pOpts->pzPROGNAME, pOD->pz_NAME ); - putQuotedStr( pOD->optArg.argString ); - printf( zOptEnd, pOpts->pzPROGNAME, pOD->pz_NAME ); - } + printf(zOptValFmt, pOpts->pzPROGNAME, pOD->pz_NAME); + print_quot_str(pOD->optArg.argString); + printf(zOptEnd, pOpts->pzPROGNAME, pOD->pz_NAME); + } while (++optIx < pOpts->presetOptCt ); if ( ((pOpts->fOptSet & OPTPROC_REORDER) != 0) - && (pOpts->curOptIdx < pOpts->origArgCt)) { - fputs( "set --", stdout ); - for (optIx = pOpts->curOptIdx; optIx < pOpts->origArgCt; optIx++) { - char* pzArg = pOpts->origArgVect[ optIx ]; - if (strchr( pzArg, '\'' ) == NULL) - printf( " '%s'", pzArg ); - else { - fputs( " '", stdout ); - for (;;) { - char ch = *(pzArg++); - switch (ch) { - case '\'': fputs( "'\\''", stdout ); break; - case NUL: goto arg_done; - default: fputc( ch, stdout ); break; - } - } arg_done:; - fputc( '\'', stdout ); - } - } - fputs( "\nOPTION_CT=0\n", stdout ); - } + && (pOpts->curOptIdx < pOpts->origArgCt)) + print_reordering(pOpts); + + fflush(stdout); } /* diff --git a/sntp/libopts/reset.c b/sntp/libopts/reset.c new file mode 100644 index 0000000..2959db6 --- /dev/null +++ b/sntp/libopts/reset.c @@ -0,0 +1,135 @@ + +/** + * \file reset.c + * + * Time-stamp: "2010-07-10 10:56:34 bkorb" + * + * This file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved + * + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. + * + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" + * + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" + * + * These files have the following md5sums: + * + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + */ + +static void +optionReset( tOptions* pOpts, tOptDesc* pOD ) +{ + pOD->fOptState &= OPTST_PERSISTENT_MASK; + pOD->fOptState |= OPTST_RESET; + if (pOD->pOptProc != NULL) + pOD->pOptProc(pOpts, pOD); + pOD->optArg.argString = + pOpts->originalOptArgArray[ pOD->optIndex ].argString; + pOD->optCookie = pOpts->originalOptArgCookie[ pOD->optIndex ]; + pOD->fOptState &= OPTST_PERSISTENT_MASK; +} + + +static void +optionResetEverything(tOptions * pOpts) +{ + tOptDesc * pOD = pOpts->pOptDesc; + int ct = pOpts->presetOptCt; + + for (;;) { + optionReset(pOpts, pOD); + + if (--ct <= 0) + break; + pOD++; + } +} + + +/*=export_func optionResetOpt + * private: + * + * what: Reset the value of an option + * arg: + tOptions* + pOpts + program options descriptor + + * arg: + tOptDesc* + pOptDesc + the descriptor for this arg + + * + * doc: + * This code will cause another option to be reset to its initial state. + * For example, --reset=foo will cause the --foo option to be reset. +=*/ +void +optionResetOpt( tOptions* pOpts, tOptDesc* pOD ) +{ + static ag_bool reset_active = AG_FALSE; + + tOptState opt_state = OPTSTATE_INITIALIZER(DEFINED); + char const * pzArg = pOD->optArg.argString; + tSuccess succ; + + if (reset_active) + return; + + if ( (! HAS_originalOptArgArray(pOpts)) + || (pOpts->originalOptArgCookie == NULL)) { + fputs(zResetNotConfig, stderr); + _exit(EX_SOFTWARE); + } + + if ((pzArg == NULL) || (*pzArg == NUL)) { + fputs(zNoResetArg, stderr); + pOpts->pUsageProc(pOpts, EXIT_FAILURE); + /* NOTREACHED */ + assert(0 == 1); + } + + reset_active = AG_TRUE; + + if (pzArg[1] == NUL) { + if (*pzArg == '*') { + optionResetEverything(pOpts); + reset_active = AG_FALSE; + return; + } + + succ = shortOptionFind(pOpts, (tAoUC)*pzArg, &opt_state); + if (! SUCCESSFUL(succ)) { + fprintf(stderr, zIllOptChr, pOpts->pzProgPath, *pzArg); + pOpts->pUsageProc(pOpts, EXIT_FAILURE); + /* NOTREACHED */ + assert(0 == 1); + } + } else { + succ = longOptionFind(pOpts, (char *)pzArg, &opt_state); + if (! SUCCESSFUL(succ)) { + fprintf(stderr, zIllOptStr, pOpts->pzProgPath, pzArg); + pOpts->pUsageProc(pOpts, EXIT_FAILURE); + /* NOTREACHED */ + assert(0 == 1); + } + } + + /* + * We've found the indicated option. Turn off all non-persistent + * flags because we're forcing the option back to its initialized state. + * Call any callout procedure to handle whatever it needs to. + * Finally, clear the reset flag, too. + */ + optionReset(pOpts, opt_state.pOD); + reset_active = AG_FALSE; +} +/* + * Local Variables: + * mode: C + * c-file-style: "stroustrup" + * indent-tabs-mode: nil + * End: + * end of autoopts/reset.c */ diff --git a/sntp/libopts/restore.c b/sntp/libopts/restore.c index 91eac08..f55f3d2 100644 --- a/sntp/libopts/restore.c +++ b/sntp/libopts/restore.c @@ -1,54 +1,32 @@ /* - * restore.c $Id: restore.c,v 4.10 2007/02/04 17:44:12 bkorb Exp $ - * Time-stamp: "2007-01-13 14:13:17 bkorb" + * \file restore.c + * + * Time-stamp: "2010-08-22 11:04:00 bkorb" * * This module's routines will save the current option state to memory * and restore it. If saved prior to the initial optionProcess call, * then the initial state will be restored. - */ - -/* - * Automated Options copyright 1992-2007 Bruce Korb - * - * Automated Options is free software. - * You may 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. - * - * Automated Options 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 Automated Options. See the file "COPYING". If not, - * write to: The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - * As a special exception, Bruce Korb gives permission for additional - * uses of the text contained in his release of AutoOpts. - * - * The exception is that, if you link the AutoOpts library with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the AutoOpts library code into it. - * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. - * - * This exception applies only to the code released by Bruce Korb under - * the name AutoOpts. If you copy code from other sources under the - * General Public License into a copy of AutoOpts, as the General Public - * License permits, the exception does not apply to the code that you add - * in this way. To avoid misleading anyone as to the status of such - * modified files, you must delete this exception notice from them. - * - * If you write modifications of your own for AutoOpts, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. + * + * This file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved + * + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. + * + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" + * + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" + * + * These files have the following md5sums: + * + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd */ /* @@ -119,8 +97,8 @@ optionSaveState(tOptions* pOpts) tOptions* p = (tOptions*)pOpts->pSavedState; if (p == NULL) { - size_t sz = sizeof( *pOpts ) + (pOpts->optCt * sizeof( tOptDesc )); - p = AGALOC( sz, "saved option state" ); + size_t sz = sizeof(*pOpts) + (pOpts->optCt * sizeof(tOptDesc)); + p = AGALOC(sz, "saved option state"); if (p == NULL) { tCC* pzName = pOpts->pzProgName; if (pzName == NULL) { @@ -128,15 +106,15 @@ optionSaveState(tOptions* pOpts) if (pzName == NULL) pzName = zNil; } - fprintf( stderr, zCantSave, pzName, sz ); - exit( EXIT_FAILURE ); + fprintf(stderr, zCantSave, pzName, sz); + exit(EXIT_FAILURE); } pOpts->pSavedState = p; } - memcpy( p, pOpts, sizeof( *p )); - memcpy( p + 1, pOpts->pOptDesc, p->optCt * sizeof( tOptDesc )); + memcpy(p, pOpts, sizeof(*p)); + memcpy(p + 1, pOpts->pOptDesc, p->optCt * sizeof(tOptDesc)); fixupSavedOptionArgs(pOpts); } @@ -158,7 +136,7 @@ optionSaveState(tOptions* pOpts) * printed to @code{stderr} and exit is called. =*/ void -optionRestore( tOptions* pOpts ) +optionRestore(tOptions* pOpts) { tOptions* p = (tOptions*)pOpts->pSavedState; @@ -169,15 +147,15 @@ optionRestore( tOptions* pOpts ) if (pzName == NULL) pzName = zNil; } - fprintf( stderr, zNoState, pzName ); - exit( EXIT_FAILURE ); + fprintf(stderr, zNoState, pzName); + exit(EXIT_FAILURE); } pOpts->pSavedState = NULL; optionFree(pOpts); - memcpy( pOpts, p, sizeof( *p )); - memcpy( pOpts->pOptDesc, p+1, p->optCt * sizeof( tOptDesc )); + memcpy(pOpts, p, sizeof(*p)); + memcpy(pOpts->pOptDesc, p+1, p->optCt * sizeof(tOptDesc)); pOpts->pSavedState = p; fixupSavedOptionArgs(pOpts); @@ -197,7 +175,7 @@ optionRestore( tOptions* pOpts ) * this routine is always successful. =*/ void -optionFree( tOptions* pOpts ) +optionFree(tOptions* pOpts) { free_saved_state: { @@ -225,7 +203,7 @@ optionFree( tOptions* pOpts ) case OPARG_TYPE_HIERARCHY: if (p->optCookie != NULL) - unloadNestedArglist(p->optCookie); + unload_arg_list(p->optCookie); break; } @@ -234,9 +212,9 @@ optionFree( tOptions* pOpts ) } if (pOpts->pSavedState != NULL) { tOptions * p = (tOptions*)pOpts->pSavedState; - memcpy( pOpts, p, sizeof( *p )); - memcpy( pOpts->pOptDesc, p+1, p->optCt * sizeof( tOptDesc )); - AGFREE( pOpts->pSavedState ); + memcpy(pOpts, p, sizeof(*p)); + memcpy(pOpts->pOptDesc, p+1, p->optCt * sizeof(tOptDesc)); + AGFREE(pOpts->pSavedState); pOpts->pSavedState = NULL; goto free_saved_state; } diff --git a/sntp/libopts/save.c b/sntp/libopts/save.c index c889520..9c36bc8 100644 --- a/sntp/libopts/save.c +++ b/sntp/libopts/save.c @@ -1,79 +1,88 @@ /* - * save.c $Id: save.c,v 4.18 2007/04/15 19:01:18 bkorb Exp $ - * Time-stamp: "2007-04-15 11:11:10 bkorb" + * \file save.c + * + * Time-stamp: "2011-04-06 09:21:44 bkorb" * * This module's routines will take the currently set options and * store them into an ".rc" file for re-interpretation the next * time the invoking program is run. - */ - -/* - * Automated Options copyright 1992-2007 Bruce Korb * - * Automated Options is free software. - * You may 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 file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved * - * Automated Options 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. + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. * - * You should have received a copy of the GNU General Public License - * along with Automated Options. See the file "COPYING". If not, - * write to: The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" * - * As a special exception, Bruce Korb gives permission for additional - * uses of the text contained in his release of AutoOpts. + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" * - * The exception is that, if you link the AutoOpts library with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the AutoOpts library code into it. + * These files have the following md5sums: * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. - * - * This exception applies only to the code released by Bruce Korb under - * the name AutoOpts. If you copy code from other sources under the - * General Public License into a copy of AutoOpts, as the General Public - * License permits, the exception does not apply to the code that you add - * in this way. To avoid misleading anyone as to the status of such - * modified files, you must delete this exception notice from them. - * - * If you write modifications of your own for AutoOpts, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd */ -tSCC zWarn[] = "%s WARNING: cannot save options - "; +static char const zWarn[] = "%s WARNING: cannot save options - "; +static char const close_xml[] = "</%s>\n"; /* = = = START-STATIC-FORWARD = = = */ -/* static forward declarations maintained by :mkfwd */ static tCC* -findDirName( tOptions* pOpts, int* p_free ); +findDirName(tOptions* pOpts, int* p_free); -static tCC* -findFileName( tOptions* pOpts, int* p_free_name ); +static char const * +findFileName(tOptions * pOpts, int * p_free_name); static void printEntry( FILE * fp, tOptDesc * p, tCC* pzLA ); + +static void +print_a_value(FILE * fp, int depth, tOptDesc * pOD, tOptionValue const * ovp); + +static void +print_a_string(FILE * fp, char const * name, char const * pz); + +static void +printValueList(FILE * fp, char const * name, tArgList * al); + +static void +printHierarchy(FILE * fp, tOptDesc * p); + +static FILE * +openSaveFile(tOptions* pOpts); + +static void +printNoArgOpt(FILE * fp, tOptDesc * p, tOptDesc * pOD); + +static void +printStringArg(FILE * fp, tOptDesc * pOD); + +static void +printEnumArg(FILE * fp, tOptDesc * pOD); + +static void +printSetMemberArg(FILE * fp, tOptDesc * pOD); + +static void +printFileArg(FILE * fp, tOptDesc * pOD, tOptions* pOpts); /* = = = END-STATIC-FORWARD = = = */ static tCC* -findDirName( tOptions* pOpts, int* p_free ) +findDirName(tOptions* pOpts, int* p_free) { tCC* pzDir; - if (pOpts->specOptIdx.save_opts == 0) + if ( (pOpts->specOptIdx.save_opts == NO_EQUIVALENT) + || (pOpts->specOptIdx.save_opts == 0)) return NULL; pzDir = pOpts->pOptDesc[ pOpts->specOptIdx.save_opts ].optArg.argString; @@ -100,7 +109,7 @@ findDirName( tOptions* pOpts, int* p_free ) return pzDir; { - tCC* pzEndDir = strchr( ++pzDir, DIRCH ); + tCC* pzEndDir = strchr(++pzDir, DIRCH); char* pzFileName; char* pzEnv; @@ -108,21 +117,21 @@ findDirName( tOptions* pOpts, int* p_free ) char z[ AO_NAME_SIZE ]; if ((pzEndDir - pzDir) > AO_NAME_LIMIT ) return NULL; - strncpy( z, pzDir, (size_t)(pzEndDir - pzDir) ); - z[ (pzEndDir - pzDir) ] = NUL; - pzEnv = getenv( z ); + memcpy(z, pzDir, (size_t)(pzEndDir - pzDir)); + z[pzEndDir - pzDir] = NUL; + pzEnv = getenv(z); } else { /* * Make sure we can get the env value (after stripping off * any trailing directory or file names) */ - pzEnv = getenv( pzDir ); + pzEnv = getenv(pzDir); } if (pzEnv == NULL) { - fprintf( stderr, zWarn, pOpts->pzProgName ); - fprintf( stderr, zNotDef, pzDir ); + fprintf(stderr, zWarn, pOpts->pzProgName); + fprintf(stderr, zNotDef, pzDir); return NULL; } @@ -130,8 +139,8 @@ findDirName( tOptions* pOpts, int* p_free ) return pzEnv; { - size_t sz = strlen( pzEnv ) + strlen( pzEndDir ) + 2; - pzFileName = (char*)AGALOC( sz, "dir name" ); + size_t sz = strlen(pzEnv) + strlen(pzEndDir) + 2; + pzFileName = (char*)AGALOC(sz, "dir name"); } if (pzFileName == NULL) @@ -142,20 +151,19 @@ findDirName( tOptions* pOpts, int* p_free ) * Glue together the full name into the allocated memory. * FIXME: We lose track of this memory. */ - sprintf( pzFileName, "%s/%s", pzEnv, pzEndDir ); + sprintf(pzFileName, "%s/%s", pzEnv, pzEndDir); return pzFileName; } } -static tCC* -findFileName( tOptions* pOpts, int* p_free_name ) +static char const * +findFileName(tOptions * pOpts, int * p_free_name) { - tCC* pzDir; struct stat stBuf; int free_dir_name = 0; - pzDir = findDirName( pOpts, &free_dir_name ); + char const * pzDir = findDirName(pOpts, &free_dir_name); if (pzDir == NULL) return NULL; @@ -163,66 +171,60 @@ findFileName( tOptions* pOpts, int* p_free_name ) * See if we can find the specified directory. We use a once-only loop * structure so we can bail out early. */ - if (stat( pzDir, &stBuf ) != 0) do { + if (stat(pzDir, &stBuf) != 0) do { + char z[AG_PATH_MAX]; + char * dirchp; /* * IF we could not, check to see if we got a full * path to a file name that has not been created yet. */ - if (errno == ENOENT) { - char z[AG_PATH_MAX]; - - /* - * Strip off the last component, stat the remaining string and - * that string must name a directory - */ - char* pzDirCh = strrchr( pzDir, DIRCH ); - if (pzDirCh == NULL) { - stBuf.st_mode = S_IFREG; - continue; /* bail out of error condition */ - } - - strncpy( z, pzDir, (size_t)(pzDirCh - pzDir)); - z[ pzDirCh - pzDir ] = NUL; - - if ( (stat( z, &stBuf ) == 0) - && S_ISDIR( stBuf.st_mode )) { - - /* - * We found the directory. Restore the file name and - * mark the full name as a regular file - */ - stBuf.st_mode = S_IFREG; - continue; /* bail out of error condition */ - } + if (errno != ENOENT) { + bogus_name: + fprintf(stderr, zWarn, pOpts->pzProgName); + fprintf(stderr, zNoStat, errno, strerror(errno), pzDir); + if (free_dir_name) + AGFREE((void*)pzDir); + return NULL; } /* - * We got a bogus name. + * Strip off the last component, stat the remaining string and + * that string must name a directory */ - fprintf( stderr, zWarn, pOpts->pzProgName ); - fprintf( stderr, zNoStat, errno, strerror( errno ), pzDir ); - if (free_dir_name) - AGFREE( (void*)pzDir ); - return NULL; + dirchp = strrchr(pzDir, DIRCH); + if (dirchp == NULL) { + stBuf.st_mode = S_IFREG; + break; /* found directory -- viz., "." */ + } + + if ((dirchp - pzDir) >= sizeof(z)) + goto bogus_name; + + memcpy(z, pzDir, (size_t)(dirchp - pzDir)); + z[dirchp - pzDir] = NUL; + + if ((stat(z, &stBuf) != 0) || ! S_ISDIR(stBuf.st_mode)) + goto bogus_name; + stBuf.st_mode = S_IFREG; /* file within this directory */ } while (0); /* * IF what we found was a directory, * THEN tack on the config file name */ - if (S_ISDIR( stBuf.st_mode )) { - size_t sz = strlen( pzDir ) + strlen( pOpts->pzRcName ) + 2; + if (S_ISDIR(stBuf.st_mode)) { + size_t sz = strlen(pzDir) + strlen(pOpts->pzRcName) + 2; { - char* pzPath = (char*)AGALOC( sz, "file name" ); + char* pzPath = (char*)AGALOC(sz, "file name"); #ifdef HAVE_SNPRINTF - snprintf( pzPath, sz, "%s/%s", pzDir, pOpts->pzRcName ); + snprintf(pzPath, sz, "%s/%s", pzDir, pOpts->pzRcName); #else - sprintf( pzPath, "%s/%s", pzDir, pOpts->pzRcName ); + sprintf(pzPath, "%s/%s", pzDir, pOpts->pzRcName); #endif if (free_dir_name) - AGFREE( (void*)pzDir ); + AGFREE((void*)pzDir); pzDir = pzPath; free_dir_name = 1; } @@ -231,12 +233,12 @@ findFileName( tOptions* pOpts, int* p_free_name ) * IF we cannot stat the object for any reason other than * it does not exist, then we bail out */ - if (stat( pzDir, &stBuf ) != 0) { + if (stat(pzDir, &stBuf) != 0) { if (errno != ENOENT) { - fprintf( stderr, zWarn, pOpts->pzProgName ); - fprintf( stderr, zNoStat, errno, strerror( errno ), - pzDir ); - AGFREE( (void*)pzDir ); + fprintf(stderr, zWarn, pOpts->pzProgName); + fprintf(stderr, zNoStat, errno, strerror(errno), + pzDir); + AGFREE((void*)pzDir); return NULL; } @@ -251,18 +253,18 @@ findFileName( tOptions* pOpts, int* p_free_name ) * Make sure that whatever we ultimately found, that it either is * or will soon be a file. */ - if (! S_ISREG( stBuf.st_mode )) { - fprintf( stderr, zWarn, pOpts->pzProgName ); - fprintf( stderr, zNotFile, pzDir ); + if (! S_ISREG(stBuf.st_mode)) { + fprintf(stderr, zWarn, pOpts->pzProgName); + fprintf(stderr, zNotFile, pzDir); if (free_dir_name) - AGFREE( (void*)pzDir ); + AGFREE((void*)pzDir); return NULL; } /* * Get rid of the old file */ - unlink( pzDir ); + unlink(pzDir); *p_free_name = free_dir_name; return pzDir; } @@ -294,18 +296,18 @@ printEntry( * THEN the char pointer is really the number */ if (OPTST_GET_ARGTYPE(p->fOptState) == OPARG_TYPE_NUMERIC) - fprintf( fp, " %d\n", (int)(t_word)pzLA ); + fprintf(fp, " %d\n", (int)(t_word)pzLA); /* * OTHERWISE, FOR each line of the value text, ... */ else if (pzLA == NULL) - fputc( '\n', fp ); + fputc('\n', fp); else { - fputc( ' ', fp ); fputc( ' ', fp ); + fputc(' ', fp); fputc(' ', fp); for (;;) { - tCC* pzNl = strchr( pzLA, '\n' ); + tCC* pzNl = strchr(pzLA, '\n'); /* * IF this is the last line @@ -317,95 +319,393 @@ printEntry( /* * Print the continuation and the text from the current line */ - (void)fwrite( pzLA, (size_t)(pzNl - pzLA), (size_t)1, fp ); + (void)fwrite(pzLA, (size_t)(pzNl - pzLA), (size_t)1, fp); pzLA = pzNl+1; /* advance the Last Arg pointer */ - fputs( "\\\n", fp ); + fputs("\\\n", fp); } /* * Terminate the entry */ - fputs( pzLA, fp ); - fputc( '\n', fp ); + fputs(pzLA, fp); + fputc('\n', fp); } } -/*=export_func optionSaveFile - * - * what: saves the option state to a file - * - * arg: tOptions*, pOpts, program options descriptor - * - * doc: - * - * This routine will save the state of option processing to a file. The name - * of that file can be specified with the argument to the @code{--save-opts} - * option, or by appending the @code{rcfile} attribute to the last - * @code{homerc} attribute. If no @code{rcfile} attribute was specified, it - * will default to @code{.@i{programname}rc}. If you wish to specify another - * file, you should invoke the @code{SET_OPT_SAVE_OPTS( @i{filename} )} macro. - * - * err: - * - * If no @code{homerc} file was specified, this routine will silently return - * and do nothing. If the output file cannot be created or updated, a message - * will be printed to @code{stderr} and the routine will return. -=*/ -void -optionSaveFile( tOptions* pOpts ) +static void +print_a_value(FILE * fp, int depth, tOptDesc * pOD, tOptionValue const * ovp) +{ + static char const bool_atr[] = "<%1$s type=boolean>%2$s</%1$s>\n"; + static char const numb_atr[] = "<%1$s type=integer>0x%2$lX</%1$s>\n"; + static char const type_atr[] = "<%s type=%s>"; + static char const null_atr[] = "<%s/>\n"; + + while (--depth >= 0) + putc(' ', fp), putc(' ', fp); + + switch (ovp->valType) { + default: + case OPARG_TYPE_NONE: + fprintf(fp, null_atr, ovp->pzName); + break; + + case OPARG_TYPE_STRING: + print_a_string(fp, ovp->pzName, ovp->v.strVal); + break; + + case OPARG_TYPE_ENUMERATION: + case OPARG_TYPE_MEMBERSHIP: + if (pOD != NULL) { + tAoUI opt_state = pOD->fOptState; + uintptr_t val = pOD->optArg.argEnum; + char const * typ = (ovp->valType == OPARG_TYPE_ENUMERATION) + ? "keyword" : "set-membership"; + + fprintf(fp, type_atr, ovp->pzName, typ); + + /* + * This is a magic incantation that will convert the + * bit flag values back into a string suitable for printing. + */ + (*(pOD->pOptProc))(OPTPROC_RETURN_VALNAME, pOD ); + if (pOD->optArg.argString != NULL) { + fputs(pOD->optArg.argString, fp); + + if (ovp->valType != OPARG_TYPE_ENUMERATION) { + /* + * set membership strings get allocated + */ + AGFREE((void*)pOD->optArg.argString); + } + } + + pOD->optArg.argEnum = val; + pOD->fOptState = opt_state; + fprintf(fp, close_xml, ovp->pzName); + break; + } + /* FALLTHROUGH */ + + case OPARG_TYPE_NUMERIC: + fprintf(fp, numb_atr, ovp->pzName, ovp->v.longVal); + break; + + case OPARG_TYPE_BOOLEAN: + fprintf(fp, bool_atr, ovp->pzName, + ovp->v.boolVal ? "true" : "false"); + break; + + case OPARG_TYPE_HIERARCHY: + printValueList(fp, ovp->pzName, ovp->v.nestVal); + break; + } +} + + +static void +print_a_string(FILE * fp, char const * name, char const * pz) +{ + static char const open_atr[] = "<%s>"; + + fprintf(fp, open_atr, name); + for (;;) { + int ch = ((int)*(pz++)) & 0xFF; + + switch (ch) { + case NUL: goto string_done; + + case '&': + case '<': + case '>': +#if __GNUC__ >= 4 + case 1 ... (' ' - 1): + case ('~' + 1) ... 0xFF: +#endif + emit_special_char(fp, ch); + break; + + default: +#if __GNUC__ < 4 + if ( ((ch >= 1) && (ch <= (' ' - 1))) + || ((ch >= ('~' + 1)) && (ch <= 0xFF)) ) { + emit_special_char(fp, ch); + break; + } +#endif + putc(ch, fp); + } + } string_done:; + fprintf(fp, close_xml, name); +} + + +static void +printValueList(FILE * fp, char const * name, tArgList * al) +{ + static int depth = 1; + + int sp_ct; + int opt_ct; + void ** opt_list; + + if (al == NULL) + return; + opt_ct = al->useCt; + opt_list = (void **)al->apzArgs; + + if (opt_ct <= 0) { + fprintf(fp, "<%s/>\n", name); + return; + } + + fprintf(fp, "<%s type=nested>\n", name); + + depth++; + while (--opt_ct >= 0) { + tOptionValue const * ovp = *(opt_list++); + + print_a_value(fp, depth, NULL, ovp); + } + depth--; + + for (sp_ct = depth; --sp_ct >= 0;) + putc(' ', fp), putc(' ', fp); + fprintf(fp, "</%s>\n", name); +} + + +static void +printHierarchy(FILE * fp, tOptDesc * p) +{ + int opt_ct; + tArgList * al = p->optCookie; + void ** opt_list; + + if (al == NULL) + return; + + opt_ct = al->useCt; + opt_list = (void **)al->apzArgs; + + if (opt_ct <= 0) + return; + + do { + tOptionValue const * base = *(opt_list++); + tOptionValue const * ovp = optionGetValue(base, NULL); + + if (ovp == NULL) + continue; + + fprintf(fp, "<%s type=nested>\n", p->pz_Name); + + do { + print_a_value(fp, 1, p, ovp); + + } while (ovp = optionNextValue(base, ovp), + ovp != NULL); + + fprintf(fp, "</%s>\n", p->pz_Name); + } while (--opt_ct > 0); +} + + +static FILE * +openSaveFile(tOptions* pOpts) { - tOptDesc* pOD; - int ct; FILE* fp; { int free_name = 0; - tCC* pzFName = findFileName( pOpts, &free_name ); + tCC* pzFName = findFileName(pOpts, &free_name); if (pzFName == NULL) - return; + return NULL; - fp = fopen( pzFName, "w" FOPEN_BINARY_FLAG ); + fp = fopen(pzFName, "w" FOPEN_BINARY_FLAG); if (fp == NULL) { - fprintf( stderr, zWarn, pOpts->pzProgName ); - fprintf( stderr, zNoCreat, errno, strerror( errno ), pzFName ); + fprintf(stderr, zWarn, pOpts->pzProgName); + fprintf(stderr, zNoCreat, errno, strerror(errno), pzFName); if (free_name) AGFREE((void*) pzFName ); - return; + return fp; } if (free_name) - AGFREE( (void*)pzFName ); + AGFREE((void*)pzFName); } { char const* pz = pOpts->pzUsageTitle; - fputs( "# ", fp ); - do { fputc( *pz, fp ); } while (*(pz++) != '\n'); + fputs("# ", fp); + do { fputc(*pz, fp); } while (*(pz++) != '\n'); } { - time_t timeVal = time( NULL ); - char* pzTime = ctime( &timeVal ); + time_t timeVal = time(NULL); + char* pzTime = ctime(&timeVal); - fprintf( fp, zPresetFile, pzTime ); + fprintf(fp, zPresetFile, pzTime); #ifdef HAVE_ALLOCATED_CTIME /* * The return values for ctime(), localtime(), and gmtime() * normally point to static data that is overwritten by each call. * The test to detect allocated ctime, so we leak the memory. */ - AGFREE( (void*)pzTime ); + AGFREE((void*)pzTime); #endif } + return fp; +} + +static void +printNoArgOpt(FILE * fp, tOptDesc * p, tOptDesc * pOD) +{ + /* + * The aliased to argument indicates whether or not the option + * is "disabled". However, the original option has the name + * string, so we get that there, not with "p". + */ + char const * pznm = + (DISABLED_OPT(p)) ? pOD->pz_DisableName : pOD->pz_Name; + /* + * If the option was disabled and the disablement name is NULL, + * then the disablement was caused by aliasing. + * Use the name as the string to emit. + */ + if (pznm == NULL) + pznm = pOD->pz_Name; + + fprintf(fp, "%s\n", pznm); +} + +static void +printStringArg(FILE * fp, tOptDesc * pOD) +{ + if (pOD->fOptState & OPTST_STACKED) { + tArgList* pAL = (tArgList*)pOD->optCookie; + int uct = pAL->useCt; + tCC** ppz = pAL->apzArgs; + + /* + * un-disable multiple copies of disabled options. + */ + if (uct > 1) + pOD->fOptState &= ~OPTST_DISABLED; + + while (uct-- > 0) + printEntry(fp, pOD, *(ppz++)); + } else { + printEntry(fp, pOD, pOD->optArg.argString); + } +} + +static void +printEnumArg(FILE * fp, tOptDesc * pOD) +{ + uintptr_t val = pOD->optArg.argEnum; + + /* + * This is a magic incantation that will convert the + * bit flag values back into a string suitable for printing. + */ + (*(pOD->pOptProc))(OPTPROC_RETURN_VALNAME, pOD); + printEntry(fp, pOD, (void*)(pOD->optArg.argString)); + + pOD->optArg.argEnum = val; +} + +static void +printSetMemberArg(FILE * fp, tOptDesc * pOD) +{ + uintptr_t val = pOD->optArg.argEnum; + + /* + * This is a magic incantation that will convert the + * bit flag values back into a string suitable for printing. + */ + (*(pOD->pOptProc))(OPTPROC_RETURN_VALNAME, pOD); + printEntry(fp, pOD, (void*)(pOD->optArg.argString)); + + if (pOD->optArg.argString != NULL) { + /* + * set membership strings get allocated + */ + AGFREE((void*)pOD->optArg.argString); + pOD->fOptState &= ~OPTST_ALLOC_ARG; + } + + pOD->optArg.argEnum = val; +} + +static void +printFileArg(FILE * fp, tOptDesc * pOD, tOptions* pOpts) +{ + /* + * If the cookie is not NULL, then it has the file name, period. + * Otherwise, if we have a non-NULL string argument, then.... + */ + if (pOD->optCookie != NULL) + printEntry(fp, pOD, pOD->optCookie); + + else if (HAS_originalOptArgArray(pOpts)) { + char const * orig = + pOpts->originalOptArgArray[pOD->optIndex].argString; + + if (pOD->optArg.argString == orig) + return; + + printEntry(fp, pOD, pOD->optArg.argString); + } +} + + +/*=export_func optionSaveFile + * + * what: saves the option state to a file + * + * arg: tOptions*, pOpts, program options descriptor + * + * doc: + * + * This routine will save the state of option processing to a file. The name + * of that file can be specified with the argument to the @code{--save-opts} + * option, or by appending the @code{rcfile} attribute to the last + * @code{homerc} attribute. If no @code{rcfile} attribute was specified, it + * will default to @code{.@i{programname}rc}. If you wish to specify another + * file, you should invoke the @code{SET_OPT_SAVE_OPTS(@i{filename})} macro. + * + * The recommend usage is as follows: + * @example + * optionProcess(&progOptions, argc, argv); + * if (i_want_a_non_standard_place_for_this) + * SET_OPT_SAVE_OPTS("myfilename"); + * optionSaveFile(&progOptions); + * @end example + * + * err: + * + * If no @code{homerc} file was specified, this routine will silently return + * and do nothing. If the output file cannot be created or updated, a message + * will be printed to @code{stderr} and the routine will return. +=*/ +void +optionSaveFile(tOptions* pOpts) +{ + tOptDesc* pOD; + int ct; + FILE* fp = openSaveFile(pOpts); + + if (fp == NULL) + return; + /* * FOR each of the defined options, ... */ ct = pOpts->presetOptCt; pOD = pOpts->pOptDesc; do { - int arg_state; tOptDesc* p; /* @@ -413,104 +713,67 @@ optionSaveFile( tOptions* pOpts ) * OR it does not take an initialization value * OR it is equivalenced to another option * THEN continue (ignore it) + * + * Equivalenced options get picked up when the equivalenced-to + * option is processed. */ - if (UNUSED_OPT( pOD )) + if (UNUSED_OPT(pOD)) continue; - if ((pOD->fOptState & (OPTST_NO_INIT|OPTST_DOCUMENT|OPTST_OMITTED)) - != 0) + if ((pOD->fOptState & OPTST_DO_NOT_SAVE_MASK) != 0) continue; if ( (pOD->optEquivIndex != NO_EQUIVALENT) - && (pOD->optEquivIndex != pOD->optIndex)) + && (pOD->optEquivIndex != pOD->optIndex)) continue; /* - * Set a temporary pointer to the real option description - * (i.e. account for equivalencing) + * The option argument data are found at the equivalenced-to option, + * but the actual option argument type comes from the original + * option descriptor. Be careful! */ p = ((pOD->fOptState & OPTST_EQUIVALENCE) != 0) ? (pOpts->pOptDesc + pOD->optActualIndex) : pOD; - /* - * IF no arguments are allowed - * THEN just print the name and continue - */ - if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_NONE) { - char const * pznm = - (DISABLED_OPT( p )) ? p->pz_DisableName : p->pz_Name; - /* - * If the option was disabled and the disablement name is NULL, - * then the disablement was caused by aliasing. - * Use the name as the string to emit. - */ - if (pznm == NULL) - pznm = p->pz_Name; - - fprintf(fp, "%s\n", pznm); - continue; - } + switch (OPTST_GET_ARGTYPE(pOD->fOptState)) { + case OPARG_TYPE_NONE: + printNoArgOpt(fp, p, pOD); + break; - arg_state = OPTST_GET_ARGTYPE(p->fOptState); - switch (arg_state) { - case 0: case OPARG_TYPE_NUMERIC: - printEntry( fp, p, (void*)(p->optArg.argInt)); + printEntry(fp, p, (void*)(p->optArg.argInt)); break; case OPARG_TYPE_STRING: - if (p->fOptState & OPTST_STACKED) { - tArgList* pAL = (tArgList*)p->optCookie; - int uct = pAL->useCt; - tCC** ppz = pAL->apzArgs; - - /* - * Disallow multiple copies of disabled options. - */ - if (uct > 1) - p->fOptState &= ~OPTST_DISABLED; - - while (uct-- > 0) - printEntry( fp, p, *(ppz++) ); - } else { - printEntry( fp, p, p->optArg.argString ); - } + printStringArg(fp, p); break; case OPARG_TYPE_ENUMERATION: - case OPARG_TYPE_MEMBERSHIP: - { - uintptr_t val = p->optArg.argEnum; - /* - * This is a magic incantation that will convert the - * bit flag values back into a string suitable for printing. - */ - (*(p->pOptProc))( (tOptions*)2UL, p ); - printEntry( fp, p, (void*)(p->optArg.argString)); - - if ( (p->optArg.argString != NULL) - && (arg_state != OPARG_TYPE_ENUMERATION)) { - /* - * set membership strings get allocated - */ - AGFREE( (void*)p->optArg.argString ); - p->fOptState &= ~OPTST_ALLOC_ARG; - } + printEnumArg(fp, p); + break; - p->optArg.argEnum = val; + case OPARG_TYPE_MEMBERSHIP: + printSetMemberArg(fp, p); break; - } case OPARG_TYPE_BOOLEAN: - printEntry( fp, p, p->optArg.argBool ? "true" : "false" ); + printEntry(fp, p, p->optArg.argBool ? "true" : "false"); + break; + + case OPARG_TYPE_HIERARCHY: + printHierarchy(fp, p); + break; + + case OPARG_TYPE_FILE: + printFileArg(fp, p, pOpts); break; default: break; /* cannot handle - skip it */ } - } while ( (pOD++), (--ct > 0)); + } while (pOD++, (--ct > 0)); - fclose( fp ); + fclose(fp); } /* * Local Variables: diff --git a/sntp/libopts/sort.c b/sntp/libopts/sort.c index ead7133..6291db1 100644 --- a/sntp/libopts/sort.c +++ b/sntp/libopts/sort.c @@ -1,67 +1,44 @@ /* - * sort.c $Id: sort.c,v 4.10 2007/04/28 22:19:23 bkorb Exp $ - * Time-stamp: "2006-10-18 11:29:04 bkorb" + * \file sort.c * - * This module implements argument sorting. - */ - -/* - * Automated Options copyright 1992-2007 Bruce Korb - * - * Automated Options is free software. - * You may 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. + * Time-stamp: "2010-07-17 10:34:15 bkorb" * - * Automated Options 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. + * This module implements argument sorting. * - * You should have received a copy of the GNU General Public License - * along with Automated Options. See the file "COPYING". If not, - * write to: The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * This file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved * - * As a special exception, Bruce Korb gives permission for additional - * uses of the text contained in his release of AutoOpts. + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. * - * The exception is that, if you link the AutoOpts library with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the AutoOpts library code into it. + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" * - * This exception applies only to the code released by Bruce Korb under - * the name AutoOpts. If you copy code from other sources under the - * General Public License into a copy of AutoOpts, as the General Public - * License permits, the exception does not apply to the code that you add - * in this way. To avoid misleading anyone as to the status of such - * modified files, you must delete this exception notice from them. + * These files have the following md5sums: * - * If you write modifications of your own for AutoOpts, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd */ /* = = = START-STATIC-FORWARD = = = */ -/* static forward declarations maintained by :mkfwd */ static tSuccess -mustHandleArg( tOptions* pOpts, char* pzArg, tOptState* pOS, - char** ppzOpts, int* pOptsIdx ); +mustHandleArg(tOptions* pOpts, char* pzArg, tOptState* pOS, + char** ppzOpts, int* pOptsIdx); static tSuccess -mayHandleArg( tOptions* pOpts, char* pzArg, tOptState* pOS, - char** ppzOpts, int* pOptsIdx ); +mayHandleArg(tOptions* pOpts, char* pzArg, tOptState* pOS, + char** ppzOpts, int* pOptsIdx); static tSuccess -checkShortOpts( tOptions* pOpts, char* pzArg, tOptState* pOS, - char** ppzOpts, int* pOptsIdx ); +checkShortOpts(tOptions* pOpts, char* pzArg, tOptState* pOS, + char** ppzOpts, int* pOptsIdx); /* = = = END-STATIC-FORWARD = = = */ /* @@ -70,8 +47,8 @@ checkShortOpts( tOptions* pOpts, char* pzArg, tOptState* pOS, * does not start with a hyphen and "must" will consume it, hyphen or not. */ static tSuccess -mustHandleArg( tOptions* pOpts, char* pzArg, tOptState* pOS, - char** ppzOpts, int* pOptsIdx ) +mustHandleArg(tOptions* pOpts, char* pzArg, tOptState* pOS, + char** ppzOpts, int* pOptsIdx) { /* * An option argument is required. Long options can either have @@ -108,8 +85,8 @@ mustHandleArg( tOptions* pOpts, char* pzArg, tOptState* pOS, } static tSuccess -mayHandleArg( tOptions* pOpts, char* pzArg, tOptState* pOS, - char** ppzOpts, int* pOptsIdx ) +mayHandleArg(tOptions* pOpts, char* pzArg, tOptState* pOS, + char** ppzOpts, int* pOptsIdx) { /* * An option argument is optional. @@ -151,11 +128,11 @@ mayHandleArg( tOptions* pOpts, char* pzArg, tOptState* pOS, * does or may take an argument, the do the argument processing and leave. */ static tSuccess -checkShortOpts( tOptions* pOpts, char* pzArg, tOptState* pOS, - char** ppzOpts, int* pOptsIdx ) +checkShortOpts(tOptions* pOpts, char* pzArg, tOptState* pOS, + char** ppzOpts, int* pOptsIdx) { while (*pzArg != NUL) { - if (FAILED( shortOptionFind( pOpts, (tAoUC)*pzArg, pOS ))) + if (FAILED(shortOptionFind(pOpts, (tAoUC)*pzArg, pOS))) return FAILURE; /* @@ -200,7 +177,7 @@ checkShortOpts( tOptions* pOpts, char* pzArg, tOptState* pOS, * then this routine will to the trick. */ LOCAL void -optionSort( tOptions* pOpts ) +optionSort(tOptions* pOpts) { char** ppzOpts; char** ppzOpds; @@ -212,20 +189,20 @@ optionSort( tOptions* pOpts ) /* * Disable for POSIX conformance, or if there are no operands. */ - if ( (getenv( "POSIXLY_CORRECT" ) != NULL) + if ( (getenv("POSIXLY_CORRECT") != NULL) || NAMED_OPTS(pOpts)) return; /* * Make sure we can allocate two full-sized arg vectors. */ - ppzOpts = malloc( pOpts->origArgCt * sizeof( char* )); + ppzOpts = malloc(pOpts->origArgCt * sizeof(char*)); if (ppzOpts == NULL) goto exit_no_mem; - ppzOpds = malloc( pOpts->origArgCt * sizeof( char* )); + ppzOpds = malloc(pOpts->origArgCt * sizeof(char*)); if (ppzOpds == NULL) { - free( ppzOpts ); + free(ppzOpts); goto exit_no_mem; } @@ -274,7 +251,7 @@ optionSort( tOptions* pOpts ) pOpts->origArgVect[ (pOpts->curOptIdx)++ ]; goto restOperands; } - res = longOptionFind( pOpts, pzArg+2, &os ); + res = longOptionFind(pOpts, pzArg+2, &os); break; default: @@ -284,13 +261,13 @@ optionSort( tOptions* pOpts ) * short (i.e. single character) option. */ if ((pOpts->fOptSet & OPTPROC_SHORTOPT) == 0) { - res = longOptionFind( pOpts, pzArg+1, &os ); + res = longOptionFind(pOpts, pzArg+1, &os); } else { - res = shortOptionFind( pOpts, (tAoUC)pzArg[1], &os ); + res = shortOptionFind(pOpts, (tAoUC)pzArg[1], &os); } break; } - if (FAILED( res )) { + if (FAILED(res)) { errno = EINVAL; goto freeTemps; } @@ -309,20 +286,20 @@ optionSort( tOptions* pOpts ) * of the argument string. */ if ( (os.optType == TOPT_SHORT) - && FAILED( checkShortOpts( pOpts, pzArg+2, &os, - ppzOpts, &optsIdx )) ) { + && FAILED(checkShortOpts(pOpts, pzArg+2, &os, ppzOpts, + &optsIdx)) ) { errno = EINVAL; goto freeTemps; } } else if (os.pOD->fOptState & OPTST_ARG_OPTIONAL) { - switch (mayHandleArg( pOpts, pzArg+2, &os, ppzOpts, &optsIdx )) { + switch (mayHandleArg(pOpts, pzArg+2, &os, ppzOpts, &optsIdx)) { case FAILURE: errno = EIO; goto freeTemps; case PROBLEM: errno = 0; goto joinLists; } } else { - switch (mustHandleArg( pOpts, pzArg+2, &os, ppzOpts, &optsIdx )) { + switch (mustHandleArg(pOpts, pzArg+2, &os, ppzOpts, &optsIdx)) { case PROBLEM: case FAILURE: errno = EIO; goto freeTemps; } @@ -335,14 +312,14 @@ optionSort( tOptions* pOpts ) joinLists: if (optsIdx > 0) - memcpy( pOpts->origArgVect + 1, ppzOpts, optsIdx * sizeof( char* )); + memcpy(pOpts->origArgVect + 1, ppzOpts, optsIdx * sizeof(char*)); if (opdsIdx > 0) - memcpy( pOpts->origArgVect + 1 + optsIdx, - ppzOpds, opdsIdx * sizeof( char* )); + memcpy(pOpts->origArgVect + 1 + optsIdx, ppzOpds, + opdsIdx * sizeof(char*)); freeTemps: - free( ppzOpts ); - free( ppzOpds ); + free(ppzOpts); + free(ppzOpds); return; exit_no_mem: diff --git a/sntp/libopts/stack.c b/sntp/libopts/stack.c index 6d77f72..d930772 100644 --- a/sntp/libopts/stack.c +++ b/sntp/libopts/stack.c @@ -1,54 +1,31 @@ -/* - * stack.c - * $Id: stack.c,v 4.13 2007/02/04 17:44:12 bkorb Exp $ - * Time-stamp: "2007-01-13 10:43:21 bkorb" +/** + * \file stack.c + * + * Time-stamp: "2010-07-17 10:42:27 bkorb" * * This is a special option processing routine that will save the * argument to an option in a FIFO queue. - */ - -/* - * Automated Options copyright 1992-2007 Bruce Korb * - * Automated Options is free software. - * You may 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 file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved * - * Automated Options 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. + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. * - * You should have received a copy of the GNU General Public License - * along with Automated Options. See the file "COPYING". If not, - * write to: The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" * - * As a special exception, Bruce Korb gives permission for additional - * uses of the text contained in his release of AutoOpts. + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" * - * The exception is that, if you link the AutoOpts library with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the AutoOpts library code into it. + * These files have the following md5sums: * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. - * - * This exception applies only to the code released by Bruce Korb under - * the name AutoOpts. If you copy code from other sources under the - * General Public License into a copy of AutoOpts, as the General Public - * License permits, the exception does not apply to the code that you add - * in this way. To avoid misleading anyone as to the status of such - * modified files, you must delete this exception notice from them. - * - * If you write modifications of your own for AutoOpts, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd */ #ifdef WITH_LIBREGEX @@ -72,14 +49,19 @@ optionUnstackArg( { int res; - tArgList* pAL = (tArgList*)pOptDesc->optCookie; + tArgList* pAL; + + if ((pOptDesc->fOptState & OPTST_RESET) != 0) + return; + pAL = (tArgList*)pOptDesc->optCookie; + /* * IF we don't have any stacked options, * THEN indicate that we don't have any of these options */ if (pAL == NULL) { pOptDesc->fOptState &= OPTST_PERSISTENT_MASK; - if ( (pOptDesc->fOptState & OPTST_INITENABLED) == 0) + if ((pOptDesc->fOptState & OPTST_INITENABLED) == 0) pOptDesc->fOptState |= OPTST_DISABLED; return; } @@ -89,7 +71,7 @@ optionUnstackArg( regex_t re; int i, ct, dIdx; - if (regcomp( &re, pOptDesc->optArg.argString, REG_NOSUB ) != 0) + if (regcomp(&re, pOptDesc->optArg.argString, REG_NOSUB) != 0) return; /* @@ -100,12 +82,12 @@ optionUnstackArg( */ for (i = 0, dIdx = 0, ct = pAL->useCt; --ct >= 0; i++) { tCC* pzSrc = pAL->apzArgs[ i ]; - char* pzEq = strchr( pzSrc, '=' ); + char* pzEq = strchr(pzSrc, '='); if (pzEq != NULL) *pzEq = NUL; - res = regexec( &re, pzSrc, (size_t)0, NULL, 0 ); + res = regexec(&re, pzSrc, (size_t)0, NULL, 0); switch (res) { case 0: /* @@ -132,7 +114,7 @@ optionUnstackArg( } } - regfree( &re ); + regfree(&re); } #else /* not WITH_LIBREGEX */ { @@ -146,12 +128,12 @@ optionUnstackArg( */ for (i = 0, dIdx = 0, ct = pAL->useCt; --ct >= 0; i++) { tCC* pzSrc = pAL->apzArgs[ i ]; - char* pzEq = strchr( pzSrc, '=' ); + char* pzEq = strchr(pzSrc, '='); if (pzEq != NULL) *pzEq = NUL; - if (strcmp( pzSrc, pOptDesc->optArg.argString ) == 0) { + if (strcmp(pzSrc, pOptDesc->optArg.argString) == 0) { /* * Remove this entry by reducing the in-use count * and *not* putting the string pointer back into @@ -180,9 +162,9 @@ optionUnstackArg( */ if (pAL->useCt == 0) { pOptDesc->fOptState &= OPTST_PERSISTENT_MASK; - if ( (pOptDesc->fOptState & OPTST_INITENABLED) == 0) + if ((pOptDesc->fOptState & OPTST_INITENABLED) == 0) pOptDesc->fOptState |= OPTST_DISABLED; - AGFREE( (void*)pAL ); + AGFREE((void*)pAL); pOptDesc->optCookie = NULL; } } @@ -194,7 +176,7 @@ optionUnstackArg( * as an opaque address. */ LOCAL void -addArgListEntry( void** ppAL, void* entry ) +addArgListEntry(void** ppAL, void* entry) { tArgList* pAL = *(void**)ppAL; @@ -203,7 +185,7 @@ addArgListEntry( void** ppAL, void* entry ) * THEN allocate one now */ if (pAL == NULL) { - pAL = (tArgList*)AGALOC( sizeof( *pAL ), "new option arg stack" ); + pAL = (tArgList*)AGALOC(sizeof(*pAL), "new option arg stack"); if (pAL == NULL) return; pAL->useCt = 0; @@ -216,7 +198,7 @@ addArgListEntry( void** ppAL, void* entry ) * THEN make it bigger */ else if (pAL->useCt >= pAL->allocCt) { - size_t sz = sizeof( *pAL ); + size_t sz = sizeof(*pAL); pAL->allocCt += INCR_ARG_ALLOC_CT; /* @@ -224,7 +206,7 @@ addArgListEntry( void** ppAL, void* entry ) * pointers. We subtract it off to find our augment size. */ sz += sizeof(char*) * (pAL->allocCt - MIN_ARG_ALLOC_CT); - pAL = (tArgList*)AGREALOC( (void*)pAL, sz, "expanded opt arg stack" ); + pAL = (tArgList*)AGREALOC((void*)pAL, sz, "expanded opt arg stack"); if (pAL == NULL) return; *ppAL = (void*)pAL; @@ -254,11 +236,24 @@ optionStackArg( { char * pz; - if (pOD->optArg.argString == NULL) - return; + if ((pOD->fOptState & OPTST_RESET) != 0) { + tArgList* pAL = (void*)pOD->optCookie; + int ix; + if (pAL == NULL) + return; - AGDUPSTR(pz, pOD->optArg.argString, "stack arg"); - addArgListEntry( &(pOD->optCookie), (void*)pz ); + ix = pAL->useCt; + while (--ix >= 0) + AGFREE(pAL->apzArgs[ix]); + AGFREE(pAL); + + } else { + if (pOD->optArg.argString == NULL) + return; + + AGDUPSTR(pz, pOD->optArg.argString, "stack arg"); + addArgListEntry(&(pOD->optCookie), (void*)pz); + } } /* * Local Variables: diff --git a/sntp/libopts/streqvcmp.c b/sntp/libopts/streqvcmp.c index 8249794..d2cb65d 100644 --- a/sntp/libopts/streqvcmp.c +++ b/sntp/libopts/streqvcmp.c @@ -1,7 +1,8 @@ -/* - * $Id: streqvcmp.c,v 4.10 2007/04/28 22:19:23 bkorb Exp $ - * Time-stamp: "2006-07-26 18:25:53 bkorb" +/** + * \file streqvcmp.c + * + * Time-stamp: "2010-07-17 10:16:24 bkorb" * * String Equivalence Comparison * @@ -9,52 +10,27 @@ * character before comparison. In processing long option names, * the characters "-", "_" and "^" all need to be equivalent * (because they are treated so by different development environments). - */ - -/* - * Automated Options copyright 1992-2007 Bruce Korb - * - * Automated Options is free software. - * You may 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. - * - * Automated Options 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 Automated Options. See the file "COPYING". If not, - * write to: The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - * As a special exception, Bruce Korb gives permission for additional - * uses of the text contained in his release of AutoOpts. - * - * The exception is that, if you link the AutoOpts library with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the AutoOpts library code into it. - * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. - * - * This exception applies only to the code released by Bruce Korb under - * the name AutoOpts. If you copy code from other sources under the - * General Public License into a copy of AutoOpts, as the General Public - * License permits, the exception does not apply to the code that you add - * in this way. To avoid misleading anyone as to the status of such - * modified files, you must delete this exception notice from them. - * - * If you write modifications of your own for AutoOpts, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. - */ - -/* + * + * This file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved + * + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. + * + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" + * + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" + * + * These files have the following md5sums: + * + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * * This array is designed for mapping upper and lower case letter * together for a case independent comparison. The mappings are * based upon ascii character sequences. @@ -122,7 +98,7 @@ static unsigned char charmap[] = { * err: none checked. Caller responsible for seg faults. =*/ int -strneqvcmp( tCC* s1, tCC* s2, int ct ) +strneqvcmp(tCC* s1, tCC* s2, int ct) { for (; ct > 0; --ct) { unsigned char u1 = (unsigned char) *s1++; @@ -161,7 +137,7 @@ strneqvcmp( tCC* s1, tCC* s2, int ct ) * err: none checked. Caller responsible for seg faults. =*/ int -streqvcmp( tCC* s1, tCC* s2 ) +streqvcmp(tCC* s1, tCC* s2) { for (;;) { unsigned char u1 = (unsigned char) *s1++; @@ -194,7 +170,7 @@ streqvcmp( tCC* s1, tCC* s2 ) * are incremented and the process repeated until @code{ct} entries have been * set. For example, * @example - * streqvmap( 'a', 'A', 26 ); + * streqvmap('a', 'A', 26); * @end example * @noindent * will alter the mapping so that all English lower case letters @@ -206,10 +182,10 @@ streqvcmp( tCC* s1, tCC* s2 ) * err: none. =*/ void -streqvmap( char From, char To, int ct ) +streqvmap(char From, char To, int ct) { if (ct == 0) { - ct = sizeof( charmap ) - 1; + ct = sizeof(charmap) - 1; do { charmap[ ct ] = ct; } while (--ct >= 0); @@ -223,7 +199,7 @@ streqvmap( char From, char To, int ct ) charmap[ chFrom ] = (unsigned)chTo; chFrom++; chTo++; - if ((chFrom >= sizeof( charmap )) || (chTo >= sizeof( charmap ))) + if ((chFrom >= sizeof(charmap)) || (chTo >= sizeof(charmap))) break; } while (--ct > 0); } @@ -246,7 +222,7 @@ streqvmap( char From, char To, int ct ) * err: none. =*/ void -strequate( char const* s ) +strequate(char const* s) { if ((s != NULL) && (*s != NUL)) { unsigned char equiv = (unsigned)*s; @@ -270,10 +246,12 @@ strequate( char const* s ) * This function name is mapped to option_strtransform so as to not conflict * with the POSIX name space. * + * The source and destination may be the same. + * * err: none. =*/ void -strtransform( char* d, char const* s ) +strtransform(char* d, char const* s) { do { *(d++) = (char)charmap[ (unsigned)*s ]; diff --git a/sntp/libopts/text_mmap.c b/sntp/libopts/text_mmap.c index ced2977..01aa7d8 100644 --- a/sntp/libopts/text_mmap.c +++ b/sntp/libopts/text_mmap.c @@ -1,7 +1,27 @@ -/* - * $Id: text_mmap.c,v 4.15 2006/11/27 01:52:23 bkorb Exp $ +/** + * \file text_mmap.c + * + * Time-stamp: "2010-07-17 10:15:32 bkorb" + * + * This file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved + * + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. + * + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" + * + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" + * + * These files have the following md5sums: * - * Time-stamp: "2006-09-10 14:50:04 bkorb" + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd */ #ifndef MAP_ANONYMOUS @@ -70,16 +90,16 @@ * #include <mylib.h> * tmap_info_t mi; * int no_nul; - * void* data = text_mmap( "file", PROT_WRITE, MAP_PRIVATE, &mi ); + * void* data = text_mmap("file", PROT_WRITE, MAP_PRIVATE, &mi); * if (data == MAP_FAILED) return; * no_nul = (mi.txt_size == mi.txt_full_size); * << use the data >> - * text_munmap( &mi ); + * text_munmap(&mi); =*/ void* -text_mmap( char const* pzFile, int prot, int flags, tmap_info_t* pMI ) +text_mmap(char const* pzFile, int prot, int flags, tmap_info_t* pMI) { - memset( pMI, 0, sizeof(*pMI) ); + memset(pMI, 0, sizeof(*pMI)); #ifdef HAVE_MMAP pMI->txt_zero_fd = -1; #endif @@ -90,12 +110,12 @@ text_mmap( char const* pzFile, int prot, int flags, tmap_info_t* pMI ) */ { struct stat sb; - if (stat( pzFile, &sb ) != 0) { + if (stat(pzFile, &sb) != 0) { pMI->txt_errno = errno; return MAP_FAILED_PTR; } - if (! S_ISREG( sb.st_mode )) { + if (! S_ISREG(sb.st_mode)) { pMI->txt_errno = errno = EINVAL; return MAP_FAILED_PTR; } @@ -126,7 +146,7 @@ text_mmap( char const* pzFile, int prot, int flags, tmap_info_t* pMI ) if (((flags & MAP_SHARED) == 0) && (prot & PROT_WRITE)) o_flag |= O_EXCL; - pMI->txt_fd = open( pzFile, o_flag ); + pMI->txt_fd = open(pzFile, o_flag); } if (pMI->txt_fd == AO_INVALID_FD) { @@ -187,7 +207,7 @@ text_mmap( char const* pzFile, int prot, int flags, tmap_info_t* pMI ) pMI->txt_errno = errno; #elif defined(HAVE_DEV_ZERO) - pMI->txt_zero_fd = open( "/dev/zero", O_RDONLY ); + pMI->txt_zero_fd = open("/dev/zero", O_RDONLY); if (pMI->txt_zero_fd == AO_INVALID_FD) { pMI->txt_errno = errno; @@ -202,7 +222,7 @@ text_mmap( char const* pzFile, int prot, int flags, tmap_info_t* pMI ) return pMI->txt_data; pMI->txt_errno = errno; - close( pMI->txt_zero_fd ); + close(pMI->txt_zero_fd); pMI->txt_zero_fd = -1; } #endif @@ -211,8 +231,8 @@ text_mmap( char const* pzFile, int prot, int flags, tmap_info_t* pMI ) } { - void* p = AGALOC( pMI->txt_size+1, "file text" ); - memcpy( p, pMI->txt_data, pMI->txt_size ); + void* p = AGALOC(pMI->txt_size+1, "file text"); + memcpy(p, pMI->txt_data, pMI->txt_size); ((char*)p)[pMI->txt_size] = NUL; munmap(pMI->txt_data, pMI->txt_size ); pMI->txt_data = p; @@ -222,7 +242,7 @@ text_mmap( char const* pzFile, int prot, int flags, tmap_info_t* pMI ) #else /* * * * * * no HAVE_MMAP * * * * * */ - pMI->txt_data = AGALOC( pMI->txt_size+1, "file text" ); + pMI->txt_data = AGALOC(pMI->txt_size+1, "file text"); if (pMI->txt_data == NULL) { pMI->txt_errno = ENOMEM; goto fail_return; @@ -233,12 +253,12 @@ text_mmap( char const* pzFile, int prot, int flags, tmap_info_t* pMI ) char* pz = pMI->txt_data; while (sz > 0) { - ssize_t rdct = read( pMI->txt_fd, pz, sz ); + ssize_t rdct = read(pMI->txt_fd, pz, sz); if (rdct <= 0) { pMI->txt_errno = errno; - fprintf( stderr, zFSErrReadFile, - errno, strerror( errno ), pzFile ); - free( pMI->txt_data ); + fprintf(stderr, zFSErrReadFile, + errno, strerror(errno), pzFile); + free(pMI->txt_data); goto fail_return; } @@ -261,7 +281,7 @@ text_mmap( char const* pzFile, int prot, int flags, tmap_info_t* pMI ) fail_return: if (pMI->txt_fd >= 0) { - close( pMI->txt_fd ); + close(pMI->txt_fd); pMI->txt_fd = -1; } errno = pMI->txt_errno; @@ -290,7 +310,7 @@ text_mmap( char const* pzFile, int prot, int flags, tmap_info_t* pMI ) * err: Any error code issued by munmap(2) or close(2) is possible. =*/ int -text_munmap( tmap_info_t* pMI ) +text_munmap(tmap_info_t* pMI) { #ifdef HAVE_MMAP int res = 0; @@ -306,26 +326,26 @@ text_munmap( tmap_info_t* pMI ) if (lseek(pMI->txt_fd, (size_t)0, SEEK_SET) != 0) goto error_return; - res = (write( pMI->txt_fd, pMI->txt_data, pMI->txt_size ) < 0) + res = (write(pMI->txt_fd, pMI->txt_data, pMI->txt_size) < 0) ? errno : 0; } - AGFREE( pMI->txt_data ); + AGFREE(pMI->txt_data); errno = res; } else { - res = munmap( pMI->txt_data, pMI->txt_full_size ); + res = munmap(pMI->txt_data, pMI->txt_full_size); } if (res != 0) goto error_return; - res = close( pMI->txt_fd ); + res = close(pMI->txt_fd); if (res != 0) goto error_return; pMI->txt_fd = -1; errno = 0; if (pMI->txt_zero_fd != -1) { - res = close( pMI->txt_zero_fd ); + res = close(pMI->txt_zero_fd); pMI->txt_zero_fd = -1; } @@ -341,14 +361,14 @@ text_munmap( tmap_info_t* pMI ) * THEN rewrite the data. */ if ( FILE_WRITABLE(pMI->txt_prot, pMI->txt_flags) - && (lseek( pMI->txt_fd, 0, SEEK_SET ) >= 0) ) { - write( pMI->txt_fd, pMI->txt_data, pMI->txt_size ); + && (lseek(pMI->txt_fd, 0, SEEK_SET) >= 0) ) { + write(pMI->txt_fd, pMI->txt_data, pMI->txt_size); } - close( pMI->txt_fd ); + close(pMI->txt_fd); pMI->txt_fd = -1; pMI->txt_errno = errno; - free( pMI->txt_data ); + free(pMI->txt_data); return pMI->txt_errno; #endif /* HAVE_MMAP */ diff --git a/sntp/libopts/time.c b/sntp/libopts/time.c new file mode 100644 index 0000000..656c78d --- /dev/null +++ b/sntp/libopts/time.c @@ -0,0 +1,137 @@ + +/** + * \file time.c + * + * Time-stamp: "2011-03-06 11:52:23 bkorb" + * + * This file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved + * + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. + * + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" + * + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" + * + * These files have the following md5sums: + * + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + */ + +/*=export_func optionTimeVal + * private: + * + * what: process an option with a time duration. + * arg: + tOptions* + pOpts + program options descriptor + + * arg: + tOptDesc* + pOptDesc + the descriptor for this arg + + * + * doc: + * Decipher a time duration value. +=*/ +void +optionTimeVal(tOptions * pOpts, tOptDesc * pOD) +{ + time_t val; + + if ((pOD->fOptState & OPTST_RESET) != 0) + return; + + val = parse_duration(pOD->optArg.argString); + if (val == BAD_TIME) { + fprintf(stderr, zNotDuration, pOpts->pzProgName, pOD->optArg.argString); + if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0) + (*(pOpts->pUsageProc))(pOpts, EXIT_FAILURE); + } + + if (pOD->fOptState & OPTST_ALLOC_ARG) { + AGFREE(pOD->optArg.argString); + pOD->fOptState &= ~OPTST_ALLOC_ARG; + } + + pOD->optArg.argInt = val; +} + +/*=export_func optionTimeDate + * private: + * + * what: process an option with a time and date. + * arg: + tOptions* + pOpts + program options descriptor + + * arg: + tOptDesc* + pOptDesc + the descriptor for this arg + + * + * doc: + * Decipher a time and date value. +=*/ +void +optionTimeDate(tOptions * pOpts, tOptDesc * pOD) +{ +#if defined(HAVE_GETDATE_R) && defined(HAVE_PUTENV) + if ((! HAS_pzPkgDataDir(pOpts)) || (pOpts->pzPkgDataDir == NULL)) + goto default_action; + + /* + * Export the DATEMSK environment variable. getdate_r() uses it to + * find the file with the strptime formats. If we cannot find the file + * we need ($PKGDATADIR/datemsk), then fall back to just a time duration. + */ + { + static char * envptr = NULL; + + if (envptr == NULL) { + static char const fmt[] = "DATEMSK=%s/datemsk"; + envptr = AGALOC(sizeof(fmt) + strlen(pOpts->pzPkgDataDir), fmt); + sprintf(envptr, fmt, pOpts->pzPkgDataDir); + + putenv(envptr); + } + + if (access(envptr+8, R_OK) != 0) + goto default_action; + } + + /* + * Convert the date to a time since the epoch and stash it in a long int. + */ + { + struct tm stm; + time_t tm; + + if (getdate_r(pOD->optArg.argString, &stm) != 0) { + fprintf(stderr, zNotDate, pOpts->pzProgName, + pOD->optArg.argString); + if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0) + (*(pOpts->pUsageProc))(pOpts, EXIT_FAILURE); + return; + } + + tm = mktime(&stm); + + if (pOD->fOptState & OPTST_ALLOC_ARG) { + AGFREE(pOD->optArg.argString); + pOD->fOptState &= ~OPTST_ALLOC_ARG; + } + + pOD->optArg.argInt = tm; + } + return; + +default_action: + +#endif + optionTimeVal(pOpts, pOD); + if (pOD->optArg.argInt != BAD_TIME) + pOD->optArg.argInt += (unsigned long)time(NULL); +} +/* + * Local Variables: + * mode: C + * c-file-style: "stroustrup" + * indent-tabs-mode: nil + * End: + * end of autoopts/time.c */ diff --git a/sntp/libopts/tokenize.c b/sntp/libopts/tokenize.c index 0e576ce..4ca1245 100644 --- a/sntp/libopts/tokenize.c +++ b/sntp/libopts/tokenize.c @@ -1,26 +1,28 @@ /* * This file defines the string_tokenize interface - * Time-stamp: "2006-06-24 15:27:49 bkorb" + * Time-stamp: "2010-07-17 10:40:26 bkorb" * - * string_tokenize copyright 2005 Bruce Korb + * This file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved * - * string_tokenize is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. * - * string_tokenize is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" * - * You should have received a copy of the GNU Lesser General Public - * License along with string_tokenize; if not, write to: - * The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" + * + * These files have the following md5sums: + * + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd */ -#include <ctype.h> + #include <errno.h> #include <stdlib.h> @@ -28,16 +30,18 @@ #define ch_t unsigned char /* = = = START-STATIC-FORWARD = = = */ -/* static forward declarations maintained by :mkfwd */ static void -copy_cooked( ch_t** ppDest, char const ** ppSrc ); +copy_cooked(ch_t** ppDest, char const ** ppSrc); static void -copy_raw( ch_t** ppDest, char const ** ppSrc ); +copy_raw(ch_t** ppDest, char const ** ppSrc); + +static token_list_t * +alloc_token_list(char const * str); /* = = = END-STATIC-FORWARD = = = */ static void -copy_cooked( ch_t** ppDest, char const ** ppSrc ) +copy_cooked(ch_t** ppDest, char const ** ppSrc) { ch_t* pDest = (ch_t*)*ppDest; const ch_t* pSrc = (const ch_t*)(*ppSrc + 1); @@ -48,7 +52,7 @@ copy_cooked( ch_t** ppDest, char const ** ppSrc ) case NUL: *ppSrc = NULL; return; case '"': goto done; case '\\': - pSrc += ao_string_cook_escape_char( (char*)pSrc, (char*)&ch, 0x7F ); + pSrc += ao_string_cook_escape_char((char*)pSrc, (char*)&ch, 0x7F); if (ch == 0x7F) break; /* FALLTHROUGH */ @@ -65,7 +69,7 @@ copy_cooked( ch_t** ppDest, char const ** ppSrc ) static void -copy_raw( ch_t** ppDest, char const ** ppSrc ) +copy_raw(ch_t** ppDest, char const ** ppSrc) { ch_t* pDest = *ppDest; cc_t* pSrc = (cc_t*) (*ppSrc + 1); @@ -111,6 +115,53 @@ copy_raw( ch_t** ppDest, char const ** ppSrc ) *ppSrc = (char const *) pSrc; /* char following closing quote */ } +static token_list_t * +alloc_token_list(char const * str) +{ + token_list_t * res; + + int max_token_ct = 2; /* allow for trailing NULL pointer & NUL on string */ + + if (str == NULL) goto enoent_res; + + /* + * Trim leading white space. Use "ENOENT" and a NULL return to indicate + * an empty string was passed. + */ + while (IS_WHITESPACE_CHAR(*str)) str++; + if (*str == NUL) goto enoent_res; + + /* + * Take an approximate count of tokens. If no quoted strings are used, + * it will be accurate. If quoted strings are used, it will be a little + * high and we'll squander the space for a few extra pointers. + */ + { + cc_t* pz = (cc_t*)str; + + do { + max_token_ct++; + while (! IS_WHITESPACE_CHAR(*++pz)) + if (*pz == NUL) goto found_nul; + while (IS_WHITESPACE_CHAR(*pz)) pz++; + } while (*pz != NUL); + + found_nul: + res = malloc(sizeof(*res) + (pz - (cc_t*)str) + + (max_token_ct * sizeof(ch_t*))); + } + + if (res == NULL) + errno = ENOMEM; + else res->tkn_list[0] = (ch_t*)(res->tkn_list + (max_token_ct - 1)); + + return res; + + enoent_res: + + errno = ENOENT; + return NULL; +} /*=export_func ao_string_tokenize * @@ -159,10 +210,10 @@ copy_raw( ch_t** ppDest, char const ** ppSrc ) * @example * #include <stdlib.h> * int ix; - * token_list_t* ptl = ao_string_tokenize( some_string ) + * token_list_t* ptl = ao_string_tokenize(some_string) * for (ix = 0; ix < ptl->tkn_ct; ix++) - * do_something_with_tkn( ptl->tkn_list[ix] ); - * free( ptl ); + * do_something_with_tkn(ptl->tkn_list[ix]); + * free(ptl); * @end example * Note that everything is freed with the one call to @code{free(3C)}. * @@ -178,106 +229,69 @@ copy_raw( ch_t** ppDest, char const ** ppSrc ) * @end itemize =*/ token_list_t* -ao_string_tokenize( char const* str ) +ao_string_tokenize(char const* str) { - int max_token_ct = 1; /* allow for trailing NUL on string */ - token_list_t* res; - - if (str == NULL) goto bogus_str; - - /* - * Trim leading white space. Use "ENOENT" and a NULL return to indicate - * an empty string was passed. - */ - while (isspace( (ch_t)*str )) str++; - if (*str == NUL) { - bogus_str: - errno = ENOENT; - return NULL; - } + token_list_t* res = alloc_token_list(str); + ch_t* pzDest; /* - * Take an approximate count of tokens. If no quoted strings are used, - * it will be accurate. If quoted strings are used, it will be a little - * high and we'll squander the space for a few extra pointers. + * Now copy each token into the output buffer. */ - { - cc_t* pz = (cc_t*)str; - - do { - max_token_ct++; - while (! isspace( *++pz )) - if (*pz == NUL) goto found_nul; - while (isspace( *pz )) pz++; - } while (*pz != NUL); + if (res == NULL) + return res; - found_nul: - ; - } + pzDest = (ch_t*)(res->tkn_list[0]); + res->tkn_ct = 0; - res = malloc( sizeof(*res) + strlen(str) + (max_token_ct * sizeof(ch_t*)) ); - if (res == NULL) { - errno = ENOMEM; - return res; - } + do { + res->tkn_list[ res->tkn_ct++ ] = pzDest; + for (;;) { + int ch = (ch_t)*str; + if (IS_WHITESPACE_CHAR(ch)) { + found_white_space: + while (IS_WHITESPACE_CHAR(*++str)) ; + break; + } - /* - * Now copy each token into the output buffer. - */ - { - ch_t* pzDest = (ch_t*)(res->tkn_list + (max_token_ct + 1)); - res->tkn_ct = 0; - - do { - res->tkn_list[ res->tkn_ct++ ] = pzDest; - for (;;) { - int ch = (ch_t)*str; - if (isspace( ch )) { - found_white_space: - while (isspace( (ch_t)*++str )) ; - break; + switch (ch) { + case '"': + copy_cooked(&pzDest, &str); + if (str == NULL) { + free(res); + errno = EINVAL; + return NULL; } + if (IS_WHITESPACE_CHAR(*str)) + goto found_white_space; + break; - switch (ch) { - case '"': - copy_cooked( &pzDest, &str ); - if (str == NULL) { - free(res); - errno = EINVAL; - return NULL; - } - if (isspace( (ch_t)*str )) - goto found_white_space; - break; - - case '\'': - copy_raw( &pzDest, &str ); - if (str == NULL) { - free(res); - errno = EINVAL; - return NULL; - } - if (isspace( (ch_t)*str )) - goto found_white_space; - break; - - case NUL: - goto copy_done; - - default: - str++; - *(pzDest++) = ch; + case '\'': + copy_raw(&pzDest, &str); + if (str == NULL) { + free(res); + errno = EINVAL; + return NULL; } - } copy_done:; + if (IS_WHITESPACE_CHAR(*str)) + goto found_white_space; + break; - /* - * NUL terminate the last token and see if we have any more tokens. - */ - *(pzDest++) = NUL; - } while (*str != NUL); + case NUL: + goto copy_done; - res->tkn_list[ res->tkn_ct ] = NULL; - } + default: + str++; + *(pzDest++) = ch; + } + } copy_done:; + + /* + * NUL terminate the last token and see if we have any more tokens. + */ + *(pzDest++) = NUL; + } while (*str != NUL); + + res->tkn_list[ res->tkn_ct ] = NULL; return res; } @@ -287,7 +301,7 @@ ao_string_tokenize( char const* str ) #include <string.h> int -main( int argc, char** argv ) +main(int argc, char** argv) { if (argc == 1) { printf("USAGE: %s arg [ ... ]\n", *argv); @@ -295,15 +309,15 @@ main( int argc, char** argv ) } while (--argc > 0) { char* arg = *(++argv); - token_list_t* p = ao_string_tokenize( arg ); + token_list_t* p = ao_string_tokenize(arg); if (p == NULL) { - printf( "Parsing string ``%s'' failed:\n\terrno %d (%s)\n", - arg, errno, strerror( errno )); + printf("Parsing string ``%s'' failed:\n\terrno %d (%s)\n", + arg, errno, strerror(errno)); } else { int ix = 0; - printf( "Parsed string ``%s''\ninto %d tokens:\n", arg, p->tkn_ct ); + printf("Parsed string ``%s''\ninto %d tokens:\n", arg, p->tkn_ct); do { - printf( " %3d: ``%s''\n", ix+1, p->tkn_list[ix] ); + printf(" %3d: ``%s''\n", ix+1, p->tkn_list[ix]); } while (++ix < p->tkn_ct); free(p); } diff --git a/sntp/libopts/usage.c b/sntp/libopts/usage.c index 960339b..4d10667 100644 --- a/sntp/libopts/usage.c +++ b/sntp/libopts/usage.c @@ -1,7 +1,8 @@ /* - * usage.c $Id: usage.c,v 4.15 2007/04/28 22:19:23 bkorb Exp $ - * Time-stamp: "2007-04-15 11:02:46 bkorb" + * \file usage.c + * + * Time-stamp: "2011-02-01 14:42:37 bkorb" * * This module implements the default usage procedure for * Automated Options. It may be overridden, of course. @@ -13,117 +14,183 @@ */ /* - * Automated Options copyright 1992-2007 Bruce Korb - * - * Automated Options is free software. - * You may 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. - * - * Automated Options 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. + * This file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved * - * You should have received a copy of the GNU General Public License - * along with Automated Options. See the file "COPYING". If not, - * write to: The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. * - * As a special exception, Bruce Korb gives permission for additional - * uses of the text contained in his release of AutoOpts. + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" * - * The exception is that, if you link the AutoOpts library with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the AutoOpts library code into it. + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. + * These files have the following md5sums: * - * This exception applies only to the code released by Bruce Korb under - * the name AutoOpts. If you copy code from other sources under the - * General Public License into a copy of AutoOpts, as the General Public - * License permits, the exception does not apply to the code that you add - * in this way. To avoid misleading anyone as to the status of such - * modified files, you must delete this exception notice from them. - * - * If you write modifications of your own for AutoOpts, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd */ #define OPTPROC_L_N_S (OPTPROC_LONGOPT | OPTPROC_SHORTOPT) -static arg_types_t argTypes; +/* = = = START-STATIC-FORWARD = = = */ +static void +set_usage_flags(tOptions * opts, char const * flg_txt); + +static inline ag_bool +do_gnu_usage(tOptions * pOpts); -FILE* option_usage_fp = NULL; -static char zOptFmtLine[ 16 ]; -static ag_bool displayEnum; +static inline ag_bool +skip_misuse_usage(tOptions * pOpts); -/* = = = START-STATIC-FORWARD = = = */ -/* static forward declarations maintained by :mkfwd */ -static ag_bool -checkGNUUsage( tOptions* pOpts ); +static void +print_usage_details(tOptions * opts, int exit_code); + +static void +prt_extd_usage(tOptions * pOptions, tOptDesc * pOD, arg_types_t * pAT); static void -printExtendedUsage( - tOptions* pOptions, - tOptDesc* pOD, - arg_types_t* pAT ); +prt_ini_list(char const * const * papz, ag_bool * pInitIntro, + char const * pzRc, char const * pzPN); static void -printInitList( - tCC* const* papz, - ag_bool* pInitIntro, - tCC* pzRc, - tCC* pzPN ); +prt_preamble(tOptions * pOptions, tOptDesc * pOD, arg_types_t * pAT); static void -printOneUsage( - tOptions* pOptions, - tOptDesc* pOD, - arg_types_t* pAT ); +prt_one_usage(tOptions * pOptions, tOptDesc * pOD, arg_types_t * pAT); static void -printOptionUsage( - tOptions* pOpts, - int ex_code, - tCC* pOptTitle ); +prt_opt_usage(tOptions * pOpts, int ex_code, char const * pOptTitle); static void -printProgramDetails( tOptions* pOptions ); +prt_prog_detail(tOptions* pOptions); static int -setGnuOptFmts( tOptions* pOpts, tCC** ppT ); +setGnuOptFmts(tOptions* pOpts, tCC** ppT); static int -setStdOptFmts( tOptions* pOpts, tCC** ppT ); +setStdOptFmts(tOptions* pOpts, tCC** ppT); /* = = = END-STATIC-FORWARD = = = */ - /* - * Figure out if we should try to format usage text sort-of like - * the way many GNU programs do. + * NB: no entry may be a prefix of another entry */ -static ag_bool -checkGNUUsage( tOptions* pOpts ) +#define AOFLAG_TABLE \ + _aof_(gnu, OPTPROC_GNUUSAGE ) \ + _aof_(autoopts, ~OPTPROC_GNUUSAGE) \ + _aof_(no_misuse_usage, OPTPROC_MISUSE ) \ + _aof_(misuse_usage, ~OPTPROC_MISUSE ) + +static void +set_usage_flags(tOptions * opts, char const * flg_txt) { - char* pz = getenv( "AUTOOPTS_USAGE" ); - if (pz == NULL) - ; + typedef struct { + size_t fnm_len; + uint32_t fnm_mask; + char const * fnm_name; + } ao_flag_names_t; + +# define _aof_(_n, _f) AOUF_ ## _n ## _ID, + typedef enum { AOFLAG_TABLE AOUF_COUNT } ao_flag_id_t; +# undef _aof_ + +# define _aof_(_n, _f) AOUF_ ## _n = (1 << AOUF_ ## _n ## _ID), + typedef enum { AOFLAG_TABLE } ao_flags_t; +# undef _aof_ + +# define _aof_(_n, _f) { sizeof(#_n)-1, _f, #_n }, + static ao_flag_names_t const fn_table[AOUF_COUNT] = { + AOFLAG_TABLE + }; +# undef _aof_ + + ao_flags_t flg = 0; + + if (flg_txt == NULL) { + flg_txt = getenv("AUTOOPTS_USAGE"); + if (flg_txt == NULL) + return; + } - else if (streqvcmp( pz, "gnu" ) == 0) - pOpts->fOptSet |= OPTPROC_GNUUSAGE; + while (IS_WHITESPACE_CHAR(*flg_txt)) flg_txt++; + if (*flg_txt == NUL) + return; - else if (streqvcmp( pz, "autoopts" ) == 0) - pOpts->fOptSet &= ~OPTPROC_GNUUSAGE; + for (;;) { + int ix = 0; + ao_flag_names_t const * fnt = fn_table; + + for (;;) { + if (strneqvcmp(flg_txt, fnt->fnm_name, fnt->fnm_len) == 0) + break; + if (++ix >= AOUF_COUNT) + return; + fnt++; + } + /* + * Make sure we have a full match. Look for whitespace, + * a comma, or a NUL byte. + */ + if (! IS_END_LIST_ENTRY_CHAR(flg_txt[fnt->fnm_len])) + return; + + flg |= 1 << ix; + flg_txt += fnt->fnm_len; + while (IS_WHITESPACE_CHAR(*flg_txt)) flg_txt++; + + if (*flg_txt == NUL) + break; + + if (*flg_txt == ',') { + /* + * skip the comma and following white space + */ + while (IS_WHITESPACE_CHAR(*++flg_txt)) ; + if (*flg_txt == NUL) + break; + } + } + + { + ao_flag_names_t const * fnm = fn_table; + + while (flg != 0) { + if ((flg & 1) != 0) { + if ((fnm->fnm_mask & OPTPROC_LONGOPT) != 0) + opts->fOptSet &= fnm->fnm_mask; + else opts->fOptSet |= fnm->fnm_mask; + } + flg >>= 1; + fnm++; + } + } +} + +/* + * Figure out if we should try to format usage text sort-of like + * the way many GNU programs do. + */ +static inline ag_bool +do_gnu_usage(tOptions * pOpts) +{ return (pOpts->fOptSet & OPTPROC_GNUUSAGE) ? AG_TRUE : AG_FALSE; } +/* + * Figure out if we should try to format usage text sort-of like + * the way many GNU programs do. + */ +static inline ag_bool +skip_misuse_usage(tOptions * pOpts) +{ + return (pOpts->fOptSet & OPTPROC_MISUSE) ? AG_TRUE : AG_FALSE; +} + /*=export_func optionOnlyUsage * @@ -137,23 +204,107 @@ checkGNUUsage( tOptions* pOpts ) * information not available to AutoOpts. =*/ void -optionOnlyUsage( - tOptions* pOpts, - int ex_code ) +optionOnlyUsage(tOptions * pOpts, int ex_code) { - tCC* pOptTitle = NULL; + char const * pOptTitle = NULL; + + set_usage_flags(pOpts, NULL); + if ((ex_code != EXIT_SUCCESS) && + skip_misuse_usage(pOpts)) + return; /* * Determine which header and which option formatting strings to use */ - if (checkGNUUsage(pOpts)) { - (void)setGnuOptFmts( pOpts, &pOptTitle ); + if (do_gnu_usage(pOpts)) { + (void)setGnuOptFmts(pOpts, &pOptTitle); } else { - (void)setStdOptFmts( pOpts, &pOptTitle ); + (void)setStdOptFmts(pOpts, &pOptTitle); + } + + prt_opt_usage(pOpts, ex_code, pOptTitle); + + fflush(option_usage_fp); + if (ferror(option_usage_fp) != 0) { + fputs(zOutputFail, stderr); + exit(EXIT_FAILURE); + } +} + +static void +print_usage_details(tOptions * opts, int exit_code) +{ + { + char const * pOptTitle = NULL; + + /* + * Determine which header and which option formatting strings to use + */ + if (do_gnu_usage(opts)) { + int flen = setGnuOptFmts(opts, &pOptTitle); + sprintf(zOptFmtLine, zFmtFmt, flen); + fputc('\n', option_usage_fp); + } + else { + int flen = setStdOptFmts(opts, &pOptTitle); + sprintf(zOptFmtLine, zFmtFmt, flen); + + /* + * When we exit with EXIT_SUCCESS and the first option is a doc + * option, we do *NOT* want to emit the column headers. + * Otherwise, we do. + */ + if ( (exit_code != EXIT_SUCCESS) + || ((opts->pOptDesc->fOptState & OPTST_DOCUMENT) == 0) ) + + fputs(pOptTitle, option_usage_fp); + } + + prt_opt_usage(opts, exit_code, pOptTitle); + } + + /* + * Describe the mechanics of denoting the options + */ + switch (opts->fOptSet & OPTPROC_L_N_S) { + case OPTPROC_L_N_S: fputs(zFlagOkay, option_usage_fp); break; + case OPTPROC_SHORTOPT: break; + case OPTPROC_LONGOPT: fputs(zNoFlags, option_usage_fp); break; + case 0: fputs(zOptsOnly, option_usage_fp); break; } - printOptionUsage( pOpts, ex_code, pOptTitle ); + if ((opts->fOptSet & OPTPROC_NUM_OPT) != 0) + fputs(zNumberOpt, option_usage_fp); + + if ((opts->fOptSet & OPTPROC_REORDER) != 0) + fputs(zReorder, option_usage_fp); + + if (opts->pzExplain != NULL) + fputs(opts->pzExplain, option_usage_fp); + + /* + * IF the user is asking for help (thus exiting with SUCCESS), + * THEN see what additional information we can provide. + */ + if (exit_code == EXIT_SUCCESS) + prt_prog_detail(opts); + + /* + * Give bug notification preference to the packager information + */ + if (HAS_pzPkgDataDir(opts) && (opts->pzPackager != NULL)) + fputs(opts->pzPackager, option_usage_fp); + + else if (opts->pzBugAddr != NULL) + fprintf(option_usage_fp, zPlsSendBugs, opts->pzBugAddr); + + fflush(option_usage_fp); + + if (ferror(option_usage_fp) != 0) { + fputs(zOutputFail, stderr); + exit(EXIT_FAILURE); + } } @@ -174,11 +325,9 @@ optionOnlyUsage( * and the actual exit code will be "EXIT_SUCCESS". =*/ void -optionUsage( - tOptions* pOptions, - int usage_exit_code ) +optionUsage(tOptions * pOptions, int usage_exit_code) { - int actual_exit_code = + int exit_code = (usage_exit_code == EX_USAGE) ? EXIT_SUCCESS : usage_exit_code; displayEnum = AG_FALSE; @@ -187,74 +336,42 @@ optionUsage( * Paged usage will preset option_usage_fp to an output file. * If it hasn't already been set, then set it to standard output * on successful exit (help was requested), otherwise error out. + * + * Test the version before obtaining pzFullUsage or pzShortUsage. + * These fields do not exist before revision 30. */ - if (option_usage_fp == NULL) - option_usage_fp = (actual_exit_code != EXIT_SUCCESS) ? stderr : stdout; - - fprintf( option_usage_fp, pOptions->pzUsageTitle, pOptions->pzProgName ); - { - tCC* pOptTitle = NULL; + char const * pz; - /* - * Determine which header and which option formatting strings to use - */ - if (checkGNUUsage(pOptions)) { - int flen = setGnuOptFmts( pOptions, &pOptTitle ); - sprintf( zOptFmtLine, zFmtFmt, flen ); - fputc( '\n', option_usage_fp ); - } - else { - int flen = setStdOptFmts( pOptions, &pOptTitle ); - sprintf( zOptFmtLine, zFmtFmt, flen ); + if (exit_code == EXIT_SUCCESS) { + pz = (pOptions->structVersion >= 30 * 4096) + ? pOptions->pzFullUsage : NULL; - /* - * When we exit with EXIT_SUCCESS and the first option is a doc - * option, we do *NOT* want to emit the column headers. - * Otherwise, we do. - */ - if ( (usage_exit_code != EXIT_SUCCESS) - || ((pOptions->pOptDesc->fOptState & OPTST_DOCUMENT) == 0) ) + if (option_usage_fp == NULL) + option_usage_fp = stdout; + } else { + pz = (pOptions->structVersion >= 30 * 4096) + ? pOptions->pzShortUsage : NULL; - fputs( pOptTitle, option_usage_fp ); + if (option_usage_fp == NULL) + option_usage_fp = stderr; } - printOptionUsage( pOptions, usage_exit_code, pOptTitle ); - } - - /* - * Describe the mechanics of denoting the options - */ - switch (pOptions->fOptSet & OPTPROC_L_N_S) { - case OPTPROC_L_N_S: fputs( zFlagOkay, option_usage_fp ); break; - case OPTPROC_SHORTOPT: break; - case OPTPROC_LONGOPT: fputs( zNoFlags, option_usage_fp ); break; - case 0: fputs( zOptsOnly, option_usage_fp ); break; - } - - if ((pOptions->fOptSet & OPTPROC_NUM_OPT) != 0) { - fputs( zNumberOpt, option_usage_fp ); - } - - if ((pOptions->fOptSet & OPTPROC_REORDER) != 0) { - fputs( zReorder, option_usage_fp ); + if (pz != NULL) { + fputs(pz, option_usage_fp); + exit(exit_code); + } } - if (pOptions->pzExplain != NULL) - fputs( pOptions->pzExplain, option_usage_fp ); + fprintf(option_usage_fp, pOptions->pzUsageTitle, pOptions->pzProgName); + set_usage_flags(pOptions, NULL); - /* - * IF the user is asking for help (thus exiting with SUCCESS), - * THEN see what additional information we can provide. - */ - if (usage_exit_code == EXIT_SUCCESS) - printProgramDetails( pOptions ); + if ((exit_code == EXIT_SUCCESS) || + (! skip_misuse_usage(pOptions))) - if (pOptions->pzBugAddr != NULL) - fprintf( option_usage_fp, zPlsSendBugs, pOptions->pzBugAddr ); - fflush( option_usage_fp ); + print_usage_details(pOptions, usage_exit_code); - exit( actual_exit_code ); + exit(exit_code); } @@ -263,10 +380,7 @@ optionUsage( * PER OPTION TYPE USAGE INFORMATION */ static void -printExtendedUsage( - tOptions* pOptions, - tOptDesc* pOD, - arg_types_t* pAT ) +prt_extd_usage(tOptions * pOptions, tOptDesc * pOD, arg_types_t * pAT) { /* * IF there are option conflicts or dependencies, @@ -275,7 +389,7 @@ printExtendedUsage( if ( (pOD->pOptMust != NULL) || (pOD->pOptCant != NULL) ) { - fputs( zTabHyp, option_usage_fp ); + fputs(zTabHyp, option_usage_fp); /* * DEPENDENCIES: @@ -283,16 +397,16 @@ printExtendedUsage( if (pOD->pOptMust != NULL) { const int* pOptNo = pOD->pOptMust; - fputs( zReqThese, option_usage_fp ); + fputs(zReqThese, option_usage_fp); for (;;) { - fprintf( option_usage_fp, zTabout, pOptions->pOptDesc[ - *pOptNo ].pz_Name ); + fprintf(option_usage_fp, zTabout, + pOptions->pOptDesc[*pOptNo].pz_Name); if (*++pOptNo == NO_EQUIVALENT) break; } if (pOD->pOptCant != NULL) - fputs( zTabHypAnd, option_usage_fp ); + fputs(zTabHypAnd, option_usage_fp); } /* @@ -301,10 +415,10 @@ printExtendedUsage( if (pOD->pOptCant != NULL) { const int* pOptNo = pOD->pOptCant; - fputs( zProhib, option_usage_fp ); + fputs(zProhib, option_usage_fp); for (;;) { - fprintf( option_usage_fp, zTabout, pOptions->pOptDesc[ - *pOptNo ].pz_Name ); + fprintf(option_usage_fp, zTabout, + pOptions->pOptDesc[*pOptNo].pz_Name); if (*++pOptNo == NO_EQUIVALENT) break; } @@ -316,16 +430,26 @@ printExtendedUsage( * THEN print the disablement info */ if (pOD->pz_DisableName != NULL ) - fprintf( option_usage_fp, zDis, pOD->pz_DisableName ); + fprintf(option_usage_fp, zDis, pOD->pz_DisableName); /* - * IF the numeric option has a special callback, - * THEN call it, requesting the range or other special info + * Check for argument types that have callbacks with magical properties */ - if ( (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_NUMERIC) - && (pOD->pOptProc != NULL) - && (pOD->pOptProc != optionNumericVal) ) { - (*(pOD->pOptProc))( pOptions, NULL ); + switch (OPTST_GET_ARGTYPE(pOD->fOptState)) { + case OPARG_TYPE_NUMERIC: + /* + * IF the numeric option has a special callback, + * THEN call it, requesting the range or other special info + */ + if ( (pOD->pOptProc != NULL) + && (pOD->pOptProc != optionNumericVal) ) { + (*(pOD->pOptProc))(OPTPROC_EMIT_USAGE, pOD); + } + break; + + case OPARG_TYPE_FILE: + (*(pOD->pOptProc))(OPTPROC_EMIT_USAGE, pOD); + break; } /* @@ -333,7 +457,7 @@ printExtendedUsage( * THEN print that out */ if (pOD->fOptState & OPTST_INITENABLED) - fputs( zEnab, option_usage_fp ); + fputs(zEnab, option_usage_fp); /* * IF the option is in an equivalence class @@ -342,8 +466,8 @@ printExtendedUsage( */ if ( (pOD->optEquivIndex != NO_EQUIVALENT) && (pOD->optEquivIndex != pOD->optActualIndex ) ) { - fprintf( option_usage_fp, zAlt, - pOptions->pOptDesc[ pOD->optEquivIndex ].pz_Name ); + fprintf(option_usage_fp, zAlt, + pOptions->pOptDesc[ pOD->optEquivIndex ].pz_Name); return; } @@ -360,25 +484,25 @@ printExtendedUsage( && (pOD->optIndex < pOptions->presetOptCt) ) - fputs( zNoPreset, option_usage_fp ); + fputs(zNoPreset, option_usage_fp); /* * Print the appearance requirements. */ if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_MEMBERSHIP) - fputs( zMembers, option_usage_fp ); + fputs(zMembers, option_usage_fp); else switch (pOD->optMinCt) { case 1: case 0: switch (pOD->optMaxCt) { - case 0: fputs( zPreset, option_usage_fp ); break; - case NOLIMIT: fputs( zNoLim, option_usage_fp ); break; + case 0: fputs(zPreset, option_usage_fp); break; + case NOLIMIT: fputs(zNoLim, option_usage_fp); break; case 1: break; /* * IF the max is more than one but limited, print "UP TO" message */ - default: fprintf( option_usage_fp, zUpTo, pOD->optMaxCt ); break; + default: fprintf(option_usage_fp, zUpTo, pOD->optMaxCt); break; } break; @@ -386,12 +510,12 @@ printExtendedUsage( /* * More than one is required. Print the range. */ - fprintf( option_usage_fp, zMust, pOD->optMinCt, pOD->optMaxCt ); + fprintf(option_usage_fp, zMust, pOD->optMinCt, pOD->optMaxCt); } - if ( NAMED_OPTS( pOptions ) + if ( NAMED_OPTS(pOptions) && (pOptions->specOptIdx.default_opt == pOD->optIndex)) - fputs( zDefaultOpt, option_usage_fp ); + fputs(zDefaultOpt, option_usage_fp); } @@ -403,34 +527,43 @@ printExtendedUsage( * squishy, but important to tell users how to find these files. */ static void -printInitList( - tCC* const* papz, - ag_bool* pInitIntro, - tCC* pzRc, - tCC* pzPN ) +prt_ini_list(char const * const * papz, ag_bool * pInitIntro, + char const * pzRc, char const * pzPN) { - char zPath[ AG_PATH_MAX+1 ]; + char zPath[AG_PATH_MAX+1]; if (papz == NULL) return; - fputs( zPresetIntro, option_usage_fp ); + fputs(zPresetIntro, option_usage_fp); *pInitIntro = AG_FALSE; for (;;) { - char const* pzPath = *(papz++); + char const * pzPath = *(papz++); + char const * pzReal = zPath; if (pzPath == NULL) break; - if (optionMakePath(zPath, (int)sizeof( zPath ), pzPath, pzPN)) - pzPath = zPath; + /* + * Ignore any invalid paths + */ + if (! optionMakePath(zPath, (int)sizeof(zPath), pzPath, pzPN)) + pzReal = pzPath; + + /* + * Expand paths that are relative to the executable or installation + * directories. Leave alone paths that use environment variables. + */ + else if ((*pzPath == '$') + && ((pzPath[1] == '$') || (pzPath[1] == '@'))) + pzPath = pzReal; /* * Print the name of the "homerc" file. If the "rcfile" name is * not empty, we may or may not print that, too... */ - fprintf( option_usage_fp, zPathFmt, pzPath ); + fprintf(option_usage_fp, zPathFmt, pzPath); if (*pzRc != NUL) { struct stat sb; @@ -438,26 +571,19 @@ printInitList( * IF the "homerc" file is a directory, * then append the "rcfile" name. */ - if ( (stat( pzPath, &sb ) == 0) - && S_ISDIR( sb.st_mode ) ) { - fputc( DIRCH, option_usage_fp ); - fputs( pzRc, option_usage_fp ); + if ((stat(pzReal, &sb) == 0) && S_ISDIR(sb.st_mode)) { + fputc(DIRCH, option_usage_fp); + fputs(pzRc, option_usage_fp); } } - fputc( '\n', option_usage_fp ); + fputc('\n', option_usage_fp); } } -/* - * Print the usage information for a single option. - */ static void -printOneUsage( - tOptions* pOptions, - tOptDesc* pOD, - arg_types_t* pAT ) +prt_preamble(tOptions * pOptions, tOptDesc * pOD, arg_types_t * pAT) { /* * Flag prefix: IF no flags at all, then omit it. If not printable @@ -466,47 +592,59 @@ printOneUsage( * opts are to be printed too. */ if ((pOptions->fOptSet & OPTPROC_SHORTOPT) == 0) - fputs( pAT->pzSpc, option_usage_fp ); - else if (! isgraph( pOD->optValue)) { + fputs(pAT->pzSpc, option_usage_fp); + + else if (! IS_GRAPHIC_CHAR(pOD->optValue)) { if ( (pOptions->fOptSet & (OPTPROC_GNUUSAGE|OPTPROC_LONGOPT)) == (OPTPROC_GNUUSAGE|OPTPROC_LONGOPT)) - fputc( ' ', option_usage_fp ); - fputs( pAT->pzNoF, option_usage_fp ); + fputc(' ', option_usage_fp); + fputs(pAT->pzNoF, option_usage_fp); + } else { - fprintf( option_usage_fp, " -%c", pOD->optValue ); + fprintf(option_usage_fp, " -%c", pOD->optValue); if ( (pOptions->fOptSet & (OPTPROC_GNUUSAGE|OPTPROC_LONGOPT)) == (OPTPROC_GNUUSAGE|OPTPROC_LONGOPT)) - fputs( ", ", option_usage_fp ); + fputs(", ", option_usage_fp); } +} + +/* + * Print the usage information for a single option. + */ +static void +prt_one_usage(tOptions * pOptions, tOptDesc * pOD, arg_types_t * pAT) +{ + prt_preamble(pOptions, pOD, pAT); { - char z[ 80 ]; - tCC* pzArgType; + char z[ 80 ]; + char const * pzArgType; + /* * Determine the argument type string first on its usage, then, * when the option argument is required, base the type string on the * argument type. */ - if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_NONE) { - pzArgType = pAT->pzNo; - - } else if (pOD->fOptState & OPTST_ARG_OPTIONAL) { + if (pOD->fOptState & OPTST_ARG_OPTIONAL) { pzArgType = pAT->pzOpt; } else switch (OPTST_GET_ARGTYPE(pOD->fOptState)) { + case OPARG_TYPE_NONE: pzArgType = pAT->pzNo; break; case OPARG_TYPE_ENUMERATION: pzArgType = pAT->pzKey; break; + case OPARG_TYPE_FILE: pzArgType = pAT->pzFile; break; case OPARG_TYPE_MEMBERSHIP: pzArgType = pAT->pzKeyL; break; case OPARG_TYPE_BOOLEAN: pzArgType = pAT->pzBool; break; case OPARG_TYPE_NUMERIC: pzArgType = pAT->pzNum; break; case OPARG_TYPE_HIERARCHY: pzArgType = pAT->pzNest; break; case OPARG_TYPE_STRING: pzArgType = pAT->pzStr; break; - default: goto bogus_desc; break; + case OPARG_TYPE_TIME: pzArgType = pAT->pzTime; break; + default: goto bogus_desc; } - snprintf( z, sizeof(z), pAT->pzOptFmt, pzArgType, pOD->pz_Name, - (pOD->optMinCt != 0) ? pAT->pzReq : pAT->pzOpt ); + snprintf(z, sizeof(z), pAT->pzOptFmt, pzArgType, pOD->pz_Name, + (pOD->optMinCt != 0) ? pAT->pzReq : pAT->pzOpt); - fprintf( option_usage_fp, zOptFmtLine, z, pOD->pzText ); + fprintf(option_usage_fp, zOptFmtLine, z, pOD->pzText); switch (OPTST_GET_ARGTYPE(pOD->fOptState)) { case OPARG_TYPE_ENUMERATION: @@ -517,8 +655,8 @@ printOneUsage( return; bogus_desc: - fprintf( stderr, zInvalOptDesc, pOD->pz_Name ); - exit( EX_SOFTWARE ); + fprintf(stderr, zInvalOptDesc, pOD->pz_Name); + exit(EX_SOFTWARE); } @@ -526,19 +664,34 @@ printOneUsage( * Print out the usage information for just the options. */ static void -printOptionUsage( - tOptions* pOpts, - int ex_code, - tCC* pOptTitle ) +prt_opt_usage(tOptions * pOpts, int ex_code, char const * pOptTitle) { - int ct = pOpts->optCt; - int optNo = 0; - tOptDesc* pOD = pOpts->pOptDesc; - int docCt = 0; + int ct = pOpts->optCt; + int optNo = 0; + tOptDesc * pOD = pOpts->pOptDesc; + int docCt = 0; do { - if ((pOD->fOptState & OPTST_OMITTED) != 0) + if ((pOD->fOptState & OPTST_NO_USAGE_MASK) != 0) { + + /* + * IF this is a compiled-out option + * *AND* usage was requested with "omitted-usage" + * *AND* this is NOT abbreviated usage + * THEN display this option. + */ + if ( (pOD->fOptState == (OPTST_OMITTED | OPTST_NO_INIT)) + && (pOD->pz_Name != NULL) + && (ex_code == EXIT_SUCCESS)) { + + char const * why_pz = + (pOD->pzText == NULL) ? zDisabledWhy : pOD->pzText; + prt_preamble(pOpts, pOD, &argTypes); + fprintf(option_usage_fp, zDisabledOpt, pOD->pz_Name, why_pz); + } + continue; + } if ((pOD->fOptState & OPTST_DOCUMENT) != 0) { if (ex_code == EXIT_SUCCESS) { @@ -558,23 +711,23 @@ printOptionUsage( * THEN document that the remaining options are not user opts */ if ( (pOpts->presetOptCt == optNo) - && (ex_code == EXIT_SUCCESS) - && (docCt > 0) - && ((pOD[-1].fOptState & OPTST_DOCUMENT) == 0) ) - fprintf( option_usage_fp, argTypes.pzBrk, zAuto, pOptTitle ); + && (ex_code == EXIT_SUCCESS) + && (docCt > 0) + && ((pOD[-1].fOptState & OPTST_DOCUMENT) == 0) ) + fprintf(option_usage_fp, argTypes.pzBrk, zAuto, pOptTitle); - printOneUsage( pOpts, pOD, &argTypes ); + prt_one_usage(pOpts, pOD, &argTypes); /* * IF we were invoked because of the --help option, * THEN print all the extra info */ if (ex_code == EXIT_SUCCESS) - printExtendedUsage( pOpts, pOD, &argTypes ); + prt_extd_usage(pOpts, pOD, &argTypes); } while (pOD++, optNo++, (--ct > 0)); - fputc( '\n', option_usage_fp ); + fputc('\n', option_usage_fp); } @@ -583,24 +736,24 @@ printOptionUsage( * PROGRAM DETAILS */ static void -printProgramDetails( tOptions* pOptions ) +prt_prog_detail(tOptions* pOptions) { ag_bool initIntro = AG_TRUE; /* * Display all the places we look for config files */ - printInitList( pOptions->papzHomeList, &initIntro, - pOptions->pzRcName, pOptions->pzProgPath ); + prt_ini_list(pOptions->papzHomeList, &initIntro, + pOptions->pzRcName, pOptions->pzProgPath); /* * Let the user know about environment variable settings */ if ((pOptions->fOptSet & OPTPROC_ENVIRON) != 0) { if (initIntro) - fputs( zPresetIntro, option_usage_fp ); + fputs(zPresetIntro, option_usage_fp); - fprintf( option_usage_fp, zExamineFmt, pOptions->pzPROGNAME ); + fprintf(option_usage_fp, zExamineFmt, pOptions->pzPROGNAME); } /* @@ -613,13 +766,13 @@ printProgramDetails( tOptions* pOptions ) int optNo = 0; tOptDesc* pOD = pOptions->pOptDesc; - fputc( '\n', option_usage_fp ); - fflush( option_usage_fp ); + fputc('\n', option_usage_fp); + fflush(option_usage_fp); do { switch (OPTST_GET_ARGTYPE(pOD->fOptState)) { case OPARG_TYPE_ENUMERATION: case OPARG_TYPE_MEMBERSHIP: - (*(pOD->pOptProc))( NULL, pOD ); + (*(pOD->pOptProc))(OPTPROC_EMIT_USAGE, pOD); } } while (pOD++, optNo++, (--ct > 0)); } @@ -628,7 +781,7 @@ printProgramDetails( tOptions* pOptions ) * If there is a detail string, now is the time for that. */ if (pOptions->pzDetail != NULL) - fputs( pOptions->pzDetail, option_usage_fp ); + fputs(pOptions->pzDetail, option_usage_fp); } @@ -647,7 +800,7 @@ printProgramDetails( tOptions* pOptions ) * Set up the formatting for GNU-style output */ static int -setGnuOptFmts( tOptions* pOpts, tCC** ppT ) +setGnuOptFmts(tOptions* pOpts, tCC** ppT) { int flen = 22; *ppT = zNoRq_ShrtTtl; @@ -657,6 +810,8 @@ setGnuOptFmts( tOptions* pOpts, tCC** ppT ) argTypes.pzNum = zGnuNumArg; argTypes.pzKey = zGnuKeyArg; argTypes.pzKeyL = zGnuKeyLArg; + argTypes.pzTime = zGnuTimeArg; + argTypes.pzFile = zGnuFileArg; argTypes.pzBool = zGnuBoolArg; argTypes.pzNest = zGnuNestArg; argTypes.pzOpt = zGnuOptArg; @@ -685,7 +840,7 @@ setGnuOptFmts( tOptions* pOpts, tCC** ppT ) * Standard (AutoOpts normal) option line formatting */ static int -setStdOptFmts( tOptions* pOpts, tCC** ppT ) +setStdOptFmts(tOptions* pOpts, tCC** ppT) { int flen = 0; @@ -694,6 +849,8 @@ setStdOptFmts( tOptions* pOpts, tCC** ppT ) argTypes.pzNum = zStdNumArg; argTypes.pzKey = zStdKeyArg; argTypes.pzKeyL = zStdKeyLArg; + argTypes.pzTime = zStdTimeArg; + argTypes.pzFile = zStdFileArg; argTypes.pzBool = zStdBoolArg; argTypes.pzNest = zStdNestArg; argTypes.pzOpt = zStdOptArg; diff --git a/sntp/libopts/value-type.c b/sntp/libopts/value-type.c new file mode 100644 index 0000000..ff98c0a --- /dev/null +++ b/sntp/libopts/value-type.c @@ -0,0 +1,123 @@ +/* ANSI-C code produced by gperf version 3.0.4 */ + + +#if 0 /* gperf build options: */ +// %struct-type +// %language=ANSI-C +// %includes +// %global-table +// %omit-struct-type +// %readonly-tables +// %compare-strncmp +// +// %define slot-name vtp_name +// %define hash-function-name value_type_hash +// %define lookup-function-name find_value_type_name +// %define word-array-name value_type_table +// %define initializer-suffix ,VTP_COUNT_KWD +#endif /* gperf build options: */ + +#include "value-type.h" + +typedef struct { + char const * vtp_name; + value_type_enum_t vtp_id; +} value_type_map_t; +#include <string.h> + +/* maximum key range = 20, duplicates = 0 */ + +#ifdef __GNUC__ +#else +#ifdef __cplusplus +#endif +#endif +inline static unsigned int +value_type_hash (register const char *str, register unsigned int len) +{ + static const unsigned char asso_values[] = + { + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 10, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 5, 23, 23, 5, 0, 0, 23, 15, 23, + 23, 10, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23 + }; + return len + asso_values[(unsigned char)str[2]]; +} + +static const value_type_map_t value_type_table[] = + { + {"",VTP_COUNT_KWD}, {"",VTP_COUNT_KWD}, + {"",VTP_COUNT_KWD}, + {"set", VTP_KWD_SET}, + {"",VTP_COUNT_KWD}, {"",VTP_COUNT_KWD}, + {"nested", VTP_KWD_NESTED}, + {"integer", VTP_KWD_INTEGER}, + {"",VTP_COUNT_KWD}, + {"bool", VTP_KWD_BOOL}, + {"",VTP_COUNT_KWD}, + {"string", VTP_KWD_STRING}, + {"boolean", VTP_KWD_BOOLEAN}, + {"",VTP_COUNT_KWD}, + {"set-membership", VTP_KWD_SET_MEMBERSHIP}, + {"",VTP_COUNT_KWD}, {"",VTP_COUNT_KWD}, + {"keyword", VTP_KWD_KEYWORD}, + {"",VTP_COUNT_KWD}, + {"hierarchy", VTP_KWD_HIERARCHY}, + {"",VTP_COUNT_KWD}, {"",VTP_COUNT_KWD}, + {"invalid", VTP_KWD_INVALID} + }; + +#ifdef __GNUC__ +#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ +__attribute__ ((__gnu_inline__)) +#endif +#endif +static inline const value_type_map_t * +find_value_type_name (register const char *str, register unsigned int len) +{ + if (len <= 14 && len >= 3) + { + register int key = value_type_hash (str, len); + + if (key <= 22 && key >= 0) + { + register const char *s = value_type_table[key].vtp_name; + + if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0') + return &value_type_table[key]; + } + } + return 0; +} + + +value_type_enum_t +find_value_type_id(char const * str, unsigned int len) +{ + const value_type_map_t * p = + find_value_type_name(str, len); + return (p == 0) ? VTP_KWD_INVALID : p->vtp_id; +} diff --git a/sntp/libopts/value-type.h b/sntp/libopts/value-type.h new file mode 100644 index 0000000..5ff917c --- /dev/null +++ b/sntp/libopts/value-type.h @@ -0,0 +1,25 @@ +/* + * Generated header for gperf generated source Fri Apr 29 15:43:59 PDT 2011 + * This file enumerates the list of names and declares the + * procedure for mapping string names to the enum value. + */ +#ifndef AUTOOPTS_VALUE_TYPE_H_GUARD +#define AUTOOPTS_VALUE_TYPE_H_GUARD 1 + +typedef enum { + VTP_KWD_INVALID, + VTP_KWD_STRING, + VTP_KWD_INTEGER, + VTP_KWD_BOOLEAN, + VTP_KWD_BOOL, + VTP_KWD_KEYWORD, + VTP_KWD_SET, + VTP_KWD_SET_MEMBERSHIP, + VTP_KWD_NESTED, + VTP_KWD_HIERARCHY, + VTP_COUNT_KWD +} value_type_enum_t; + +extern value_type_enum_t +find_value_type_id(char const * str, unsigned int len); +#endif /* AUTOOPTS_VALUE_TYPE_H_GUARD */ diff --git a/sntp/libopts/version.c b/sntp/libopts/version.c index 85949d5..aae1b87 100644 --- a/sntp/libopts/version.c +++ b/sntp/libopts/version.c @@ -1,60 +1,33 @@ -/* $Id: version.c,v 4.10 2007/04/28 22:19:23 bkorb Exp $ - * Time-stamp: "2007-04-28 10:08:34 bkorb" +/* + * Time-stamp: "2011-04-22 12:54:28 bkorb" * * This module implements the default usage procedure for * Automated Options. It may be overridden, of course. */ -static char const zAOV[] = - "Automated Options version %s, copyright (c) 1999-2007 Bruce Korb\n"; - -/* Automated Options is free software. - * You may 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. - * - * Automated Options 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 Automated Options. See the file "COPYING". If not, - * write to: The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. +/* + * This file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved * - * As a special exception, Bruce Korb gives permission for additional - * uses of the text contained in his release of AutoOpts. + * AutoOpts is available under any one of two licenses. The license + * in use must be one of these two and the choice is under the control + * of the user of the license. * - * The exception is that, if you link the AutoOpts library with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the AutoOpts library code into it. + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" * - * This exception applies only to the code released by Bruce Korb under - * the name AutoOpts. If you copy code from other sources under the - * General Public License into a copy of AutoOpts, as the General Public - * License permits, the exception does not apply to the code that you add - * in this way. To avoid misleading anyone as to the status of such - * modified files, you must delete this exception notice from them. + * These files have the following md5sums: * - * If you write modifications of your own for AutoOpts, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. + * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 + * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 + * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd */ -/* = = = START-STATIC-FORWARD = = = */ -/* static forward declarations maintained by :mkfwd */ -static void -printVersion( tOptions* pOpts, tOptDesc* pOD, FILE* fp ); -/* = = = END-STATIC-FORWARD = = = */ - /*=export_func optionVersion * * what: return the compiled AutoOpts version number @@ -65,76 +38,114 @@ printVersion( tOptions* pOpts, tOptDesc* pOD, FILE* fp ); * The returned string cannot be modified. =*/ char const* -optionVersion( void ) +optionVersion(void) { static char const zVersion[] = - STR( AO_CURRENT.AO_REVISION ); + STR(AO_CURRENT.AO_REVISION); return zVersion; } +static void +emit_simple_ver(tOptions * pOpts, FILE * fp) +{ + if (pOpts->pzFullVersion != NULL) + fputs(pOpts->pzFullVersion, fp); + + else if (pOpts->pzCopyright != NULL) { + char const * pe = strchr(pOpts->pzCopyright, '\n'); + if (pe == NULL) + pe = pOpts->pzCopyright + strlen(pOpts->pzCopyright); + fwrite(pOpts->pzCopyright, 1, pe - pOpts->pzCopyright, fp); + } + + else { + char const * pe = strchr(pOpts->pzUsageTitle, '\n'); + if (pe == NULL) + pe = pOpts->pzUsageTitle + strlen(pOpts->pzUsageTitle); + fwrite(pOpts->pzUsageTitle, 1, pe - pOpts->pzCopyright, fp); + } + fputc('\n', fp); +} static void -printVersion( tOptions* pOpts, tOptDesc* pOD, FILE* fp ) +emit_copy_ver(tOptions * pOpts, FILE * fp) { - char swCh; + if (pOpts->pzCopyright != NULL) + fputs(pOpts->pzCopyright, fp); + + else if (pOpts->pzFullVersion != NULL) + fputs(pOpts->pzFullVersion, fp); + + else { + char const * pe = strchr(pOpts->pzUsageTitle, '\n'); + if (pe == NULL) + pe = pOpts->pzUsageTitle + strlen(pOpts->pzUsageTitle); + fwrite(pOpts->pzUsageTitle, 1, pe - pOpts->pzCopyright, fp); + } + + fputc('\n', fp); + + if (HAS_pzPkgDataDir(pOpts) && (pOpts->pzPackager != NULL)) + fputs(pOpts->pzPackager, fp); + + else if (pOpts->pzBugAddr != NULL) + fprintf(fp, zPlsSendBugs, pOpts->pzBugAddr); +} + +static void +emit_copy_note(tOptions * pOpts, FILE * fp) +{ + if (pOpts->pzCopyright != NULL) { + fputs(pOpts->pzCopyright, fp); + fputc('\n', fp); + } + + if (pOpts->pzCopyNotice != NULL) { + fputs(pOpts->pzCopyNotice, fp); + fputc('\n', fp); + } + + fprintf(fp, zAO_Ver, optionVersion()); + + if (HAS_pzPkgDataDir(pOpts) && (pOpts->pzPackager != NULL)) + fputs(pOpts->pzPackager, fp); + + else if (pOpts->pzBugAddr != NULL) + fprintf(fp, zPlsSendBugs, pOpts->pzBugAddr); +} + +static void +print_ver(tOptions * pOpts, tOptDesc * pOD, FILE * fp) +{ + char ch; /* - * IF the optional argument flag is off, or the argument is not provided, - * then just print the version. + * IF the optional argument flag is off, or the argument + * is not provided, then just print the version. */ if ( ((pOD->fOptState & OPTST_ARG_OPTIONAL) == 0) || (pOD->optArg.argString == NULL)) - swCh = 'v'; - else swCh = tolower(pOD->optArg.argString[0]); + ch = 'v'; + else ch = pOD->optArg.argString[0]; - if (pOpts->pzFullVersion != NULL) { - fputs( pOpts->pzFullVersion, fp ); - fputc( '\n', fp ); - - } else { - char const *pz = pOpts->pzUsageTitle; - do { fputc(*pz, fp); } while (*(pz++) != '\n'); - } - - switch (swCh) { + switch (ch) { case NUL: /* arg provided, but empty */ - case 'v': - break; - - case 'c': - if (pOpts->pzCopyright != NULL) { - fputs( pOpts->pzCopyright, fp ); - fputc( '\n', fp ); - } - fprintf( fp, zAOV, optionVersion() ); - if (pOpts->pzBugAddr != NULL) - fprintf( fp, zPlsSendBugs, pOpts->pzBugAddr ); - break; - - case 'n': - if (pOpts->pzCopyright != NULL) { - fputs( pOpts->pzCopyright, fp ); - fputc( '\n', fp ); - fputc( '\n', fp ); - } - - if (pOpts->pzCopyNotice != NULL) { - fputs( pOpts->pzCopyNotice, fp ); - fputc( '\n', fp ); - } - - fprintf( fp, zAOV, optionVersion() ); - if (pOpts->pzBugAddr != NULL) - fprintf( fp, zPlsSendBugs, pOpts->pzBugAddr ); - break; + case 'v': case 'V': emit_simple_ver(pOpts, fp); break; + case 'c': case 'C': emit_copy_ver(pOpts, fp); break; + case 'n': case 'N': emit_copy_note(pOpts, fp); break; default: - fprintf( stderr, zBadVerArg, swCh ); - exit( EXIT_FAILURE ); + fprintf(stderr, zBadVerArg, ch); + exit(EXIT_FAILURE); } - exit( EXIT_SUCCESS ); + fflush(fp); + if (ferror(fp) != 0) { + fputs(zOutputFail, stderr); + exit(EXIT_FAILURE); + } + exit(EXIT_SUCCESS); } /*=export_func optionPrintVersion @@ -148,9 +159,9 @@ printVersion( tOptions* pOpts, tOptDesc* pOD, FILE* fp ) * This routine will print the version to stdout. =*/ void -optionPrintVersion( tOptions* pOpts, tOptDesc* pOD ) +optionPrintVersion(tOptions * pOpts, tOptDesc * pOD) { - printVersion( pOpts, pOD, stdout ); + print_ver(pOpts, pOD, stdout); } /*=export_func optionVersionStderr @@ -164,9 +175,9 @@ optionPrintVersion( tOptions* pOpts, tOptDesc* pOD ) * This routine will print the version to stderr. =*/ void -optionVersionStderr( tOptions* pOpts, tOptDesc* pOD ) +optionVersionStderr(tOptions * pOpts, tOptDesc * pOD) { - printVersion( pOpts, pOD, stderr ); + print_ver(pOpts, pOD, stderr); } /* diff --git a/sntp/libopts/xat-attribute.c b/sntp/libopts/xat-attribute.c new file mode 100644 index 0000000..db47531 --- /dev/null +++ b/sntp/libopts/xat-attribute.c @@ -0,0 +1,114 @@ +/* ANSI-C code produced by gperf version 3.0.4 */ + + +#if 0 /* gperf build options: */ +// %struct-type +// %language=ANSI-C +// %includes +// %global-table +// %omit-struct-type +// %readonly-tables +// %compare-strncmp +// +// %define slot-name xat_name +// %define hash-function-name xat_attribute_hash +// %define lookup-function-name find_xat_attribute_name +// %define word-array-name xat_attribute_table +// %define initializer-suffix ,XAT_COUNT_KWD +#endif /* gperf build options: */ + +#include "xat-attribute.h" + +typedef struct { + char const * xat_name; + xat_attribute_enum_t xat_id; +} xat_attribute_map_t; +#include <string.h> + +/* maximum key range = 9, duplicates = 0 */ + +#ifdef __GNUC__ +#else +#ifdef __cplusplus +#endif +#endif +inline static unsigned int +xat_attribute_hash (register const char *str, register unsigned int len) +{ + static const unsigned char asso_values[] = + { + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 0, + 13, 13, 13, 13, 13, 5, 13, 5, 13, 0, + 13, 13, 13, 13, 13, 13, 0, 0, 13, 0, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13 + }; + return len + asso_values[(unsigned char)str[0]]; +} + +static const xat_attribute_map_t xat_attribute_table[] = + { + {"",XAT_COUNT_KWD}, {"",XAT_COUNT_KWD}, + {"",XAT_COUNT_KWD}, {"",XAT_COUNT_KWD}, + {"type", XAT_KWD_TYPE}, + {"words", XAT_KWD_WORDS}, + {"cooked", XAT_KWD_COOKED}, + {"members", XAT_KWD_MEMBERS}, + {"uncooked", XAT_KWD_UNCOOKED}, + {"keep", XAT_KWD_KEEP}, + {"",XAT_COUNT_KWD}, {"",XAT_COUNT_KWD}, + {"invalid", XAT_KWD_INVALID} + }; + +#ifdef __GNUC__ +#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ +__attribute__ ((__gnu_inline__)) +#endif +#endif +static inline const xat_attribute_map_t * +find_xat_attribute_name (register const char *str, register unsigned int len) +{ + if (len <= 8 && len >= 4) + { + register int key = xat_attribute_hash (str, len); + + if (key <= 12 && key >= 0) + { + register const char *s = xat_attribute_table[key].xat_name; + + if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0') + return &xat_attribute_table[key]; + } + } + return 0; +} + + +xat_attribute_enum_t +find_xat_attribute_id(char const * str, unsigned int len) +{ + const xat_attribute_map_t * p = + find_xat_attribute_name(str, len); + return (p == 0) ? XAT_KWD_INVALID : p->xat_id; +} diff --git a/sntp/libopts/xat-attribute.h b/sntp/libopts/xat-attribute.h new file mode 100644 index 0000000..079c59a --- /dev/null +++ b/sntp/libopts/xat-attribute.h @@ -0,0 +1,22 @@ +/* + * Generated header for gperf generated source Fri Apr 29 15:43:59 PDT 2011 + * This file enumerates the list of names and declares the + * procedure for mapping string names to the enum value. + */ +#ifndef AUTOOPTS_XAT_ATTRIBUTE_H_GUARD +#define AUTOOPTS_XAT_ATTRIBUTE_H_GUARD 1 + +typedef enum { + XAT_KWD_INVALID, + XAT_KWD_TYPE, + XAT_KWD_WORDS, + XAT_KWD_MEMBERS, + XAT_KWD_COOKED, + XAT_KWD_UNCOOKED, + XAT_KWD_KEEP, + XAT_COUNT_KWD +} xat_attribute_enum_t; + +extern xat_attribute_enum_t +find_xat_attribute_id(char const * str, unsigned int len); +#endif /* AUTOOPTS_XAT_ATTRIBUTE_H_GUARD */ diff --git a/sntp/log.c b/sntp/log.c new file mode 100644 index 0000000..8a524d2 --- /dev/null +++ b/sntp/log.c @@ -0,0 +1,40 @@ +#include <config.h> + +#include "log.h" + +char *progname = "sntp"; /* for msyslog use too */ + +static void cleanup_log(void); + +void +init_logging(void) +{ + openlog(progname, LOG_PID | LOG_CONS, OPENLOG_FAC); + msyslog_term = TRUE; +} + + +void +open_logfile( + const char *logfile + ) +{ + syslog_file = fopen(logfile, "a"); + if (syslog_file == NULL) { + msyslog(LOG_ERR, "sntp: Cannot open logfile %s", + logfile); + return; + } + syslogit = FALSE; + atexit(cleanup_log); +} + + +static void +cleanup_log(void) +{ + syslogit = TRUE; + fflush(syslog_file); + fclose(syslog_file); + syslog_file = NULL; +} diff --git a/sntp/log.h b/sntp/log.h new file mode 100644 index 0000000..b1878a0 --- /dev/null +++ b/sntp/log.h @@ -0,0 +1,25 @@ +#ifndef LOG_H +#define LOG_H + +#include "ntp.h" +#include "ntp_stdlib.h" +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> +#include <syslog.h> +#include <time.h> + +/* syslog as ntpd does, even though we are not a daemon */ +#ifdef LOG_NTP +# define OPENLOG_FAC LOG_NTP +#else +# ifndef LOG_DAEMON +# define LOG_DAEMON 0 +# endif +# define OPENLOG_FAC LOG_DAEMON +#endif + +void init_logging(void); +void open_logfile(const char *logfile); + +#endif diff --git a/sntp/ltmain.sh b/sntp/ltmain.sh index 06823e0..3061e3c 100644 --- a/sntp/ltmain.sh +++ b/sntp/ltmain.sh @@ -1,30 +1,129 @@ -# ltmain.sh - Provide generalized library-building support services. -# NOTE: Changing this file will not affect anything until you rerun configure. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 -# -# This program is free software; you can redistribute it and/or modify + +# libtool (GNU libtool) 2.4 +# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, +# 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool 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 +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, +# or obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# Usage: $progname [OPTION]... [MODE-ARG]... +# +# Provide generalized library-building support services. # -# 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. +# --config show all configuration variables +# --debug enable verbose shell tracing +# -n, --dry-run display commands without modifying any files +# --features display basic configuration information and exit +# --mode=MODE use operation mode MODE +# --preserve-dup-deps don't remove duplicate dependency libraries +# --quiet, --silent don't print informational messages +# --no-quiet, --no-silent +# print informational messages (default) +# --tag=TAG use configuration variables from tag TAG +# -v, --verbose print more informational messages than default +# --no-verbose don't print the extra informational messages +# --version print version information +# -h, --help, --help-all print short, long, or detailed help message +# +# MODE must be one of the following: +# +# clean remove files from the build directory +# compile compile a source file into a libtool object +# execute automatically set library path, then run a program +# finish complete the installation of libtool libraries +# install install libraries or executables +# link create a library or an executable +# uninstall remove libraries from an installed directory +# +# MODE-ARGS vary depending on the MODE. When passed as first option, +# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. +# Try `$progname --help --mode=MODE' for a more detailed description of MODE. +# +# When reporting a bug, please describe a test case to reproduce it and +# include the following information: +# +# host-triplet: $host +# shell: $SHELL +# compiler: $LTCC +# compiler flags: $LTCFLAGS +# linker: $LD (gnu? $with_gnu_ld) +# $progname: (GNU libtool) 2.4 +# automake: $automake_version +# autoconf: $autoconf_version +# +# Report bugs to <bug-libtool@gnu.org>. +# GNU libtool home page: <http://www.gnu.org/software/libtool/>. +# General help using GNU software: <http://www.gnu.org/gethelp/>. + +PROGRAM=libtool +PACKAGE=libtool +VERSION=2.4 +TIMESTAMP="" +package_revision=1.3293 + +# 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+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + +# NLS nuisances: We save the old values to restore during execute mode. +lt_user_locale= +lt_safe_locale= +for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test \"\${$lt_var+set}\" = set; then + save_$lt_var=\$$lt_var + $lt_var=C + export $lt_var + lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" + lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" + fi" +done +LC_ALL=C +LANGUAGE=C +export LANGUAGE LC_ALL + +$lt_unset CDPATH -basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of @@ -33,113 +132,427 @@ basename="s,^.*/,,g" # function. progpath="$0" -# The name of this program: -progname=`echo "$progpath" | $SED $basename` -modename="$progname" + + +: ${CP="cp -f"} +test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} +: ${EGREP="grep -E"} +: ${FGREP="grep -F"} +: ${GREP="grep"} +: ${LN_S="ln -s"} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SED="sed"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} +: ${Xsed="$SED -e 1s/^X//"} # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. -PROGRAM=ltmain.sh -PACKAGE=libtool -VERSION=1.5.22 -TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" +exit_status=$EXIT_SUCCESS -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes. -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi +# Make sure IFS has a sensible default +lt_nl=' +' +IFS=" $lt_nl" -# Check that we have a working $echo. -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then - # Yippee, $echo works! - : -else - # Restart under the correct shell, and then maybe $echo will work. - exec $SHELL "$progpath" --no-reexec ${1+"$@"} -fi +dirname="s,/[^/]*$,," +basename="s,^.*/,," -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat <<EOF -$* -EOF - exit $EXIT_SUCCESS -fi +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} # func_dirname may be replaced by extended shell implementation -default_mode= -help="Try \`$progname --help' for more information." -magic="%%%MAGIC variable%%%" -mkdir="mkdir" -mv="mv -f" -rm="rm -f" + +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "${1}" | $SED "$basename"` +} # func_basename may be replaced by extended shell implementation + + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi + func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` +} # func_dirname_and_basename may be replaced by extended shell implementation + + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname may be replaced by extended shell implementation + + +# These SED scripts presuppose an absolute path with a trailing slash. +pathcar='s,^/\([^/]*\).*$,\1,' +pathcdr='s,^/[^/]*,,' +removedotparts=':dotsl + s@/\./@/@g + t dotsl + s,/\.$,/,' +collapseslashes='s@/\{1,\}@/@g' +finalslash='s,/*$,/,' + +# func_normal_abspath PATH +# Remove doubled-up and trailing slashes, "." path components, +# and cancel out any ".." path components in PATH after making +# it an absolute path. +# value returned in "$func_normal_abspath_result" +func_normal_abspath () +{ + # Start from root dir and reassemble the path. + func_normal_abspath_result= + func_normal_abspath_tpath=$1 + func_normal_abspath_altnamespace= + case $func_normal_abspath_tpath in + "") + # Empty path, that just means $cwd. + func_stripname '' '/' "`pwd`" + func_normal_abspath_result=$func_stripname_result + return + ;; + # The next three entries are used to spot a run of precisely + # two leading slashes without using negated character classes; + # we take advantage of case's first-match behaviour. + ///*) + # Unusual form of absolute path, do nothing. + ;; + //*) + # Not necessarily an ordinary path; POSIX reserves leading '//' + # and for example Cygwin uses it to access remote file shares + # over CIFS/SMB, so we conserve a leading double slash if found. + func_normal_abspath_altnamespace=/ + ;; + /*) + # Absolute path, do nothing. + ;; + *) + # Relative path, prepend $cwd. + func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath + ;; + esac + # Cancel out all the simple stuff to save iterations. We also want + # the path to end with a slash for ease of parsing, so make sure + # there is one (and only one) here. + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` + while :; do + # Processed it all yet? + if test "$func_normal_abspath_tpath" = / ; then + # If we ascended to the root using ".." the result may be empty now. + if test -z "$func_normal_abspath_result" ; then + func_normal_abspath_result=/ + fi + break + fi + func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcar"` + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcdr"` + # Figure out what to do with it + case $func_normal_abspath_tcomponent in + "") + # Trailing empty path component, ignore it. + ;; + ..) + # Parent dir; strip last assembled component from result. + func_dirname "$func_normal_abspath_result" + func_normal_abspath_result=$func_dirname_result + ;; + *) + # Actual path component, append it. + func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent + ;; + esac + done + # Restore leading double-slash if one was found on entry. + func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result +} + +# func_relative_path SRCDIR DSTDIR +# generates a relative path from SRCDIR to DSTDIR, with a trailing +# slash if non-empty, suitable for immediately appending a filename +# without needing to append a separator. +# value returned in "$func_relative_path_result" +func_relative_path () +{ + func_relative_path_result= + func_normal_abspath "$1" + func_relative_path_tlibdir=$func_normal_abspath_result + func_normal_abspath "$2" + func_relative_path_tbindir=$func_normal_abspath_result + + # Ascend the tree starting from libdir + while :; do + # check if we have found a prefix of bindir + case $func_relative_path_tbindir in + $func_relative_path_tlibdir) + # found an exact match + func_relative_path_tcancelled= + break + ;; + $func_relative_path_tlibdir*) + # found a matching prefix + func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" + func_relative_path_tcancelled=$func_stripname_result + if test -z "$func_relative_path_result"; then + func_relative_path_result=. + fi + break + ;; + *) + func_dirname $func_relative_path_tlibdir + func_relative_path_tlibdir=${func_dirname_result} + if test "x$func_relative_path_tlibdir" = x ; then + # Have to descend all the way to the root! + func_relative_path_result=../$func_relative_path_result + func_relative_path_tcancelled=$func_relative_path_tbindir + break + fi + func_relative_path_result=../$func_relative_path_result + ;; + esac + done + + # Now calculate path; take care to avoid doubling-up slashes. + func_stripname '' '/' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + func_stripname '/' '/' "$func_relative_path_tcancelled" + if test "x$func_stripname_result" != x ; then + func_relative_path_result=${func_relative_path_result}/${func_stripname_result} + fi + + # Normalisation. If bindir is libdir, return empty string, + # else relative path ending with a slash; either way, target + # file name can be directly appended. + if test ! -z "$func_relative_path_result"; then + func_stripname './' '' "$func_relative_path_result/" + func_relative_path_result=$func_stripname_result + fi +} + +# The name of this program: +func_dirname_and_basename "$progpath" +progname=$func_basename_result + +# Make sure we have an absolute path for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=$func_dirname_result + progdir=`cd "$progdir" && pwd` + progpath="$progdir/$progname" + ;; + *) + save_IFS="$IFS" + IFS=: + for progdir in $PATH; do + IFS="$save_IFS" + test -x "$progdir/$progname" && break + done + IFS="$save_IFS" + test -n "$progdir" || progdir=`pwd` + progpath="$progdir/$progname" + ;; +esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' -sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - SP2NL='tr \040 \012' - NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - SP2NL='tr \100 \n' - NL2SP='tr \r\n \100\100' - ;; -esac +sed_quote_subst='s/\([`"$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution that turns a string into a regex matching for the +# string literally. +sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' + +# Sed substitution that converts a w32 file name or path +# which contains forward slashes, into one that contains +# (escaped) backslashes. A very naive implementation. +lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + +# Re-`\' parameter expansions in output of double_quote_subst that were +# `\'-ed in input to the same. If an odd number of `\' preceded a '$' +# in input to double_quote_subst, that '$' was protected from expansion. +# Since each input `\' is now two `\'s, look for any number of runs of +# four `\'s followed by two `\'s and then a '$'. `\' that '$'. +bs='\\' +bs2='\\\\' +bs4='\\\\\\\\' +dollar='\$' +sed_double_backslash="\ + s/$bs4/&\\ +/g + s/^$bs2$dollar/$bs&/ + s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g + s/\n//g" + +# Standard options: +opt_dry_run=false +opt_help=false +opt_quiet=false +opt_verbose=false +opt_warning=: + +# func_echo arg... +# Echo program name prefixed message, along with the current mode +# name if it has been set yet. +func_echo () +{ + $ECHO "$progname: ${opt_mode+$opt_mode: }$*" +} -# NLS nuisances. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -# We save the old values to restore during execute mode. -if test "${LC_ALL+set}" = set; then - save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL -fi -if test "${LANG+set}" = set; then - save_LANG="$LANG"; LANG=C; export LANG -fi +# func_verbose arg... +# Echo program name prefixed message in verbose mode only. +func_verbose () +{ + $opt_verbose && func_echo ${1+"$@"} -# Make sure IFS has a sensible default -lt_nl=' -' -IFS=" $lt_nl" + # A bug in bash halts the script if the last line of a function + # fails when set -e is in force, so we need another command to + # work around that: + : +} -if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - $echo "$modename: not configured to build any kind of library" 1>&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit $EXIT_FAILURE -fi +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} -# Global variables. -mode=$default_mode -nonopt= -prev= -prevopt= -run= -show="$echo" -show_help= -execute_dlfiles= -duplicate_deps=no -preserve_args= -lo2o="s/\\.lo\$/.${objext}/" -o2lo="s/\\.${objext}\$/.lo/" +# func_error arg... +# Echo program name prefixed message to standard error. +func_error () +{ + $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 +} + +# func_warning arg... +# Echo program name prefixed warning message to standard error. +func_warning () +{ + $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 + + # bash bug again: + : +} + +# func_fatal_error arg... +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () +{ + func_error ${1+"$@"} + exit $EXIT_FAILURE +} + +# func_fatal_help arg... +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + func_error ${1+"$@"} + func_fatal_error "$help" +} +help="Try \`$progname --help' for more information." ## default + + +# func_grep expression filename +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $GREP "$1" "$2" >/dev/null 2>&1 +} + + +# func_mkdir_p directory-path +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + my_directory_path="$1" + my_dir_list= + + if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then + + # Protect directory names starting with `-' + case $my_directory_path in + -*) my_directory_path="./$my_directory_path" ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$my_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + my_dir_list="$my_directory_path:$my_dir_list" + + # If the last portion added has no slash in it, the list is done + case $my_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` + done + my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` + + save_mkdir_p_IFS="$IFS"; IFS=':' + for my_dir in $my_dir_list; do + IFS="$save_mkdir_p_IFS" + # mkdir can fail with a `File exist' error if two processes + # try to create one of the directories concurrently. Don't + # stop in that case! + $MKDIR "$my_dir" 2>/dev/null || : + done + IFS="$save_mkdir_p_IFS" + + # Bail out if we (or some other process) failed to create a directory. + test -d "$my_directory_path" || \ + func_fatal_error "Failed to create \`$1'" + fi +} -##################################### -# Shell function definitions: -# This seems to be the best place for them # func_mktempdir [string] # Make a temporary directory that won't clash with other running @@ -149,7 +562,7 @@ func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" - if test "$run" = ":"; then + if test "$opt_dry_run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else @@ -158,65 +571,799 @@ func_mktempdir () my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then - # Failing that, at least try and use $RANDOM to avoid a race - my_tmpdir="${my_template}-${RANDOM-0}$$" + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" - save_mktempdir_umask=`umask` - umask 0077 - $mkdir "$my_tmpdir" - umask $save_mktempdir_umask + save_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$my_tmpdir" + umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure - test -d "$my_tmpdir" || { - $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 - exit $EXIT_FAILURE - } + test -d "$my_tmpdir" || \ + func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi - $echo "X$my_tmpdir" | $Xsed + $ECHO "$my_tmpdir" } -# func_win32_libid arg -# return the library type of file 'arg' -# -# Need a lot of goo to handle *both* DLLs and import libs -# Has to be a shell function in order to 'eat' the argument -# that is supplied when $file_magic_command is called. -func_win32_libid () +# func_quote_for_eval arg +# Aesthetically quote ARG to be evaled later. +# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT +# is double-quoted, suitable for a subsequent eval, whereas +# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters +# which are still active within double quotes backslashified. +func_quote_for_eval () { - win32_libid_type="unknown" - win32_fileres=`file -L $1 2>/dev/null` - case $win32_fileres in - *ar\ archive\ import\ library*) # definitely import - win32_libid_type="x86 archive import" - ;; - *ar\ archive*) # could be an import, or static - if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ - $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then - win32_nmres=`eval $NM -f posix -A $1 | \ - $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` - case $win32_nmres in - import*) win32_libid_type="x86 archive import";; - *) win32_libid_type="x86 archive static";; - esac + case $1 in + *[\\\`\"\$]*) + func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; + *) + func_quote_for_eval_unquoted_result="$1" ;; + esac + + case $func_quote_for_eval_unquoted_result in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and and variable + # expansion for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" + ;; + *) + func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" + esac +} + + +# func_quote_for_expand arg +# Aesthetically quote ARG to be evaled later; same as above, +# but do not quote variable references. +func_quote_for_expand () +{ + case $1 in + *[\\\`\"]*) + my_arg=`$ECHO "$1" | $SED \ + -e "$double_quote_subst" -e "$sed_double_backslash"` ;; + *) + my_arg="$1" ;; + esac + + case $my_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting and command substitution for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + my_arg="\"$my_arg\"" + ;; + esac + + func_quote_for_expand_result="$my_arg" +} + + +# func_show_eval cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. +func_show_eval () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$my_cmd" + my_status=$? + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + + +# func_show_eval_locale cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. Use the saved locale for evaluation. +func_show_eval_locale () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$lt_user_locale + $my_cmd" + my_status=$? + eval "$lt_safe_locale" + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi fi +} + +# func_tr_sh +# Turn $1 into a string suitable for a shell variable name. +# Result is stored in $func_tr_sh_result. All characters +# not in the set a-zA-Z0-9_ are replaced with '_'. Further, +# if $1 begins with a digit, a '_' is prepended as well. +func_tr_sh () +{ + case $1 in + [0-9]* | *[!a-zA-Z0-9_]*) + func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` ;; - *DLL*) - win32_libid_type="x86 DLL" + * ) + func_tr_sh_result=$1 ;; - *executable*) # but shell scripts are "executable" too... - case $win32_fileres in - *MS\ Windows\ PE\ Intel*) - win32_libid_type="x86 DLL" + esac +} + + +# func_version +# Echo version message to standard output and exit. +func_version () +{ + $opt_debug + + $SED -n '/(C)/!b go + :more + /\./!{ + N + s/\n# / / + b more + } + :go + /^# '$PROGRAM' (GNU /,/# warranty; / { + s/^# // + s/^# *$// + s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ + p + }' < "$progpath" + exit $? +} + +# func_usage +# Echo short help message to standard output and exit. +func_usage () +{ + $opt_debug + + $SED -n '/^# Usage:/,/^# *.*--help/ { + s/^# // + s/^# *$// + s/\$progname/'$progname'/ + p + }' < "$progpath" + echo + $ECHO "run \`$progname --help | more' for full usage" + exit $? +} + +# func_help [NOEXIT] +# Echo long help message to standard output and exit, +# unless 'noexit' is passed as argument. +func_help () +{ + $opt_debug + + $SED -n '/^# Usage:/,/# Report bugs to/ { + :print + s/^# // + s/^# *$// + s*\$progname*'$progname'* + s*\$host*'"$host"'* + s*\$SHELL*'"$SHELL"'* + s*\$LTCC*'"$LTCC"'* + s*\$LTCFLAGS*'"$LTCFLAGS"'* + s*\$LD*'"$LD"'* + s/\$with_gnu_ld/'"$with_gnu_ld"'/ + s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ + s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ + p + d + } + /^# .* home page:/b print + /^# General help using/b print + ' < "$progpath" + ret=$? + if test -z "$1"; then + exit $ret + fi +} + +# func_missing_arg argname +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + $opt_debug + + func_error "missing argument for $1." + exit_cmd=exit +} + + +# func_split_short_opt shortopt +# Set func_split_short_opt_name and func_split_short_opt_arg shell +# variables after splitting SHORTOPT after the 2nd character. +func_split_short_opt () +{ + my_sed_short_opt='1s/^\(..\).*$/\1/;q' + my_sed_short_rest='1s/^..\(.*\)$/\1/;q' + + func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` + func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` +} # func_split_short_opt may be replaced by extended shell implementation + + +# func_split_long_opt longopt +# Set func_split_long_opt_name and func_split_long_opt_arg shell +# variables after splitting LONGOPT at the `=' sign. +func_split_long_opt () +{ + my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' + my_sed_long_arg='1s/^--[^=]*=//' + + func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` + func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` +} # func_split_long_opt may be replaced by extended shell implementation + +exit_cmd=: + + + + + +magic="%%%MAGIC variable%%%" +magic_exe="%%%MAGIC EXE variable%%%" + +# Global variables. +nonopt= +preserve_args= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" +extracted_archives= +extracted_serial=0 + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "${1}=\$${1}\${2}" +} # func_append may be replaced by extended shell implementation + +# func_append_quoted var value +# Quote VALUE and append to the end of shell variable VAR, separated +# by a space. +func_append_quoted () +{ + func_quote_for_eval "${2}" + eval "${1}=\$${1}\\ \$func_quote_for_eval_result" +} # func_append_quoted may be replaced by extended shell implementation + + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "${@}"` +} # func_arith may be replaced by extended shell implementation + + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` +} # func_len may be replaced by extended shell implementation + + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` +} # func_lo2o may be replaced by extended shell implementation + + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` +} # func_xform may be replaced by extended shell implementation + + +# func_fatal_configuration arg... +# Echo program name prefixed message to standard error, followed by +# a configuration failure hint, and exit. +func_fatal_configuration () +{ + func_error ${1+"$@"} + func_error "See the $PACKAGE documentation for more information." + func_fatal_error "Fatal configuration error." +} + + +# func_config +# Display the configuration for all the tags in this script. +func_config () +{ + re_begincf='^# ### BEGIN LIBTOOL' + re_endcf='^# ### END LIBTOOL' + + # Default configuration. + $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" + + # Now print the configurations for the tags. + for tagname in $taglist; do + $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" + done + + exit $? +} + +# func_features +# Display the features supported by this script. +func_features () +{ + echo "host: $host" + if test "$build_libtool_libs" = yes; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + + exit $? +} + +# func_enable_tag tagname +# Verify that TAGNAME is valid, and either flag an error and exit, or +# enable the TAGNAME tag. We also add TAGNAME to the global $taglist +# variable here. +func_enable_tag () +{ + # Global variable: + tagname="$1" + + re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" + re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" + sed_extractcf="/$re_begincf/,/$re_endcf/p" + + # Validate tagname. + case $tagname in + *[!-_A-Za-z0-9,/]*) + func_fatal_error "invalid tag name: $tagname" ;; + esac + + # Don't test for the "default" C tag, as we know it's + # there but not specially marked. + case $tagname in + CC) ;; + *) + if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then + taglist="$taglist $tagname" + + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac +} + +# func_check_version_match +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () +{ + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF + fi + + exit $EXIT_MISMATCH + fi +} + + +# Shorthand for --mode=foo, only valid as the first argument +case $1 in +clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; +compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; +execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; +finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; +install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; +link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; +uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; +esac + + + +# Option defaults: +opt_debug=: +opt_dry_run=false +opt_config=false +opt_preserve_dup_deps=false +opt_features=false +opt_finish=false +opt_help=false +opt_help_all=false +opt_silent=: +opt_verbose=: +opt_silent=false +opt_verbose=false + + +# Parse options once, thoroughly. This comes as soon as possible in the +# script to make things like `--version' happen as quickly as we can. +{ + # this just eases exit handling + while test $# -gt 0; do + opt="$1" + shift + case $opt in + --debug|-x) opt_debug='set -x' + func_echo "enabling shell trace mode" + $opt_debug + ;; + --dry-run|--dryrun|-n) + opt_dry_run=: + ;; + --config) + opt_config=: +func_config + ;; + --dlopen|-dlopen) + optarg="$1" + opt_dlopen="${opt_dlopen+$opt_dlopen +}$optarg" + shift + ;; + --preserve-dup-deps) + opt_preserve_dup_deps=: + ;; + --features) + opt_features=: +func_features + ;; + --finish) + opt_finish=: +set dummy --mode finish ${1+"$@"}; shift + ;; + --help) + opt_help=: + ;; + --help-all) + opt_help_all=: +opt_help=': help-all' + ;; + --mode) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_mode="$optarg" +case $optarg in + # Valid mode arguments: + clean|compile|execute|finish|install|link|relink|uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $opt" + exit_cmd=exit + break + ;; +esac + shift + ;; + --no-silent|--no-quiet) + opt_silent=false +func_append preserve_args " $opt" + ;; + --no-verbose) + opt_verbose=false +func_append preserve_args " $opt" + ;; + --silent|--quiet) + opt_silent=: +func_append preserve_args " $opt" + opt_verbose=false + ;; + --verbose|-v) + opt_verbose=: +func_append preserve_args " $opt" +opt_silent=false + ;; + --tag) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_tag="$optarg" +func_append preserve_args " $opt $optarg" +func_enable_tag "$optarg" + shift + ;; + + -\?|-h) func_usage ;; + --help) func_help ;; + --version) func_version ;; + + # Separate optargs to long options: + --*=*) + func_split_long_opt "$opt" + set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} + shift + ;; + + # Separate non-argument short options: + -\?*|-h*|-n*|-v*) + func_split_short_opt "$opt" + set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + --) break ;; + -*) func_fatal_help "unrecognized option \`$opt'" ;; + *) set dummy "$opt" ${1+"$@"}; shift; break ;; + esac + done + + # Validate options: + + # save first non-option argument + if test "$#" -gt 0; then + nonopt="$opt" + shift + fi + + # preserve --debug + test "$opt_debug" = : || func_append preserve_args " --debug" + + case $host in + *cygwin* | *mingw* | *pw32* | *cegcc*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps + ;; + esac + + $opt_help || { + # Sanity checks first: + func_check_version_match + + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + func_fatal_configuration "not configured to build any kind of library" + fi + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$opt_dlopen" && test "$opt_mode" != execute; then + func_error "unrecognized option \`-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$progname --help --mode=$opt_mode' for more information." + } + + + # Bail if the options were screwed + $exit_cmd $EXIT_FAILURE +} + + + + +## ----------- ## +## Main. ## +## ----------- ## + +# func_lalib_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_lalib_p () +{ + test -f "$1" && + $SED -e 4q "$1" 2>/dev/null \ + | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + +# func_lalib_unsafe_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function implements the same check as func_lalib_p without +# resorting to external programs. To this end, it redirects stdin and +# closes it afterwards, without saving the original file descriptor. +# As a safety measure, use it only where a negative result would be +# fatal anyway. Works if `file' does not exist. +func_lalib_unsafe_p () +{ + lalib_p=no + if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then + for lalib_p_l in 1 2 3 4 + do + read lalib_p_line + case "$lalib_p_line" in + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; + esac + done + exec 0<&5 5<&- + fi + test "$lalib_p" = yes +} + +# func_ltwrapper_script_p file +# True iff FILE is a libtool wrapper script +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_script_p () +{ + func_lalib_p "$1" +} + +# func_ltwrapper_executable_p file +# True iff FILE is a libtool wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_executable_p () +{ + func_ltwrapper_exec_suffix= + case $1 in + *.exe) ;; + *) func_ltwrapper_exec_suffix=.exe ;; esac + $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 +} + +# func_ltwrapper_scriptname file +# Assumes file is an ltwrapper_executable +# uses $file to determine the appropriate filename for a +# temporary ltwrapper_script. +func_ltwrapper_scriptname () +{ + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" +} + +# func_ltwrapper_p file +# True iff FILE is a libtool wrapper script or wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_p () +{ + func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" +} + + +# func_execute_cmds commands fail_cmd +# Execute tilde-delimited COMMANDS. +# If FAIL_CMD is given, eval that upon failure. +# FAIL_CMD may read-access the current command in variable CMD! +func_execute_cmds () +{ + $opt_debug + save_ifs=$IFS; IFS='~' + for cmd in $1; do + IFS=$save_ifs + eval cmd=\"$cmd\" + func_show_eval "$cmd" "${2-:}" + done + IFS=$save_ifs +} + + +# func_source file +# Source FILE, adding directory component if necessary. +# Note that it is not necessary on cygwin/mingw to append a dot to +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe +# behavior happens only for exec(3), not for open(2)! Also, sourcing +# `FILE.' does not work on cygwin managed mounts. +func_source () +{ + $opt_debug + case $1 in + */* | *\\*) . "$1" ;; + *) . "./$1" ;; + esac +} + + +# func_resolve_sysroot PATH +# Replace a leading = in PATH with a sysroot. Store the result into +# func_resolve_sysroot_result +func_resolve_sysroot () +{ + func_resolve_sysroot_result=$1 + case $func_resolve_sysroot_result in + =*) + func_stripname '=' '' "$func_resolve_sysroot_result" + func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac - $echo $win32_libid_type } +# func_replace_sysroot PATH +# If PATH begins with the sysroot, replace it with = and +# store the result into func_replace_sysroot_result. +func_replace_sysroot () +{ + case "$lt_sysroot:$1" in + ?*:"$lt_sysroot"*) + func_stripname "$lt_sysroot" '' "$1" + func_replace_sysroot_result="=$func_stripname_result" + ;; + *) + # Including no sysroot. + func_replace_sysroot_result=$1 + ;; + esac +} # func_infer_tag arg # Infer tagged configuration to use if any are available and @@ -226,39 +1373,36 @@ func_win32_libid () # arg is usually of the form 'gcc ...' func_infer_tag () { + $opt_debug if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - CC_quoted="$CC_quoted $arg" + func_append_quoted CC_quoted "$arg" done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do - # Double-quote args containing other shell metacharacters. - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - CC_quoted="$CC_quoted $arg" - done + # Double-quote args containing other shell metacharacters. + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in - " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. @@ -272,11 +1416,10 @@ func_infer_tag () # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then - $echo "$modename: unable to infer tagged configuration" - $echo "$modename: specify a tag with \`--tag'" 1>&2 - exit $EXIT_FAILURE -# else -# $echo "$modename: using $tagname tagged configuration" + func_echo "unable to infer tagged configuration" + func_fatal_error "specify a tag with \`--tag'" +# else +# func_verbose "using $tagname tagged configuration" fi ;; esac @@ -284,343 +1427,528 @@ func_infer_tag () } -# func_extract_an_archive dir oldlib -func_extract_an_archive () + +# func_write_libtool_object output_name pic_name nonpic_name +# Create a libtool object file (analogous to a ".la" file), +# but don't create it if we're doing a dry run. +func_write_libtool_object () { - f_ex_an_ar_dir="$1"; shift - f_ex_an_ar_oldlib="$1" + write_libobj=${1} + if test "$build_libtool_libs" = yes; then + write_lobj=\'${2}\' + else + write_lobj=none + fi - $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" - $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? - if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then - : + if test "$build_old_libs" = yes; then + write_oldobj=\'${3}\' else - $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 - exit $EXIT_FAILURE + write_oldobj=none fi + + $opt_dry_run || { + cat >${write_libobj}T <<EOF +# $write_libobj - a libtool object file +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object=$write_lobj + +# Name of the non-PIC object +non_pic_object=$write_oldobj + +EOF + $MV "${write_libobj}T" "${write_libobj}" + } } -# func_extract_archives gentop oldlib ... -func_extract_archives () + +################################################## +# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS # +################################################## + +# func_convert_core_file_wine_to_w32 ARG +# Helper function used by file name conversion functions when $build is *nix, +# and $host is mingw, cygwin, or some other w32 environment. Relies on a +# correctly configured wine environment available, with the winepath program +# in $build's $PATH. +# +# ARG is the $build file name to be converted to w32 format. +# Result is available in $func_convert_core_file_wine_to_w32_result, and will +# be empty on error (or when ARG is empty) +func_convert_core_file_wine_to_w32 () { - my_gentop="$1"; shift - my_oldlibs=${1+"$@"} - my_oldobjs="" - my_xlib="" - my_xabs="" - my_xdir="" - my_status="" - - $show "${rm}r $my_gentop" - $run ${rm}r "$my_gentop" - $show "$mkdir $my_gentop" - $run $mkdir "$my_gentop" - my_status=$? - if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then - exit $my_status + $opt_debug + func_convert_core_file_wine_to_w32_result="$1" + if test -n "$1"; then + # Unfortunately, winepath does not exit with a non-zero error code, so we + # are forced to check the contents of stdout. On the other hand, if the + # command is not found, the shell will set an exit code of 127 and print + # *an error message* to stdout. So we must check for both error code of + # zero AND non-empty stdout, which explains the odd construction: + func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null` + if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then + func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | + $SED -e "$lt_sed_naive_backslashify"` + else + func_convert_core_file_wine_to_w32_result= fi + fi +} +# end: func_convert_core_file_wine_to_w32 - for my_xlib in $my_oldlibs; do - # Extract the objects. - case $my_xlib in - [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; - *) my_xabs=`pwd`"/$my_xlib" ;; - esac - my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` - my_xdir="$my_gentop/$my_xlib" - - $show "${rm}r $my_xdir" - $run ${rm}r "$my_xdir" - $show "$mkdir $my_xdir" - $run $mkdir "$my_xdir" - exit_status=$? - if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then - exit $exit_status + +# func_convert_core_path_wine_to_w32 ARG +# Helper function used by path conversion functions when $build is *nix, and +# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly +# configured wine environment available, with the winepath program in $build's +# $PATH. Assumes ARG has no leading or trailing path separator characters. +# +# ARG is path to be converted from $build format to win32. +# Result is available in $func_convert_core_path_wine_to_w32_result. +# Unconvertible file (directory) names in ARG are skipped; if no directory names +# are convertible, then the result may be empty. +func_convert_core_path_wine_to_w32 () +{ + $opt_debug + # unfortunately, winepath doesn't convert paths, only file names + func_convert_core_path_wine_to_w32_result="" + if test -n "$1"; then + oldIFS=$IFS + IFS=: + for func_convert_core_path_wine_to_w32_f in $1; do + IFS=$oldIFS + func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" + if test -n "$func_convert_core_file_wine_to_w32_result" ; then + if test -z "$func_convert_core_path_wine_to_w32_result"; then + func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" + else + func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" + fi fi - case $host in - *-darwin*) - $show "Extracting $my_xabs" - # Do not bother doing anything if just a dry run - if test -z "$run"; then - darwin_orig_dir=`pwd` - cd $my_xdir || exit $? - darwin_archive=$my_xabs - darwin_curdir=`pwd` - darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` - darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` - if test -n "$darwin_arches"; then - darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` - darwin_arch= - $show "$darwin_base_archive has multiple architectures $darwin_arches" - for darwin_arch in $darwin_arches ; do - mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" - lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" - cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" - func_extract_an_archive "`pwd`" "${darwin_base_archive}" - cd "$darwin_curdir" - $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" - done # $darwin_arches - ## Okay now we have a bunch of thin objects, gotta fatten them up :) - darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` - darwin_file= - darwin_files= - for darwin_file in $darwin_filelist; do - darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` - lipo -create -output "$darwin_file" $darwin_files - done # $darwin_filelist - ${rm}r unfat-$$ - cd "$darwin_orig_dir" - else - cd "$darwin_orig_dir" - func_extract_an_archive "$my_xdir" "$my_xabs" - fi # $darwin_arches - fi # $run - ;; - *) - func_extract_an_archive "$my_xdir" "$my_xabs" - ;; - esac - my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done - func_extract_archives_result="$my_oldobjs" + IFS=$oldIFS + fi +} +# end: func_convert_core_path_wine_to_w32 + + +# func_cygpath ARGS... +# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when +# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) +# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or +# (2), returns the Cygwin file name or path in func_cygpath_result (input +# file name or path is assumed to be in w32 format, as previously converted +# from $build's *nix or MSYS format). In case (3), returns the w32 file name +# or path in func_cygpath_result (input file name or path is assumed to be in +# Cygwin format). Returns an empty string on error. +# +# ARGS are passed to cygpath, with the last one being the file name or path to +# be converted. +# +# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH +# environment variable; do not put it in $PATH. +func_cygpath () +{ + $opt_debug + if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then + func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` + if test "$?" -ne 0; then + # on failure, ensure result is empty + func_cygpath_result= + fi + else + func_cygpath_result= + func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" + fi } -# End of Shell function definitions -##################################### +#end: func_cygpath -# Darwin sucks -eval std_shrext=\"$shrext_cmds\" -disable_libs=no +# func_convert_core_msys_to_w32 ARG +# Convert file name or path ARG from MSYS format to w32 format. Return +# result in func_convert_core_msys_to_w32_result. +func_convert_core_msys_to_w32 () +{ + $opt_debug + # awkward: cmd appends spaces to result + func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | + $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` +} +#end: func_convert_core_msys_to_w32 -# Parse our command line options once, thoroughly. -while test "$#" -gt 0 -do - arg="$1" - shift - case $arg in - -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; +# func_convert_file_check ARG1 ARG2 +# Verify that ARG1 (a file name in $build format) was converted to $host +# format in ARG2. Otherwise, emit an error message, but continue (resetting +# func_to_host_file_result to ARG1). +func_convert_file_check () +{ + $opt_debug + if test -z "$2" && test -n "$1" ; then + func_error "Could not determine host file name corresponding to" + func_error " \`$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_file_result="$1" + fi +} +# end func_convert_file_check + + +# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH +# Verify that FROM_PATH (a path in $build format) was converted to $host +# format in TO_PATH. Otherwise, emit an error message, but continue, resetting +# func_to_host_file_result to a simplistic fallback value (see below). +func_convert_path_check () +{ + $opt_debug + if test -z "$4" && test -n "$3"; then + func_error "Could not determine the host path corresponding to" + func_error " \`$3'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This is a deliberately simplistic "conversion" and + # should not be "improved". See libtool.info. + if test "x$1" != "x$2"; then + lt_replace_pathsep_chars="s|$1|$2|g" + func_to_host_path_result=`echo "$3" | + $SED -e "$lt_replace_pathsep_chars"` + else + func_to_host_path_result="$3" + fi + fi +} +# end func_convert_path_check + + +# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG +# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT +# and appending REPL if ORIG matches BACKPAT. +func_convert_path_front_back_pathsep () +{ + $opt_debug + case $4 in + $1 ) func_to_host_path_result="$3$func_to_host_path_result" + ;; esac + case $4 in + $2 ) func_append func_to_host_path_result "$3" + ;; + esac +} +# end func_convert_path_front_back_pathsep - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - execute_dlfiles) - execute_dlfiles="$execute_dlfiles $arg" - ;; - tag) - tagname="$arg" - preserve_args="${preserve_args}=$arg" - - # Check whether tagname contains only valid characters - case $tagname in - *[!-_A-Za-z0-9,/]*) - $echo "$progname: invalid tag name: $tagname" 1>&2 - exit $EXIT_FAILURE - ;; - esac - case $tagname in - CC) - # Don't test for the "default" C tag, as we know, it's there, but - # not specially marked. - ;; - *) - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then - taglist="$taglist $tagname" - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" - else - $echo "$progname: ignoring unknown tag $tagname" 1>&2 - fi - ;; - esac +################################################## +# $build to $host FILE NAME CONVERSION FUNCTIONS # +################################################## +# invoked via `$to_host_file_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# Result will be available in $func_to_host_file_result. + + +# func_to_host_file ARG +# Converts the file name ARG from $build format to $host format. Return result +# in func_to_host_file_result. +func_to_host_file () +{ + $opt_debug + $to_host_file_cmd "$1" +} +# end func_to_host_file + + +# func_to_tool_file ARG LAZY +# converts the file name ARG from $build format to toolchain format. Return +# result in func_to_tool_file_result. If the conversion in use is listed +# in (the comma separated) LAZY, no conversion takes place. +func_to_tool_file () +{ + $opt_debug + case ,$2, in + *,"$to_tool_file_cmd",*) + func_to_tool_file_result=$1 ;; *) - eval "$prev=\$arg" + $to_tool_file_cmd "$1" + func_to_tool_file_result=$func_to_host_file_result ;; - esac + esac +} +# end func_to_tool_file - prev= - prevopt= - continue + +# func_convert_file_noop ARG +# Copy ARG to func_to_host_file_result. +func_convert_file_noop () +{ + func_to_host_file_result="$1" +} +# end func_convert_file_noop + + +# func_convert_file_msys_to_w32 ARG +# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_file_result. +func_convert_file_msys_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_to_host_file_result="$func_convert_core_msys_to_w32_result" fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_w32 - # Have we seen a non-optional argument yet? - case $arg in - --help) - show_help=yes - ;; - --version) - $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" - $echo - $echo "Copyright (C) 2005 Free Software Foundation, Inc." - $echo "This is free software; see the source for copying conditions. There is NO" - $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - exit $? - ;; +# func_convert_file_cygwin_to_w32 ARG +# Convert file name ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_file_cygwin_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # because $build is cygwin, we call "the" cygpath in $PATH; no need to use + # LT_CYGPATH in this case. + func_to_host_file_result=`cygpath -m "$1"` + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_cygwin_to_w32 - --config) - ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath - # Now print the configurations for the tags. - for tagname in $taglist; do - ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" - done - exit $? - ;; - --debug) - $echo "$progname: enabling shell trace mode" - set -x - preserve_args="$preserve_args $arg" - ;; +# func_convert_file_nix_to_w32 ARG +# Convert file name ARG from *nix to w32 format. Requires a wine environment +# and a working winepath. Returns result in func_to_host_file_result. +func_convert_file_nix_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_file_wine_to_w32 "$1" + func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_w32 - --dry-run | -n) - run=: - ;; - --features) - $echo "host: $host" - if test "$build_libtool_libs" = yes; then - $echo "enable shared libraries" - else - $echo "disable shared libraries" - fi - if test "$build_old_libs" = yes; then - $echo "enable static libraries" - else - $echo "disable static libraries" - fi - exit $? - ;; +# func_convert_file_msys_to_cygwin ARG +# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_file_msys_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_cygpath -u "$func_convert_core_msys_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_cygwin - --finish) mode="finish" ;; - --mode) prevopt="--mode" prev=mode ;; - --mode=*) mode="$optarg" ;; +# func_convert_file_nix_to_cygwin ARG +# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed +# in a wine environment, working winepath, and LT_CYGPATH set. Returns result +# in func_to_host_file_result. +func_convert_file_nix_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. + func_convert_core_file_wine_to_w32 "$1" + func_cygpath -u "$func_convert_core_file_wine_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_cygwin - --preserve-dup-deps) duplicate_deps="yes" ;; - --quiet | --silent) - show=: - preserve_args="$preserve_args $arg" - ;; +############################################# +# $build to $host PATH CONVERSION FUNCTIONS # +############################################# +# invoked via `$to_host_path_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# The result will be available in $func_to_host_path_result. +# +# Path separators are also converted from $build format to $host format. If +# ARG begins or ends with a path separator character, it is preserved (but +# converted to $host format) on output. +# +# All path conversion functions are named using the following convention: +# file name conversion function : func_convert_file_X_to_Y () +# path conversion function : func_convert_path_X_to_Y () +# where, for any given $build/$host combination the 'X_to_Y' value is the +# same. If conversion functions are added for new $build/$host combinations, +# the two new functions must follow this pattern, or func_init_to_host_path_cmd +# will break. + + +# func_init_to_host_path_cmd +# Ensures that function "pointer" variable $to_host_path_cmd is set to the +# appropriate value, based on the value of $to_host_file_cmd. +to_host_path_cmd= +func_init_to_host_path_cmd () +{ + $opt_debug + if test -z "$to_host_path_cmd"; then + func_stripname 'func_convert_file_' '' "$to_host_file_cmd" + to_host_path_cmd="func_convert_path_${func_stripname_result}" + fi +} - --tag) - prevopt="--tag" - prev=tag - preserve_args="$preserve_args --tag" - ;; - --tag=*) - set tag "$optarg" ${1+"$@"} - shift - prev=tag - preserve_args="$preserve_args --tag" - ;; - -dlopen) - prevopt="-dlopen" - prev=execute_dlfiles - ;; +# func_to_host_path ARG +# Converts the path ARG from $build format to $host format. Return result +# in func_to_host_path_result. +func_to_host_path () +{ + $opt_debug + func_init_to_host_path_cmd + $to_host_path_cmd "$1" +} +# end func_to_host_path - -*) - $echo "$modename: unrecognized option \`$arg'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - *) - nonopt="$arg" - break - ;; - esac -done +# func_convert_path_noop ARG +# Copy ARG to func_to_host_path_result. +func_convert_path_noop () +{ + func_to_host_path_result="$1" +} +# end func_convert_path_noop -if test -n "$prevopt"; then - $echo "$modename: option \`$prevopt' requires an argument" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE -fi -case $disable_libs in -no) - ;; -shared) - build_libtool_libs=no - build_old_libs=yes - ;; -static) - build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` - ;; -esac +# func_convert_path_msys_to_w32 ARG +# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_path_result. +func_convert_path_msys_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from ARG. MSYS + # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; + # and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_msys_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_msys_to_w32 -# If this variable is set in any of the actions, the command in it -# will be execed at the end. This prevents here-documents from being -# left over by shells. -exec_cmd= -if test -z "$show_help"; then +# func_convert_path_cygwin_to_w32 ARG +# Convert path ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_path_cygwin_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_cygwin_to_w32 - # Infer the operation mode. - if test -z "$mode"; then - $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 - $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 - case $nonopt in - *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) - mode=link - for arg - do - case $arg in - -c) - mode=compile - break - ;; - esac - done - ;; - *db | *dbx | *strace | *truss) - mode=execute - ;; - *install*|cp|mv) - mode=install - ;; - *rm) - mode=uninstall - ;; - *) - # If we have no mode, but dlfiles were specified, then do execute mode. - test -n "$execute_dlfiles" && mode=execute - # Just use the default operation mode. - if test -z "$mode"; then - if test -n "$nonopt"; then - $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 - else - $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 - fi - fi - ;; - esac +# func_convert_path_nix_to_w32 ARG +# Convert path ARG from *nix to w32 format. Requires a wine environment and +# a working winepath. Returns result in func_to_host_file_result. +func_convert_path_nix_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi +} +# end func_convert_path_nix_to_w32 - # Only execute mode is allowed to have -dlopen flags. - if test -n "$execute_dlfiles" && test "$mode" != execute; then - $echo "$modename: unrecognized option \`-dlopen'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE + +# func_convert_path_msys_to_cygwin ARG +# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_path_msys_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_msys_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_msys_to_cygwin + + +# func_convert_path_nix_to_cygwin ARG +# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a +# a wine environment, working winepath, and LT_CYGPATH set. Returns result in +# func_to_host_file_result. +func_convert_path_nix_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi +} +# end func_convert_path_nix_to_cygwin - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$modename --help --mode=$mode' for more information." - # These modes are in order of execution frequency so that they run quickly. - case $mode in - # libtool compile mode - compile) - modename="$modename: compile" +# func_mode_compile arg... +func_mode_compile () +{ + $opt_debug # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" @@ -629,6 +1957,7 @@ if test -z "$show_help"; then arg_mode=normal libobj= later= + pie_flag= for arg do @@ -649,16 +1978,19 @@ if test -z "$show_help"; then # Accept any command-line options. case $arg in -o) - if test -n "$libobj" ; then - $echo "$modename: you cannot specify \`-o' more than once" 1>&2 - exit $EXIT_FAILURE - fi + test -n "$libobj" && \ + func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; - -static | -prefer-pic | -prefer-non-pic) - later="$later $arg" + -pie | -fpie | -fPIE) + func_append pie_flag " $arg" + continue + ;; + + -shared | -static | -prefer-pic | -prefer-non-pic) + func_append later " $arg" continue ;; @@ -673,31 +2005,24 @@ if test -z "$show_help"; then ;; # replaced later. I would guess that would be a bug. -Wc,*) - args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result lastarg= save_ifs="$IFS"; IFS=',' - for arg in $args; do + for arg in $args; do IFS="$save_ifs" - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - lastarg="$lastarg $arg" + func_append_quoted lastarg "$arg" done IFS="$save_ifs" - lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + func_stripname ' ' '' "$lastarg" + lastarg=$func_stripname_result # Add the arguments to base_compile. - base_compile="$base_compile $lastarg" + func_append base_compile " $lastarg" continue ;; - * ) + *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # @@ -709,64 +2034,41 @@ if test -z "$show_help"; then esac # case $arg_mode # Aesthetically quote the previous argument. - lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` - - case $lastarg in - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, and some SunOS ksh mistreat backslash-escaping - # in scan sets (worked around with variable expansion), - # and furthermore cannot handle '|' '&' '(' ')' in scan sets - # at all, so we specify them separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - lastarg="\"$lastarg\"" - ;; - esac - - base_compile="$base_compile $lastarg" + func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) - $echo "$modename: you must specify an argument for -Xcompile" - exit $EXIT_FAILURE + func_fatal_error "you must specify an argument for -Xcompile" ;; target) - $echo "$modename: you must specify a target with \`-o'" 1>&2 - exit $EXIT_FAILURE + func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. - [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + test -z "$libobj" && { + func_basename "$srcfile" + libobj="$func_basename_result" + } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo - xform='[cCFSifmso]' case $libobj in - *.ada) xform=ada ;; - *.adb) xform=adb ;; - *.ads) xform=ads ;; - *.asm) xform=asm ;; - *.c++) xform=c++ ;; - *.cc) xform=cc ;; - *.ii) xform=ii ;; - *.class) xform=class ;; - *.cpp) xform=cpp ;; - *.cxx) xform=cxx ;; - *.f90) xform=f90 ;; - *.for) xform=for ;; - *.java) xform=java ;; + *.[cCFSifmso] | \ + *.ada | *.adb | *.ads | *.asm | \ + *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ + *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) + func_xform "$libobj" + libobj=$func_xform_result + ;; esac - libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` - case $libobj in - *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) - $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 - exit $EXIT_FAILURE + func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac @@ -774,7 +2076,15 @@ if test -z "$show_help"; then for arg in $later; do case $arg in + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + continue + ;; + -static) + build_libtool_libs=no build_old_libs=yes continue ;; @@ -791,28 +2101,17 @@ if test -z "$show_help"; then esac done - qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` - case $qlibobj in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - qlibobj="\"$qlibobj\"" ;; - esac - test "X$libobj" != "X$qlibobj" \ - && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ - && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." - objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir= - else - xdir=$xdir/ - fi + func_quote_for_eval "$libobj" + test "X$libobj" != "X$func_quote_for_eval_result" \ + && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && func_warning "libobj name \`$libobj' may not contain shell special characters." + func_dirname_and_basename "$obj" "/" "" + objname="$func_basename_result" + xdir="$func_dirname_result" lobj=${xdir}$objdir/$objname - if test -z "$base_compile"; then - $echo "$modename: you must specify a compilation command" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi + test -z "$base_compile" && \ + func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then @@ -821,12 +2120,9 @@ if test -z "$show_help"; then removelist="$lobj $libobj ${libobj}T" fi - $run $rm $removelist - trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 - # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in - cygwin* | mingw* | pw32* | os2*) + cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac @@ -838,10 +2134,8 @@ if test -z "$show_help"; then # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then - output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" - removelist="$removelist $output_obj $lockfile" - trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no @@ -851,13 +2145,13 @@ if test -z "$show_help"; then # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then - until $run ln "$progpath" "$lockfile" 2>/dev/null; do - $show "Waiting for $lockfile to be removed" + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then - $echo "\ + $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` @@ -868,34 +2162,21 @@ repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." - $run $rm $removelist + $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi - $echo "$srcfile" > "$lockfile" + func_append removelist " $output_obj" + $ECHO "$srcfile" > "$lockfile" fi - if test -n "$fix_srcfile_path"; then - eval srcfile=\"$fix_srcfile_path\" - fi - qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` - case $qsrcfile in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - qsrcfile="\"$qsrcfile\"" ;; - esac + $opt_dry_run || $RM $removelist + func_append removelist " $lockfile" + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 - $run $rm "$libobj" "${libobj}T" - - # Create a libtool object file (analogous to a ".la" file), - # but don't create it if we're doing a dry run. - test -z "$run" && cat > ${libobj}T <<EOF -# $libobj - a libtool object file -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# Name of the PIC object. -EOF + func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 + srcfile=$func_to_tool_file_result + func_quote_for_eval "$srcfile" + qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then @@ -909,32 +2190,19 @@ EOF command="$base_compile $qsrcfile" fi - if test ! -d "${xdir}$objdir"; then - $show "$mkdir ${xdir}$objdir" - $run $mkdir ${xdir}$objdir - exit_status=$? - if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then - exit $exit_status - fi - fi + func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir - command="$command -o $lobj" + func_append command " -o $lobj" fi - $run $rm "$lobj" "$output_obj" - - $show "$command" - if $run eval "$command"; then : - else - test -n "$output_obj" && $run $rm $removelist - exit $EXIT_FAILURE - fi + func_show_eval_locale "$command" \ + 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $echo "\ + $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` @@ -948,65 +2216,42 @@ repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." - $run $rm $removelist + $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then - $show "$mv $output_obj $lobj" - if $run $mv $output_obj $lobj; then : - else - error=$? - $run $rm $removelist - exit $error - fi + func_show_eval '$MV "$output_obj" "$lobj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi - # Append the name of the PIC object to the libtool object file. - test -z "$run" && cat >> ${libobj}T <<EOF -pic_object='$objdir/$objname' - -EOF - # Allow error messages only from the first compilation. if test "$suppress_opt" = yes; then - suppress_output=' >/dev/null 2>&1' + suppress_output=' >/dev/null 2>&1' fi - else - # No PIC object so indicate it doesn't exist in the libtool - # object file. - test -z "$run" && cat >> ${libobj}T <<EOF -pic_object=none - -EOF fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code - command="$base_compile $qsrcfile" + command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then - command="$command -o $obj" + func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. - command="$command$suppress_output" - $run $rm "$obj" "$output_obj" - $show "$command" - if $run eval "$command"; then : - else - $run $rm $removelist - exit $EXIT_FAILURE - fi + func_append command "$suppress_output" + func_show_eval_locale "$command" \ + '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $echo "\ + $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` @@ -1020,53 +2265,2824 @@ repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." - $run $rm $removelist + $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then - $show "$mv $output_obj $obj" - if $run $mv $output_obj $obj; then : + func_show_eval '$MV "$output_obj" "$obj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + fi + + $opt_dry_run || { + func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + removelist=$lockfile + $RM "$lockfile" + fi + } + + exit $EXIT_SUCCESS +} + +$opt_help || { + test "$opt_mode" = compile && func_mode_compile ${1+"$@"} +} + +func_mode_help () +{ + # We need to display help for each of the modes. + case $opt_mode in + "") + # Generic help is extracted from the usage comments + # at the start of this file. + func_help + ;; + + clean) + $ECHO \ +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + + compile) + $ECHO \ +"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -no-suppress do not suppress compiler output for multiple passes + -prefer-pic try to build PIC objects only + -prefer-non-pic try to build non-PIC objects only + -shared do not build a \`.o' file suitable for static linking + -static only build a \`.o' file suitable for static linking + -Wc,FLAG pass FLAG directly to the compiler + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + + execute) + $ECHO \ +"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + + finish) + $ECHO \ +"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + + install) + $ECHO \ +"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The following components of INSTALL-COMMAND are treated specially: + + -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + + link) + $ECHO \ +"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -bindir BINDIR specify path to binaries directory (for systems where + libraries must be found in the PATH setting at runtime) + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -shared only do dynamic linking of libtool libraries + -shrext SUFFIX override the standard shared library file extension + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + -weak LIBNAME declare that the target provides the LIBNAME interface + -Wc,FLAG + -Xcompiler FLAG pass linker-specific FLAG directly to the compiler + -Wl,FLAG + -Xlinker FLAG pass linker-specific FLAG directly to the linker + -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + + uninstall) + $ECHO \ +"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + + *) + func_fatal_help "invalid operation mode \`$opt_mode'" + ;; + esac + + echo + $ECHO "Try \`$progname --help' for more information about other modes." +} + +# Now that we've collected a possible --mode arg, show help if necessary +if $opt_help; then + if test "$opt_help" = :; then + func_mode_help + else + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + func_mode_help + done + } | sed -n '1p; 2,$s/^Usage:/ or: /p' + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + echo + func_mode_help + done + } | + sed '1d + /^When reporting/,/^Report/{ + H + d + } + $x + /information about other modes/d + /more detailed .*MODE/d + s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' + fi + exit $? +fi + + +# func_mode_execute arg... +func_mode_execute () +{ + $opt_debug + # The first argument is the command name. + cmd="$nonopt" + test -z "$cmd" && \ + func_fatal_help "you must specify a COMMAND" + + # Handle -dlopen flags immediately. + for file in $opt_dlopen; do + test -f "$file" \ + || func_fatal_help "\`$file' is not a file" + + dir= + case $file in + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$lib' is not a valid libtool archive" + + # Read the libtool library. + dlname= + library_names= + func_source "$file" + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && \ + func_warning "\`$file' was not linked with \`-export-dynamic'" + continue + fi + + func_dirname "$file" "" "." + dir="$func_dirname_result" + + if test -f "$dir/$objdir/$dlname"; then + func_append dir "/$objdir" else - error=$? - $run $rm $removelist - exit $error + if test ! -f "$dir/$dlname"; then + func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" + fi fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + func_dirname "$file" "" "." + dir="$func_dirname_result" + ;; + + *) + func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi + done - # Append the name of the non-PIC object the libtool object file. - # Only append if the libtool object file exists. - test -z "$run" && cat >> ${libobj}T <<EOF -# Name of the non-PIC object. -non_pic_object='$objname' + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" -EOF - else - # Append the name of the non-PIC object the libtool object file. - # Only append if the libtool object file exists. - test -z "$run" && cat >> ${libobj}T <<EOF -# Name of the non-PIC object. -non_pic_object=none + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -* | *.la | *.lo ) ;; + *) + # Do a test to see if this is really a libtool program. + if func_ltwrapper_script_p "$file"; then + func_source "$file" + # Transform arg to wrapped name. + file="$progdir/$program" + elif func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + func_source "$func_ltwrapper_scriptname_result" + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + func_append_quoted args "$file" + done -EOF + if test "X$opt_dry_run" = Xfalse; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + else + $lt_unset $lt_var + fi" + done + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" + echo "export $shlibpath_var" + fi + $ECHO "$cmd$args" + exit $EXIT_SUCCESS fi +} + +test "$opt_mode" = execute && func_mode_execute ${1+"$@"} - $run $mv "${libobj}T" "${libobj}" - # Unlock the critical section if it was locked - if test "$need_locks" != no; then - $run $rm "$lockfile" +# func_mode_finish arg... +func_mode_finish () +{ + $opt_debug + libs= + libdirs= + admincmds= + + for opt in "$nonopt" ${1+"$@"} + do + if test -d "$opt"; then + func_append libdirs " $opt" + + elif test -f "$opt"; then + if func_lalib_unsafe_p "$opt"; then + func_append libs " $opt" + else + func_warning "\`$opt' is not a valid libtool archive" + fi + + else + func_fatal_error "invalid argument \`$opt'" + fi + done + + if test -n "$libs"; then + if test -n "$lt_sysroot"; then + sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` + sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" + else + sysroot_cmd= + fi + + # Remove sysroot references + if $opt_dry_run; then + for lib in $libs; do + echo "removing references to $lt_sysroot and \`=' prefixes from $lib" + done + else + tmpdir=`func_mktempdir` + for lib in $libs; do + sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ + > $tmpdir/tmp-la + mv -f $tmpdir/tmp-la $lib + done + ${RM}r "$tmpdir" + fi + fi + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + func_execute_cmds "$finish_cmds" 'admincmds="$admincmds +'"$cmd"'"' + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $opt_dry_run || eval "$cmds" || func_append admincmds " + $cmds" + fi + done fi + # Exit here if they wanted silent mode. + $opt_silent && exit $EXIT_SUCCESS + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + $ECHO " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $ECHO " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $ECHO " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo + + echo "See any operating system documentation about shared libraries for" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" + echo "pages." + ;; + *) + echo "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + echo "----------------------------------------------------------------------" + fi exit $EXIT_SUCCESS +} + +test "$opt_mode" = finish && func_mode_finish ${1+"$@"} + + +# func_mode_install arg... +func_mode_install () +{ + $opt_debug + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + case $nonopt in *shtool*) :;; *) false;; esac; then + # Aesthetically quote it. + func_quote_for_eval "$nonopt" + install_prog="$func_quote_for_eval_result " + arg=$1 + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + func_quote_for_eval "$arg" + func_append install_prog "$func_quote_for_eval_result" + install_shared_prog=$install_prog + case " $install_prog " in + *[\\\ /]cp\ *) install_cp=: ;; + *) install_cp=false ;; + esac + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + no_mode=: + for arg + do + arg2= + if test -n "$dest"; then + func_append files " $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + if $install_cp; then :; else + prev=$arg + fi + ;; + -g | -m | -o) + prev=$arg + ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + if test "x$prev" = x-m && test -n "$install_override_mode"; then + arg2=$install_override_mode + no_mode=false + fi + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + func_quote_for_eval "$arg" + func_append install_prog " $func_quote_for_eval_result" + if test -n "$arg2"; then + func_quote_for_eval "$arg2" + fi + func_append install_shared_prog " $func_quote_for_eval_result" + done + + test -z "$install_prog" && \ + func_fatal_help "you must specify an install program" + + test -n "$prev" && \ + func_fatal_help "the \`$prev' option requires an argument" + + if test -n "$install_override_mode" && $no_mode; then + if $install_cp; then :; else + func_quote_for_eval "$install_override_mode" + func_append install_shared_prog " -m $func_quote_for_eval_result" + fi + fi + + if test -z "$files"; then + if test -z "$dest"; then + func_fatal_help "no file or destination specified" + else + func_fatal_help "you must specify a destination" + fi + fi + + # Strip any trailing slash from the destination. + func_stripname '' '/' "$dest" + dest=$func_stripname_result + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + func_dirname_and_basename "$dest" "" "." + destdir="$func_dirname_result" + destname="$func_basename_result" + + # Not a directory, so check to see that there is only one file specified. + set dummy $files; shift + test "$#" -gt 1 && \ + func_fatal_help "\`$dest' is not a directory" + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + func_fatal_help "\`$destdir' must be an absolute directory name" + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + func_append staticlibs " $file" + ;; + + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$file' is not a valid libtool archive" + + library_names= + old_library= + relink_command= + func_source "$file" + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) func_append current_libdirs " $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) func_append future_libdirs " $libdir" ;; + esac + fi + + func_dirname "$file" "/" "" + dir="$func_dirname_result" + func_append dir "$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + test "$inst_prefix_dir" = "$destdir" && \ + func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + func_warning "relinking \`$file'" + func_show_eval "$relink_command" \ + 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' + fi + + # See the names of the shared library. + set dummy $library_names; shift + if test -n "$1"; then + realname="$1" + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ + 'exit $?' + tstripme="$stripme" + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + case $realname in + *.dll.a) + tstripme="" + ;; + esac + ;; + esac + if test -n "$tstripme" && test -n "$striplib"; then + func_show_eval "$striplib $destdir/$realname" 'exit $?' + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + test "$linkname" != "$realname" \ + && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + func_execute_cmds "$postinstall_cmds" 'exit $?' + fi + + # Install the pseudo-library for information purposes. + func_basename "$file" + name="$func_basename_result" + instname="$dir/$name"i + func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' + + # Maybe install the static library, too. + test -n "$old_library" && func_append staticlibs " $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + func_lo2o "$destfile" + staticdest=$func_lo2o_result + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + func_fatal_help "cannot copy a libtool object to \`$destfile'" + ;; + esac + + # Install the libtool object if requested. + test -n "$destfile" && \ + func_show_eval "$install_prog $file $destfile" 'exit $?' + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + func_lo2o "$file" + staticobj=$func_lo2o_result + func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + func_stripname '' '.exe' "$file" + file=$func_stripname_result + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin* | *mingw*) + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + wrapper=$func_ltwrapper_scriptname_result + else + func_stripname '' '.exe' "$file" + wrapper=$func_stripname_result + fi + ;; + *) + wrapper=$file + ;; + esac + if func_ltwrapper_script_p "$wrapper"; then + notinst_deplibs= + relink_command= + + func_source "$wrapper" + + # Check the variables that should have been set. + test -z "$generated_by_libtool_version" && \ + func_fatal_error "invalid libtool wrapper script \`$wrapper'" + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + func_source "$lib" + fi + libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + func_warning "\`$lib' has not been installed in \`$libdir'" + finalize=no + fi + done + + relink_command= + func_source "$wrapper" + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + $opt_dry_run || { + if test "$finalize" = yes; then + tmpdir=`func_mktempdir` + func_basename "$file$stripped_ext" + file="$func_basename_result" + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` + + $opt_silent || { + func_quote_for_expand "$relink_command" + eval "func_echo $func_quote_for_expand_result" + } + if eval "$relink_command"; then : + else + func_error "error: relink \`$file' with the above command before installing it" + $opt_dry_run || ${RM}r "$tmpdir" + continue + fi + file="$outputname" + else + func_warning "cannot relink \`$file'" + fi + } + else + # Install the binary that we compiled earlier. + file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + func_stripname '' '.exe' "$destfile" + destfile=$func_stripname_result + ;; + esac + ;; + esac + func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' + $opt_dry_run || if test -n "$outputname"; then + ${RM}r "$tmpdir" + fi + ;; + esac + done + + for file in $staticlibs; do + func_basename "$file" + name="$func_basename_result" + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + func_show_eval "$install_prog \$file \$oldlib" 'exit $?' + + if test -n "$stripme" && test -n "$old_striplib"; then + func_show_eval "$old_striplib $oldlib" 'exit $?' + fi + + # Do each command in the postinstall commands. + func_execute_cmds "$old_postinstall_cmds" 'exit $?' + done + + test -n "$future_libdirs" && \ + func_warning "remember to run \`$progname --finish$future_libdirs'" + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + $opt_dry_run && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi +} + +test "$opt_mode" = install && func_mode_install ${1+"$@"} + + +# func_generate_dlsyms outputname originator pic_p +# Extract symbols from dlprefiles and create ${outputname}S.o with +# a dlpreopen symbol table. +func_generate_dlsyms () +{ + $opt_debug + my_outputname="$1" + my_originator="$2" + my_pic_p="${3-no}" + my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` + my_dlsyms= + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + my_dlsyms="${my_outputname}S.c" + else + func_error "not configured to extract global symbols from dlpreopened files" + fi + fi + + if test -n "$my_dlsyms"; then + case $my_dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${my_outputname}.nm" + + func_show_eval "$RM $nlist ${nlist}S ${nlist}T" + + # Parse the name list into a source file. + func_verbose "creating $output_objdir/$my_dlsyms" + + $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ +/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ +/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" +#endif + +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + func_verbose "generating symbol list for \`$output'" + + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` + for progfile in $progfiles; do + func_to_tool_file "$progfile" func_convert_file_msys_to_w32 + func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" + $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $opt_dry_run || { + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + if test -n "$export_symbols_regex"; then + $opt_dry_run || { + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $opt_dry_run || { + $RM $export_symbols + eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + } + else + $opt_dry_run || { + eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + } + fi + fi + + for dlprefile in $dlprefiles; do + func_verbose "extracting global C symbols from \`$dlprefile'" + func_basename "$dlprefile" + name="$func_basename_result" + case $host in + *cygwin* | *mingw* | *cegcc* ) + # if an import library, we need to obtain dlname + if func_win32_import_lib_p "$dlprefile"; then + func_tr_sh "$dlprefile" + eval "curr_lafile=\$libfile_$func_tr_sh_result" + dlprefile_dlbasename="" + if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then + # Use subshell, to avoid clobbering current variable values + dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` + if test -n "$dlprefile_dlname" ; then + func_basename "$dlprefile_dlname" + dlprefile_dlbasename="$func_basename_result" + else + # no lafile. user explicitly requested -dlpreopen <import library>. + $sharedlib_from_linklib_cmd "$dlprefile" + dlprefile_dlbasename=$sharedlib_from_linklib_result + fi + fi + $opt_dry_run || { + if test -n "$dlprefile_dlbasename" ; then + eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' + else + func_warning "Could not compute DLL name from $name" + eval '$ECHO ": $name " >> "$nlist"' + fi + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | + $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" + } + else # not an import lib + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + fi + ;; + *) + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + ;; + esac + done + + $opt_dry_run || { + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $MV "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if $GREP -v "^: " < "$nlist" | + if sort -k 3 </dev/null >/dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + $GREP -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$my_dlsyms" + fi + + echo >> "$output_objdir/$my_dlsyms" "\ + +/* The mapping between symbol names and symbols. */ +typedef struct { + const char *name; + void *address; +} lt_dlsymlist; +extern LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[]; +LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[] = +{\ + { \"$my_originator\", (void *) 0 }," + + case $need_lib_prefix in + no) + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + *) + eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + esac + echo >> "$output_objdir/$my_dlsyms" "\ + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_${my_prefix}_LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + } # !$opt_dry_run + + pic_flag_for_symtable= + case "$compile_command " in + *" -static "*) ;; + *) + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; + *-*-hpux*) + pic_flag_for_symtable=" $pic_flag" ;; + *) + if test "X$my_pic_p" != Xno; then + pic_flag_for_symtable=" $pic_flag" + fi + ;; + esac + ;; + esac + symtab_cflags= + for arg in $LTCFLAGS; do + case $arg in + -pie | -fpie | -fPIE) ;; + *) func_append symtab_cflags " $arg" ;; + esac + done + + # Now compile the dynamic symbol file. + func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' + + # Clean up the generated files. + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' + + # Transform the symbol file into the correct name. + symfileobj="$output_objdir/${my_outputname}S.$objext" + case $host in + *cygwin* | *mingw* | *cegcc* ) + if test -f "$output_objdir/$my_outputname.def"; then + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + else + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + fi + ;; + *) + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + ;; + esac + ;; + *) + func_fatal_error "unknown suffix for \`$my_dlsyms'" + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` + fi +} + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +# Despite the name, also deal with 64 bit binaries. +func_win32_libid () +{ + $opt_debug + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | + $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then + func_to_tool_file "$1" func_convert_file_msys_to_w32 + win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | + $SED -n -e ' + 1,100{ + / I /{ + s,.*,import, + p + q + } + }'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $ECHO "$win32_libid_type" +} + +# func_cygming_dll_for_implib ARG +# +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib () +{ + $opt_debug + sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` +} + +# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs +# +# The is the core of a fallback implementation of a +# platform-specific function to extract the name of the +# DLL associated with the specified import library LIBNAME. +# +# SECTION_NAME is either .idata$6 or .idata$7, depending +# on the platform and compiler that created the implib. +# +# Echos the name of the DLL associated with the +# specified import library. +func_cygming_dll_for_implib_fallback_core () +{ + $opt_debug + match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` + $OBJDUMP -s --section "$1" "$2" 2>/dev/null | + $SED '/^Contents of section '"$match_literal"':/{ + # Place marker at beginning of archive member dllname section + s/.*/====MARK====/ + p + d + } + # These lines can sometimes be longer than 43 characters, but + # are always uninteresting + /:[ ]*file format pe[i]\{,1\}-/d + /^In archive [^:]*:/d + # Ensure marker is printed + /^====MARK====/p + # Remove all lines with less than 43 characters + /^.\{43\}/!d + # From remaining lines, remove first 43 characters + s/^.\{43\}//' | + $SED -n ' + # Join marker and all lines until next marker into a single line + /^====MARK====/ b para + H + $ b para + b + :para + x + s/\n//g + # Remove the marker + s/^====MARK====// + # Remove trailing dots and whitespace + s/[\. \t]*$// + # Print + /./p' | + # we now have a list, one entry per line, of the stringified + # contents of the appropriate section of all members of the + # archive which possess that section. Heuristic: eliminate + # all those which have a first or second character that is + # a '.' (that is, objdump's representation of an unprintable + # character.) This should work for all archives with less than + # 0x302f exports -- but will fail for DLLs whose name actually + # begins with a literal '.' or a single character followed by + # a '.'. + # + # Of those that remain, print the first one. + $SED -e '/^\./d;/^.\./d;q' +} + +# func_cygming_gnu_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is a GNU/binutils-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_gnu_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` + test -n "$func_cygming_gnu_implib_tmp" +} + +# func_cygming_ms_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is an MS-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_ms_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` + test -n "$func_cygming_ms_implib_tmp" +} + +# func_cygming_dll_for_implib_fallback ARG +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# +# This fallback implementation is for use when $DLLTOOL +# does not support the --identify-strict option. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib_fallback () +{ + $opt_debug + if func_cygming_gnu_implib_p "$1" ; then + # binutils import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` + elif func_cygming_ms_implib_p "$1" ; then + # ms-generated import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` + else + # unknown + sharedlib_from_linklib_result="" + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + $opt_debug + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + if test "$lock_old_archive_extraction" = yes; then + lockfile=$f_ex_an_ar_oldlib.lock + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + fi + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ + 'stat=$?; rm -f "$lockfile"; exit $stat' + if test "$lock_old_archive_extraction" = yes; then + $opt_dry_run || rm -f "$lockfile" + fi + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" + fi +} + + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + $opt_debug + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + func_basename "$my_xlib" + my_xlib="$func_basename_result" + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + func_arith $extracted_serial + 1 + extracted_serial=$func_arith_result + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir="$my_gentop/$my_xlib_u" + + func_mkdir_p "$my_xdir" + + case $host in + *-darwin*) + func_verbose "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + $opt_dry_run || { + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`basename "$darwin_archive"` + darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` + if test -n "$darwin_arches"; then + darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we've a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` + $LIPO -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + $RM -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + } # !$opt_dry_run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` + done + + func_extract_archives_result="$my_oldobjs" +} + + +# func_emit_wrapper [arg=no] +# +# Emit a libtool wrapper script on stdout. +# Don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variables +# set therein. +# +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory in which it is stored is +# the $objdir directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () +{ + func_emit_wrapper_arg1=${1-no} + + $ECHO "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='$sed_quote_subst' + +# 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+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + file=\"\$0\"" + + qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` + $ECHO "\ + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + ECHO=\"$qECHO\" + fi + +# Very basic option parsing. These options are (a) specific to +# the libtool wrapper, (b) are identical between the wrapper +# /script/ and the wrapper /executable/ which is used only on +# windows platforms, and (c) all begin with the string "--lt-" +# (application programs are unlikely to have options which match +# this pattern). +# +# There are only two supported options: --lt-debug and +# --lt-dump-script. There is, deliberately, no --lt-help. +# +# The first argument to this parsing function should be the +# script's $0 value, followed by "$@". +lt_option_debug= +func_parse_lt_options () +{ + lt_script_arg0=\$0 + shift + for lt_opt + do + case \"\$lt_opt\" in + --lt-debug) lt_option_debug=1 ;; + --lt-dump-script) + lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` + test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. + lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` + cat \"\$lt_dump_D/\$lt_dump_F\" + exit 0 + ;; + --lt-*) + \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 + exit 1 + ;; + esac + done + + # Print the debug banner immediately: + if test -n \"\$lt_option_debug\"; then + echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 + fi +} + +# Used when --lt-debug. Prints its arguments to stdout +# (redirection is the responsibility of the caller) +func_lt_dump_args () +{ + lt_dump_args_N=1; + for lt_arg + do + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" + lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` + done +} + +# Core function for launching the target application +func_exec_program_core () +{ +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" ;; - # libtool link mode - link | relink) - modename="$modename: link" + *) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 +} + +# A function to encapsulate launching the target application +# Strips options in the --lt-* namespace from \$@ and +# launches target application with the remaining arguments. +func_exec_program () +{ + for lt_wr_arg + do + case \$lt_wr_arg in + --lt-*) ;; + *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; + esac + shift + done + func_exec_program_core \${1+\"\$@\"} +} + + # Parse options + func_parse_lt_options \"\$0\" \${1+\"\$@\"} + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` + done + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then + # special case for '.' + if test \"\$thisdir\" = \".\"; then + thisdir=\`pwd\` + fi + # remove .libs from thisdir + case \"\$thisdir\" in + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; + $objdir ) thisdir=. ;; + esac + fi + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $ECHO "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $MKDIR \"\$progdir\" + else + $RM \"\$progdir/\$file\" + fi" + + $ECHO "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $ECHO \"\$relink_command_output\" >&2 + $RM \"\$progdir/\$file\" + exit 1 + fi + fi + + $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $RM \"\$progdir/\$program\"; + $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $RM \"\$progdir/\$file\" + fi" + else + $ECHO "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $ECHO "\ + + if test -f \"\$progdir/\$program\"; then" + + # fixup the dll searchpath if we need to. + # + # Fix the DLL searchpath if we need to. Do this before prepending + # to shlibpath, because on Windows, both are PATH and uninstalled + # libraries must come first. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` + + export $shlibpath_var +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. + func_exec_program \${1+\"\$@\"} + fi + else + # The program doesn't exist. + \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 + \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" +} + + +# func_emit_cwrapperexe_src +# emit the source code for a wrapper executable on stdout +# Must ONLY be called from within func_mode_link because +# it depends on a number of variable set therein. +func_emit_cwrapperexe_src () +{ + cat <<EOF + +/* $cwrappersource - temporary wrapper executable for $objdir/$outputname + Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION + + The $output program cannot be directly executed until all the libtool + libraries that it depends on are installed. + + This wrapper executable should never be moved out of the build directory. + If it is, it will not operate correctly. +*/ +EOF + cat <<"EOF" +#ifdef _MSC_VER +# define _CRT_SECURE_NO_DEPRECATE 1 +#endif +#include <stdio.h> +#include <stdlib.h> +#ifdef _MSC_VER +# include <direct.h> +# include <process.h> +# include <io.h> +#else +# include <unistd.h> +# include <stdint.h> +# ifdef __CYGWIN__ +# include <io.h> +# endif +#endif +#include <malloc.h> +#include <stdarg.h> +#include <assert.h> +#include <string.h> +#include <ctype.h> +#include <errno.h> +#include <fcntl.h> +#include <sys/stat.h> + +/* declarations of non-ANSI functions */ +#if defined(__MINGW32__) +# ifdef __STRICT_ANSI__ +int _putenv (const char *); +# endif +#elif defined(__CYGWIN__) +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +/* #elif defined (other platforms) ... */ +#endif + +/* portability defines, excluding path handling macros */ +#if defined(_MSC_VER) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +# define S_IXUSR _S_IEXEC +# ifndef _INTPTR_T_DEFINED +# define _INTPTR_T_DEFINED +# define intptr_t int +# endif +#elif defined(__MINGW32__) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +#elif defined(__CYGWIN__) +# define HAVE_SETENV +# define FOPEN_WB "wb" +/* #elif defined (other platforms) ... */ +#endif + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef S_IXOTH +# define S_IXOTH 0 +#endif +#ifndef S_IXGRP +# define S_IXGRP 0 +#endif + +/* path handling portability macros */ +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# define FOPEN_WB "wb" +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#ifndef FOPEN_WB +# define FOPEN_WB "w" +#endif +#ifndef _O_BINARY +# define _O_BINARY 0 +#endif + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +#if defined(LT_DEBUGWRAPPER) +static int lt_debug = 1; +#else +static int lt_debug = 0; +#endif + +const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ + +void *xmalloc (size_t num); +char *xstrdup (const char *string); +const char *base_name (const char *name); +char *find_executable (const char *wrapper); +char *chase_symlinks (const char *pathspec); +int make_executable (const char *path); +int check_executable (const char *path); +char *strendzap (char *str, const char *pat); +void lt_debugprintf (const char *file, int line, const char *fmt, ...); +void lt_fatal (const char *file, int line, const char *message, ...); +static const char *nonnull (const char *s); +static const char *nonempty (const char *s); +void lt_setenv (const char *name, const char *value); +char *lt_extend_str (const char *orig_value, const char *add, int to_end); +void lt_update_exe_path (const char *name, const char *value); +void lt_update_lib_path (const char *name, const char *value); +char **prepare_spawn (char **argv); +void lt_dump_script (FILE *f); +EOF + + cat <<EOF +volatile const char * MAGIC_EXE = "$magic_exe"; +const char * LIB_PATH_VARNAME = "$shlibpath_var"; +EOF + + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + func_to_host_path "$temp_rpath" + cat <<EOF +const char * LIB_PATH_VALUE = "$func_to_host_path_result"; +EOF + else + cat <<"EOF" +const char * LIB_PATH_VALUE = ""; +EOF + fi + + if test -n "$dllsearchpath"; then + func_to_host_path "$dllsearchpath:" + cat <<EOF +const char * EXE_PATH_VARNAME = "PATH"; +const char * EXE_PATH_VALUE = "$func_to_host_path_result"; +EOF + else + cat <<"EOF" +const char * EXE_PATH_VARNAME = ""; +const char * EXE_PATH_VALUE = ""; +EOF + fi + + if test "$fast_install" = yes; then + cat <<EOF +const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ +EOF + else + cat <<EOF +const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ +EOF + fi + + + cat <<"EOF" + +#define LTWRAPPER_OPTION_PREFIX "--lt-" + +static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; +static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; +static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug"; + +int +main (int argc, char *argv[]) +{ + char **newargz; + int newargc; + char *tmp_pathspec; + char *actual_cwrapper_path; + char *actual_cwrapper_name; + char *target_name; + char *lt_argv_zero; + intptr_t rval = 127; + + int i; + + program_name = (char *) xstrdup (base_name (argv[0])); + newargz = XMALLOC (char *, argc + 1); + + /* very simple arg parsing; don't want to rely on getopt + * also, copy all non cwrapper options to newargz, except + * argz[0], which is handled differently + */ + newargc=0; + for (i = 1; i < argc; i++) + { + if (strcmp (argv[i], dumpscript_opt) == 0) + { +EOF + case "$host" in + *mingw* | *cygwin* ) + # make stdout use "unix" line endings + echo " setmode(1,_O_BINARY);" + ;; + esac + + cat <<"EOF" + lt_dump_script (stdout); + return 0; + } + if (strcmp (argv[i], debug_opt) == 0) + { + lt_debug = 1; + continue; + } + if (strcmp (argv[i], ltwrapper_option_prefix) == 0) + { + /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX + namespace, but it is not one of the ones we know about and + have already dealt with, above (inluding dump-script), then + report an error. Otherwise, targets might begin to believe + they are allowed to use options in the LTWRAPPER_OPTION_PREFIX + namespace. The first time any user complains about this, we'll + need to make LTWRAPPER_OPTION_PREFIX a configure-time option + or a configure.ac-settable value. + */ + lt_fatal (__FILE__, __LINE__, + "unrecognized %s option: '%s'", + ltwrapper_option_prefix, argv[i]); + } + /* otherwise ... */ + newargz[++newargc] = xstrdup (argv[i]); + } + newargz[++newargc] = NULL; + +EOF + cat <<EOF + /* The GNU banner must be the first non-error debug message */ + lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n"); +EOF + cat <<"EOF" + lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); + lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); + + tmp_pathspec = find_executable (argv[0]); + if (tmp_pathspec == NULL) + lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); + lt_debugprintf (__FILE__, __LINE__, + "(main) found exe (before symlink chase) at: %s\n", + tmp_pathspec); + + actual_cwrapper_path = chase_symlinks (tmp_pathspec); + lt_debugprintf (__FILE__, __LINE__, + "(main) found exe (after symlink chase) at: %s\n", + actual_cwrapper_path); + XFREE (tmp_pathspec); + + actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); + strendzap (actual_cwrapper_path, actual_cwrapper_name); + + /* wrapper name transforms */ + strendzap (actual_cwrapper_name, ".exe"); + tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); + XFREE (actual_cwrapper_name); + actual_cwrapper_name = tmp_pathspec; + tmp_pathspec = 0; + + /* target_name transforms -- use actual target program name; might have lt- prefix */ + target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); + strendzap (target_name, ".exe"); + tmp_pathspec = lt_extend_str (target_name, ".exe", 1); + XFREE (target_name); + target_name = tmp_pathspec; + tmp_pathspec = 0; + + lt_debugprintf (__FILE__, __LINE__, + "(main) libtool target name: %s\n", + target_name); +EOF + + cat <<EOF + newargz[0] = + XMALLOC (char, (strlen (actual_cwrapper_path) + + strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); + strcpy (newargz[0], actual_cwrapper_path); + strcat (newargz[0], "$objdir"); + strcat (newargz[0], "/"); +EOF + + cat <<"EOF" + /* stop here, and copy so we don't have to do this twice */ + tmp_pathspec = xstrdup (newargz[0]); + + /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ + strcat (newargz[0], actual_cwrapper_name); + + /* DO want the lt- prefix here if it exists, so use target_name */ + lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); + XFREE (tmp_pathspec); + tmp_pathspec = NULL; +EOF + + case $host_os in + mingw*) + cat <<"EOF" + { + char* p; + while ((p = strchr (newargz[0], '\\')) != NULL) + { + *p = '/'; + } + while ((p = strchr (lt_argv_zero, '\\')) != NULL) + { + *p = '/'; + } + } +EOF + ;; + esac + + cat <<"EOF" + XFREE (target_name); + XFREE (actual_cwrapper_path); + XFREE (actual_cwrapper_name); + + lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ + lt_setenv ("DUALCASE", "1"); /* for MSK sh */ + /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must + be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath) + because on Windows, both *_VARNAMEs are PATH but uninstalled + libraries must come first. */ + lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); + lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); + + lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", + nonnull (lt_argv_zero)); + for (i = 0; i < newargc; i++) + { + lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", + i, nonnull (newargz[i])); + } + +EOF + + case $host_os in + mingw*) + cat <<"EOF" + /* execv doesn't actually work on mingw as expected on unix */ + newargz = prepare_spawn (newargz); + rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); + if (rval == -1) + { + /* failed to start process */ + lt_debugprintf (__FILE__, __LINE__, + "(main) failed to launch target \"%s\": %s\n", + lt_argv_zero, nonnull (strerror (errno))); + return 127; + } + return rval; +EOF + ;; + *) + cat <<"EOF" + execv (lt_argv_zero, newargz); + return rval; /* =127, but avoids unused variable warning */ +EOF + ;; + esac + + cat <<"EOF" +} + +void * +xmalloc (size_t num) +{ + void *p = (void *) malloc (num); + if (!p) + lt_fatal (__FILE__, __LINE__, "memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), + string) : NULL; +} + +const char * +base_name (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha ((unsigned char) name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return base; +} + +int +check_executable (const char *path) +{ + struct stat st; + + lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", + nonempty (path)); + if ((!path) || (!*path)) + return 0; + + if ((stat (path, &st) >= 0) + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) + return 1; + else + return 0; +} + +int +make_executable (const char *path) +{ + int rval = 0; + struct stat st; + + lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", + nonempty (path)); + if ((!path) || (!*path)) + return 0; + + if (stat (path, &st) >= 0) + { + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); + } + return rval; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise + Does not chase symlinks, even on platforms that support them. +*/ +char * +find_executable (const char *wrapper) +{ + int has_slash = 0; + const char *p; + const char *p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char *concat_name; + + lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", + nonempty (wrapper)); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char *path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char *q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR (*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = + XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = + XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + return NULL; +} + +char * +chase_symlinks (const char *pathspec) +{ +#ifndef S_ISLNK + return xstrdup (pathspec); +#else + char buf[LT_PATHMAX]; + struct stat s; + char *tmp_pathspec = xstrdup (pathspec); + char *p; + int has_symlinks = 0; + while (strlen (tmp_pathspec) && !has_symlinks) + { + lt_debugprintf (__FILE__, __LINE__, + "checking path component for symlinks: %s\n", + tmp_pathspec); + if (lstat (tmp_pathspec, &s) == 0) + { + if (S_ISLNK (s.st_mode) != 0) + { + has_symlinks = 1; + break; + } + + /* search backwards for last DIR_SEPARATOR */ + p = tmp_pathspec + strlen (tmp_pathspec) - 1; + while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + p--; + if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + { + /* no more DIR_SEPARATORS left */ + break; + } + *p = '\0'; + } + else + { + lt_fatal (__FILE__, __LINE__, + "error accessing file \"%s\": %s", + tmp_pathspec, nonnull (strerror (errno))); + } + } + XFREE (tmp_pathspec); + + if (!has_symlinks) + { + return xstrdup (pathspec); + } + + tmp_pathspec = realpath (pathspec, buf); + if (tmp_pathspec == 0) + { + lt_fatal (__FILE__, __LINE__, + "could not follow symlinks for %s", pathspec); + } + return xstrdup (tmp_pathspec); +#endif +} + +char * +strendzap (char *str, const char *pat) +{ + size_t len, patlen; + + assert (str != NULL); + assert (pat != NULL); + + len = strlen (str); + patlen = strlen (pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp (str, pat) == 0) + *str = '\0'; + } + return str; +} + +void +lt_debugprintf (const char *file, int line, const char *fmt, ...) +{ + va_list args; + if (lt_debug) + { + (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); + } +} + +static void +lt_error_core (int exit_status, const char *file, + int line, const char *mode, + const char *message, va_list ap) +{ + fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *file, int line, const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); + va_end (ap); +} + +static const char * +nonnull (const char *s) +{ + return s ? s : "(null)"; +} + +static const char * +nonempty (const char *s) +{ + return (s && !*s) ? "(empty)" : nonnull (s); +} + +void +lt_setenv (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_setenv) setting '%s' to '%s'\n", + nonnull (name), nonnull (value)); + { +#ifdef HAVE_SETENV + /* always make a copy, for consistency with !HAVE_SETENV */ + char *str = xstrdup (value); + setenv (name, str, 1); +#else + int len = strlen (name) + 1 + strlen (value) + 1; + char *str = XMALLOC (char, len); + sprintf (str, "%s=%s", name, value); + if (putenv (str) != EXIT_SUCCESS) + { + XFREE (str); + } +#endif + } +} + +char * +lt_extend_str (const char *orig_value, const char *add, int to_end) +{ + char *new_value; + if (orig_value && *orig_value) + { + int orig_value_len = strlen (orig_value); + int add_len = strlen (add); + new_value = XMALLOC (char, add_len + orig_value_len + 1); + if (to_end) + { + strcpy (new_value, orig_value); + strcpy (new_value + orig_value_len, add); + } + else + { + strcpy (new_value, add); + strcpy (new_value + add_len, orig_value); + } + } + else + { + new_value = xstrdup (add); + } + return new_value; +} + +void +lt_update_exe_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + /* some systems can't cope with a ':'-terminated path #' */ + int len = strlen (new_value); + while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) + { + new_value[len-1] = '\0'; + } + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +void +lt_update_lib_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +EOF + case $host_os in + mingw*) + cat <<"EOF" + +/* Prepares an argument vector before calling spawn(). + Note that spawn() does not by itself call the command interpreter + (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : + ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&v); + v.dwPlatformId == VER_PLATFORM_WIN32_NT; + }) ? "cmd.exe" : "command.com"). + Instead it simply concatenates the arguments, separated by ' ', and calls + CreateProcess(). We must quote the arguments since Win32 CreateProcess() + interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a + special way: + - Space and tab are interpreted as delimiters. They are not treated as + delimiters if they are surrounded by double quotes: "...". + - Unescaped double quotes are removed from the input. Their only effect is + that within double quotes, space and tab are treated like normal + characters. + - Backslashes not followed by double quotes are not special. + - But 2*n+1 backslashes followed by a double quote become + n backslashes followed by a double quote (n >= 0): + \" -> " + \\\" -> \" + \\\\\" -> \\" + */ +#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +char ** +prepare_spawn (char **argv) +{ + size_t argc; + char **new_argv; + size_t i; + + /* Count number of arguments. */ + for (argc = 0; argv[argc] != NULL; argc++) + ; + + /* Allocate new argument vector. */ + new_argv = XMALLOC (char *, argc + 1); + + /* Put quoted arguments into the new argument vector. */ + for (i = 0; i < argc; i++) + { + const char *string = argv[i]; + + if (string[0] == '\0') + new_argv[i] = xstrdup ("\"\""); + else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) + { + int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); + size_t length; + unsigned int backslashes; + const char *s; + char *quoted_string; + char *p; + + length = 0; + backslashes = 0; + if (quote_around) + length++; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + length += backslashes + 1; + length++; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + length += backslashes + 1; + + quoted_string = XMALLOC (char, length + 1); + + p = quoted_string; + backslashes = 0; + if (quote_around) + *p++ = '"'; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + { + unsigned int j; + for (j = backslashes + 1; j > 0; j--) + *p++ = '\\'; + } + *p++ = c; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + { + unsigned int j; + for (j = backslashes; j > 0; j--) + *p++ = '\\'; + *p++ = '"'; + } + *p = '\0'; + + new_argv[i] = quoted_string; + } + else + new_argv[i] = (char *) string; + } + new_argv[argc] = NULL; + + return new_argv; +} +EOF + ;; + esac + + cat <<"EOF" +void lt_dump_script (FILE* f) +{ +EOF + func_emit_wrapper yes | + $SED -e 's/\([\\"]\)/\\\1/g' \ + -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' + + cat <<"EOF" +} +EOF +} +# end: func_emit_cwrapperexe_src + +# func_win32_import_lib_p ARG +# True if ARG is an import lib, as indicated by $file_magic_cmd +func_win32_import_lib_p () +{ + $opt_debug + case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in + *import*) : ;; + *) false ;; + esac +} + +# func_mode_link arg... +func_mode_link () +{ + $opt_debug case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra @@ -1084,10 +5100,10 @@ EOF allow_undefined=yes ;; esac - libtool_args="$nonopt" + libtool_args=$nonopt base_compile="$nonopt $@" - compile_command="$nonopt" - finalize_command="$nonopt" + compile_command=$nonopt + finalize_command=$nonopt compile_rpath= finalize_rpath= @@ -1102,8 +5118,10 @@ EOF dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= + new_inherited_linker_flags= avoid_version=no + bindir= dlfiles= dlprefiles= dlself=no @@ -1117,7 +5135,6 @@ EOF no_install=no objs= non_pic_objects= - notinst_path= # paths that contain not-installed libtool libraries precious_files_regex= prefer_static_libs=no preload=no @@ -1131,28 +5148,44 @@ EOF thread_safe=no vinfo= vinfo_number=no - + weak_libs= + single_module="${wl}-single_module" func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in - -all-static | -static) - if test "X$arg" = "X-all-static"; then + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + break + ;; + -all-static | -static | -static-libtool-libs) + case $arg in + -all-static) if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then - $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 + func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes - else + ;; + -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built - fi + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac build_libtool_libs=no build_old_libs=yes break @@ -1167,29 +5200,30 @@ EOF while test "$#" -gt 0; do arg="$1" shift - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test - ;; - *) qarg=$arg ;; - esac - libtool_args="$libtool_args $qarg" + func_quote_for_eval "$arg" + qarg=$func_quote_for_eval_unquoted_result + func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) - compile_command="$compile_command @OUTPUT@" - finalize_command="$finalize_command @OUTPUT@" + func_append compile_command " @OUTPUT@" + func_append finalize_command " @OUTPUT@" ;; esac case $prev in + bindir) + bindir="$arg" + prev= + continue + ;; dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. - compile_command="$compile_command @SYMFILE@" - finalize_command="$finalize_command @SYMFILE@" + func_append compile_command " @SYMFILE@" + func_append finalize_command " @SYMFILE@" preload=yes fi case $arg in @@ -1216,9 +5250,9 @@ EOF ;; *) if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" + func_append dlfiles " $arg" else - dlprefiles="$dlprefiles $arg" + func_append dlprefiles " $arg" fi prev= continue @@ -1227,10 +5261,8 @@ EOF ;; expsyms) export_symbols="$arg" - if test ! -f "$arg"; then - $echo "$modename: symbol file \`$arg' does not exist" - exit $EXIT_FAILURE - fi + test -f "$arg" \ + || func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; @@ -1239,18 +5271,21 @@ EOF prev= continue ;; - inst_prefix) - inst_prefix_dir="$arg" - prev= - continue - ;; - precious_regex) - precious_files_regex="$arg" + framework) + case $host in + *-*-darwin*) + case "$deplibs " in + *" $qarg.ltframework "*) ;; + *) func_append deplibs " $qarg.ltframework" # this is fixed later + ;; + esac + ;; + esac prev= continue ;; - release) - release="-$arg" + inst_prefix) + inst_prefix_dir="$arg" prev= continue ;; @@ -1258,39 +5293,30 @@ EOF if test -f "$arg"; then save_arg=$arg moreargs= - for fil in `cat $save_arg` + for fil in `cat "$save_arg"` do -# moreargs="$moreargs $fil" +# func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac + func_source "$arg" - if test -z "$pic_object" || \ + if test -z "$pic_object" || test -z "$non_pic_object" || - test "$pic_object" = none && \ + test "$pic_object" = none && test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit $EXIT_FAILURE + func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. @@ -1298,7 +5324,7 @@ EOF if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" + func_append dlfiles " $pic_object" prev= continue else @@ -1310,12 +5336,12 @@ EOF # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" + func_append dlprefiles " $pic_object" prev= fi # A PIC object. - libobjs="$libobjs $pic_object" + func_append libobjs " $pic_object" arg="$pic_object" fi @@ -1325,7 +5351,7 @@ EOF non_pic_object="$xdir$non_pic_object" # A standard non-PIC object - non_pic_objects="$non_pic_objects $non_pic_object" + func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi @@ -1333,95 +5359,95 @@ EOF # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" + func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit $EXIT_FAILURE - else - # Dry-run case. - + if $opt_dry_run; then # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" fi fi done else - $echo "$modename: link input file \`$save_arg' does not exist" - exit $EXIT_FAILURE + func_fatal_error "link input file \`$arg' does not exist" fi arg=$save_arg prev= continue ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit $EXIT_FAILURE + func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; - *) rpath="$rpath $arg" ;; + *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; - *) xrpath="$xrpath $arg" ;; + *) func_append xrpath " $arg" ;; esac fi prev= continue ;; - xcompiler) - compiler_flags="$compiler_flags $qarg" + shrext) + shrext_cmds="$arg" prev= - compile_command="$compile_command $qarg" - finalize_command="$finalize_command $qarg" continue ;; - xlinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $wl$qarg" + weak) + func_append weak_libs " $arg" prev= - compile_command="$compile_command $wl$qarg" - finalize_command="$finalize_command $wl$qarg" continue ;; xcclinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $qarg" + func_append linker_flags " $qarg" + func_append compiler_flags " $qarg" prev= - compile_command="$compile_command $qarg" - finalize_command="$finalize_command $qarg" + func_append compile_command " $qarg" + func_append finalize_command " $qarg" continue ;; - shrext) - shrext_cmds="$arg" + xcompiler) + func_append compiler_flags " $qarg" prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" continue ;; - darwin_framework|darwin_framework_skip) - test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" + xlinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $wl$qarg" prev= + func_append compile_command " $wl$qarg" + func_append finalize_command " $wl$qarg" continue ;; *) @@ -1437,16 +5463,16 @@ EOF case $arg in -all-static) if test -n "$link_static_flag"; then - compile_command="$compile_command $link_static_flag" - finalize_command="$finalize_command $link_static_flag" + # See comment for -static flag below, for more details. + func_append compile_command " $link_static_flag" + func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. - $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 - continue + func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) @@ -1454,6 +5480,11 @@ EOF continue ;; + -bindir) + prev=bindir + continue + ;; + -dlopen) prev=dlfiles continue @@ -1471,8 +5502,7 @@ EOF -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: more than one -exported-symbols argument is not allowed" - exit $EXIT_FAILURE + func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms @@ -1482,15 +5512,8 @@ EOF continue ;; - -framework|-arch|-isysroot) - case " $CC " in - *" ${arg} ${1} "* | *" ${arg} ${1} "*) - prev=darwin_framework_skip ;; - *) compiler_flags="$compiler_flags $arg" - prev=darwin_framework ;; - esac - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" + -framework) + prev=framework continue ;; @@ -1504,45 +5527,59 @@ EOF -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" ;; esac continue ;; -L*) - dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + func_stripname "-L" '' "$arg" + if test -z "$func_stripname_result"; then + if test "$#" -gt 0; then + func_fatal_error "require no space between \`-L' and \`$1'" + else + func_fatal_error "need path for \`-L' option" + fi + fi + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 - absdir="$dir" - notinst_path="$notinst_path $dir" - fi + test -z "$absdir" && \ + func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in - *" -L$dir "*) ;; + *" -L$dir "* | *" $arg "*) + # Will only happen for absolute or sysroot arguments + ;; *) - deplibs="$deplibs -L$dir" - lib_search_path="$lib_search_path $dir" + # Preserve sysroot, but never include relative directories + case $dir in + [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; + *) func_append deplibs " -L$dir" ;; + esac + func_append lib_search_path " $dir" ;; esac case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; - *) dllsearchpath="$dllsearchpath:$dir";; + ::) dllsearchpath=$dir;; + *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; - *) dllsearchpath="$dllsearchpath:$testbindir";; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; esac ;; esac @@ -1552,7 +5589,7 @@ EOF -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; @@ -1566,7 +5603,7 @@ EOF ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework - deplibs="$deplibs -framework System" + func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) @@ -1586,61 +5623,39 @@ EOF ;; esac fi - deplibs="$deplibs $arg" + func_append deplibs " $arg" continue ;; - # Tru64 UNIX uses -model [arg] to determine the layout of C++ - # classes, name mangling, and exception handling. - -model) - compile_command="$compile_command $arg" - compiler_flags="$compiler_flags $arg" - finalize_command="$finalize_command $arg" - prev=xcompiler + -module) + module=yes continue ;; - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) - compiler_flags="$compiler_flags $arg" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + # Darwin uses the -arch flag to determine output architecture. + -model|-arch|-isysroot|--sysroot) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + prev=xcompiler continue ;; - -module) - module=yes + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) func_append new_inherited_linker_flags " $arg" ;; + esac continue ;; - # -64, -mips[0-9] enable 64-bit mode on the SGI compiler - # -r[0-9][0-9]* specifies the processor on the SGI compiler - # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler - # +DA*, +DD* enable 64-bit mode on the HP compiler - # -q* pass through compiler args for the IBM compiler - # -m* pass through architecture-specific compiler args for GCC - # -m*, -t[45]*, -txscale* pass through architecture-specific - # compiler args for GCC - # -pg pass through profiling flag for GCC - # @file GCC response files - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ - -t[45]*|-txscale*|@*) - - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - compiler_flags="$compiler_flags $arg" - continue - ;; - - -shrext) - prev=shrext + -multi_module) + single_module="${wl}-multi_module" continue ;; @@ -1651,11 +5666,11 @@ EOF -no-install) case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows - # in order for the loader to find any dlls it needs. - $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 - $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 + # and Darwin in order for the loader to find any dlls it needs. + func_warning "\`-no-install' is ignored for $host" + func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; @@ -1696,23 +5711,37 @@ EOF ;; -R*) - dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + func_stripname '-R' '' "$arg" + dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; + =*) + func_stripname '=' '' "$dir" + dir=$lt_sysroot$func_stripname_result + ;; *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit $EXIT_FAILURE + func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; + *) func_append xrpath " $dir" ;; esac continue ;; - -static) + -shared) + # The effects of -shared are defined in a previous loop. + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects @@ -1730,47 +5759,49 @@ EOF prev=vinfo continue ;; + -version-number) prev=vinfo vinfo_number=yes continue ;; + -weak) + prev=weak + continue + ;; + -Wc,*) - args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" - case $flag in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - flag="\"$flag\"" - ;; - esac - arg="$arg $wl$flag" - compiler_flags="$compiler_flags $flag" + func_quote_for_eval "$flag" + func_append arg " $func_quote_for_eval_result" + func_append compiler_flags " $func_quote_for_eval_result" done IFS="$save_ifs" - arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + func_stripname ' ' '' "$arg" + arg=$func_stripname_result ;; -Wl,*) - args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" - case $flag in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - flag="\"$flag\"" - ;; - esac - arg="$arg $wl$flag" - compiler_flags="$compiler_flags $wl$flag" - linker_flags="$linker_flags $flag" + func_quote_for_eval "$flag" + func_append arg " $wl$func_quote_for_eval_result" + func_append compiler_flags " $wl$func_quote_for_eval_result" + func_append linker_flags " $func_quote_for_eval_result" done IFS="$save_ifs" - arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + func_stripname ' ' '' "$arg" + arg=$func_stripname_result ;; -Xcompiler) @@ -1788,53 +5819,68 @@ EOF continue ;; + # -msg_* for osf cc + -msg_*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + # Flags to be passed through unchanged, with rationale: + # -64, -mips[0-9] enable 64-bit mode for the SGI compiler + # -r[0-9][0-9]* specify processor for the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler + # +DA*, +DD* enable 64-bit mode for the HP compiler + # -q* compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* architecture-specific flags for GCC + # -F/path path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* profiling flags for GCC + # @file GCC response files + # -tp=* Portland pgcc target processor selection + # --sysroot=* for sysroot support + # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-flto*|-fwhopr*|-fuse-linker-plugin) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + func_append compile_command " $arg" + func_append finalize_command " $arg" + func_append compiler_flags " $arg" + continue + ;; + # Some other compiler flag. -* | +*) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" ;; *.$objext) # A standard object. - objs="$objs $arg" + func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac + func_source "$arg" - if test -z "$pic_object" || \ + if test -z "$pic_object" || test -z "$non_pic_object" || - test "$pic_object" = none && \ + test "$pic_object" = none && test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit $EXIT_FAILURE + func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. @@ -1842,7 +5888,7 @@ EOF if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" + func_append dlfiles " $pic_object" prev= continue else @@ -1854,12 +5900,12 @@ EOF # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" + func_append dlprefiles " $pic_object" prev= fi # A PIC object. - libobjs="$libobjs $pic_object" + func_append libobjs " $pic_object" arg="$pic_object" fi @@ -1869,7 +5915,7 @@ EOF non_pic_object="$xdir$non_pic_object" # A standard non-PIC object - non_pic_objects="$non_pic_objects $non_pic_object" + func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi @@ -1877,52 +5923,47 @@ EOF # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" + func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit $EXIT_FAILURE - else - # Dry-run case. - + if $opt_dry_run; then # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. - deplibs="$deplibs $arg" - old_deplibs="$old_deplibs $arg" + func_append deplibs " $arg" + func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. + func_resolve_sysroot "$arg" if test "$prev" = dlfiles; then # This library was specified with -dlopen. - dlfiles="$dlfiles $arg" + func_append dlfiles " $func_resolve_sysroot_result" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. - dlprefiles="$dlprefiles $arg" + func_append dlprefiles " $func_resolve_sysroot_result" prev= else - deplibs="$deplibs $arg" + func_append deplibs " $func_resolve_sysroot_result" fi continue ;; @@ -1931,70 +5972,53 @@ EOF *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" fi done # argument parsing loop - if test -n "$prev"; then - $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi + test -n "$prev" && \ + func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory - outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + func_basename "$output" + outputname="$func_basename_result" libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" - output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` - if test "X$output_objdir" = "X$output"; then - output_objdir="$objdir" - else - output_objdir="$output_objdir/$objdir" - fi + func_dirname "$output" "/" "" + output_objdir="$func_dirname_result$objdir" + func_to_tool_file "$output_objdir/" + tool_output_objdir=$func_to_tool_file_result # Create the object directory. - if test ! -d "$output_objdir"; then - $show "$mkdir $output_objdir" - $run $mkdir $output_objdir - exit_status=$? - if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then - exit $exit_status - fi - fi + func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") - $echo "$modename: you must specify an output file" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE + func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; @@ -2002,27 +6026,18 @@ EOF *) linkmode=prog ;; # Anything else should be a program. esac - case $host in - *cygwin* | *mingw* | *pw32*) - # don't eliminate duplications in $postdeps and $predeps - duplicate_compiler_generated_deps=yes - ;; - *) - duplicate_compiler_generated_deps=$duplicate_deps - ;; - esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do - if test "X$duplicate_deps" = "Xyes" ; then + if $opt_preserve_dup_deps ; then case "$libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi - libs="$libs $deplib" + func_append libs " $deplib" done if test "$linkmode" = lib; then @@ -2032,12 +6047,12 @@ EOF # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= - if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then + if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in - *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac - pre_post_deps="$pre_post_deps $pre_post_dep" + func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= @@ -2048,15 +6063,16 @@ EOF newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + case $linkmode in lib) - passes="conv link" + passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) - $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 - exit $EXIT_FAILURE + func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done @@ -2072,7 +6088,20 @@ EOF *) passes="conv" ;; esac + for pass in $passes; do + # The preopen pass in lib mode reverses $deplibs; put it back here + # so that -L comes before libs that need it for instance... + if test "$linkmode,$pass" = "lib,link"; then + ## FIXME: Find the place where the list is rebuilt in the wrong + ## order, and fix it there properly + tmp_deplibs= + for deplib in $deplibs; do + tmp_deplibs="$deplib $tmp_deplibs" + done + deplibs="$tmp_deplibs" + fi + if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" @@ -2085,31 +6114,67 @@ EOF link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi + if test "$linkmode,$pass" = "lib,dlpreopen"; then + # Collect and forward deplibs of preopened libtool libs + for lib in $dlprefiles; do + # Ignore non-libtool-libs + dependency_libs= + func_resolve_sysroot "$lib" + case $lib in + *.la) func_source "$func_resolve_sysroot_result" ;; + esac + + # Collect preopened libtool deplibs, except any this library + # has declared as weak libs + for deplib in $dependency_libs; do + func_basename "$deplib" + deplib_base=$func_basename_result + case " $weak_libs " in + *" $deplib_base "*) ;; + *) func_append deplibs " $deplib" ;; + esac + done + done + libs="$dlprefiles" + fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi + for deplib in $libs; do lib= found=no case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else - compiler_flags="$compiler_flags $deplib" + func_append compiler_flags " $deplib" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then - $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 + func_warning "\`-l' is ignored for archives/objects" continue fi - name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` - for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do + func_stripname '-l' '' "$deplib" + name=$func_stripname_result + if test "$linkmode" = lib; then + searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" + else + searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" + fi + for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" @@ -2139,21 +6204,17 @@ EOF if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) - if (${SED} -e '2q' $lib | - grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if func_lalib_p "$lib"; then library_names= old_library= - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac + func_source "$lib" for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$lib" && ladir="." + func_dirname "$lib" "" "." + ladir="$func_dirname_result" lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" @@ -2165,19 +6226,36 @@ EOF continue fi fi - ;; + ;; *) ;; esac fi fi ;; # -l + *.ltframework) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test "$pass" = conv; then @@ -2190,27 +6268,34 @@ EOF compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) - $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 + func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then - dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + func_stripname '-R' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; + *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; - *.la) lib="$deplib" ;; + *.la) + func_resolve_sysroot "$deplib" + lib=$func_resolve_sysroot_result + ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" @@ -2218,35 +6303,41 @@ EOF fi case $linkmode in lib) - valid_a_lib=no - case $deplibs_check_method in - match_pattern*) - set dummy $deplibs_check_method - match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` - if eval $echo \"$deplib\" 2>/dev/null \ - | $SED 10q \ + # Linking convenience modules into shared libraries is allowed, + # but linking other static libraries is non-portable. + case " $dlpreconveniencelibs " in + *" $deplib "*) ;; + *) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then - valid_a_lib=yes - fi + valid_a_lib=yes + fi ;; - pass_all) - valid_a_lib=yes + pass_all) + valid_a_lib=yes ;; - esac - if test "$valid_a_lib" != yes; then - $echo - $echo "*** Warning: Trying to link with static lib archive $deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because the file extensions .$libext of this argument makes me believe" - $echo "*** that it is just a static archive that I should not used here." - else - $echo - $echo "*** Warning: Linking the shared library $output against the" - $echo "*** static library $deplib is not portable!" - deplibs="$deplib $deplibs" - fi + esac + if test "$valid_a_lib" != yes; then + echo + $ECHO "*** Warning: Trying to link with static lib archive $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not use here." + else + echo + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + ;; + esac continue ;; prog) @@ -2267,11 +6358,11 @@ EOF if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. - newdlprefiles="$newdlprefiles $deplib" + func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else - newdlfiles="$newdlfiles $deplib" + func_append newdlfiles " $deplib" fi fi continue @@ -2281,21 +6372,18 @@ EOF continue ;; esac # case $deplib + if test "$found" = yes || test -f "$lib"; then : else - $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 - exit $EXIT_FAILURE + func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" fi # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi + func_lalib_unsafe_p "$lib" \ + || func_fatal_error "\`$lib' is not a valid libtool archive" - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$lib" && ladir="." + func_dirname "$lib" "" "." + ladir="$func_dirname_result" dlname= dlopen= @@ -2303,6 +6391,7 @@ EOF libdir= library_names= old_library= + inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes @@ -2311,16 +6400,24 @@ EOF # Read the .la file - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - + func_source "$lib" + + # Convert "-framework foo" to "foo.ltframework" + if test -n "$inherited_linker_flags"; then + tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do + case " $new_inherited_linker_flags " in + *" $tmp_inherited_linker_flag "*) ;; + *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; + esac + done + fi + dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && dlfiles="$dlfiles $dlopen" - test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + test -n "$dlopen" && func_append dlfiles " $dlopen" + test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test "$pass" = conv; then @@ -2328,45 +6425,47 @@ EOF deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit $EXIT_FAILURE + func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. - convenience="$convenience $ladir/$objdir/$old_library" - old_convenience="$old_convenience $ladir/$objdir/$old_library" - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done + func_append convenience " $ladir/$objdir/$old_library" + func_append old_convenience " $ladir/$objdir/$old_library" elif test "$linkmode" != prog && test "$linkmode" != lib; then - $echo "$modename: \`$lib' is not a convenience library" 1>&2 - exit $EXIT_FAILURE + func_fatal_error "\`$lib' is not a convenience library" fi + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done continue fi # $pass = conv # Get the name of the library we link against. linklib= - for l in $old_library $library_names; do - linklib="$l" - done + if test -n "$old_library" && + { test "$prefer_static_libs" = yes || + test "$prefer_static_libs,$installed" = "built,no"; }; then + linklib=$old_library + else + for l in $old_library $library_names; do + linklib="$l" + done + fi if test -z "$linklib"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit $EXIT_FAILURE + func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then - $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 - exit $EXIT_FAILURE + func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || @@ -2375,9 +6474,9 @@ EOF # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. - dlprefiles="$dlprefiles $lib $dependency_libs" + func_append dlprefiles " $lib $dependency_libs" else - newdlfiles="$newdlfiles $lib" + func_append newdlfiles " $lib" fi continue fi # $pass = dlopen @@ -2388,24 +6487,25 @@ EOF *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 - $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + func_warning "cannot determine absolute directory name of \`$ladir'" + func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac - laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + func_basename "$lib" + laname="$func_basename_result" # Find the relevant object directory and library name. if test "X$installed" = Xyes; then - if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - $echo "$modename: warning: library \`$lib' was moved." 1>&2 + if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else - dir="$libdir" - absdir="$libdir" + dir="$lt_sysroot$libdir" + absdir="$lt_sysroot$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else @@ -2413,32 +6513,62 @@ EOF dir="$ladir" absdir="$abs_ladir" # Remove this search path later - notinst_path="$notinst_path $abs_ladir" + func_append notinst_path " $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later - notinst_path="$notinst_path $abs_ladir" + func_append notinst_path " $abs_ladir" fi fi # $installed = yes - name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + func_stripname 'lib' '.la' "$laname" + name=$func_stripname_result # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then - if test -z "$libdir"; then - $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 - exit $EXIT_FAILURE - fi - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - newdlprefiles="$newdlprefiles $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - newdlprefiles="$newdlprefiles $dir/$dlname" - else - newdlprefiles="$newdlprefiles $dir/$linklib" + if test -z "$libdir" && test "$linkmode" = prog; then + func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi + case "$host" in + # special handling for platforms with PE-DLLs. + *cygwin* | *mingw* | *cegcc* ) + # Linker will automatically link against shared library if both + # static and shared are present. Therefore, ensure we extract + # symbols from the import library if a shared library is present + # (otherwise, the dlopen module name will be incorrect). We do + # this by putting the import library name into $newdlprefiles. + # We recover the dlopen module name by 'saving' the la file + # name in a special purpose variable, and (later) extracting the + # dlname from the la file. + if test -n "$dlname"; then + func_tr_sh "$dir/$linklib" + eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" + func_append newdlprefiles " $dir/$linklib" + else + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + fi + ;; + * ) + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + func_append newdlprefiles " $dir/$dlname" + else + func_append newdlprefiles " $dir/$linklib" + fi + ;; + esac fi # $pass = dlpreopen if test -z "$libdir"; then @@ -2456,7 +6586,7 @@ EOF if test "$linkmode" = prog && test "$pass" != link; then - newlib_search_path="$newlib_search_path $ladir" + func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=no @@ -2468,7 +6598,10 @@ EOF tmp_libs= for deplib in $dependency_libs; do case $deplib in - -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then @@ -2478,26 +6611,27 @@ EOF # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi - if test "X$duplicate_deps" = "Xyes" ; then + if $opt_preserve_dup_deps ; then case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi - tmp_libs="$tmp_libs $deplib" + func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + { { test "$prefer_static_libs" = no || + test "$prefer_static_libs,$installed" = "built,yes"; } || + test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *" $absdir "*) ;; - *) temp_rpath="$temp_rpath $absdir" ;; + case "$temp_rpath:" in + *"$absdir:"*) ;; + *) func_append temp_rpath "$absdir:" ;; esac fi @@ -2509,7 +6643,7 @@ EOF *) case "$compile_rpath " in *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" + *) func_append compile_rpath " $absdir" ;; esac ;; esac @@ -2518,7 +6652,7 @@ EOF *) case "$finalize_rpath " in *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" + *) func_append finalize_rpath " $libdir" ;; esac ;; esac @@ -2535,27 +6669,43 @@ EOF link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs - if test "$use_static_libs" = built && test "$installed" = yes ; then + if test "$use_static_libs" = built && test "$installed" = yes; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then - if test "$installed" = no; then - notinst_deplibs="$notinst_deplibs $lib" - need_relink=yes - fi + case $host in + *cygwin* | *mingw* | *cegcc*) + # No point in relinking DLLs because paths are not encoded + func_append notinst_deplibs " $lib" + need_relink=no + ;; + *) + if test "$installed" = no; then + func_append notinst_deplibs " $lib" + need_relink=yes + fi + ;; + esac # This is a shared library - # Warn about portability, can't link against -module's on - # some systems (darwin) - if test "$shouldnotlink" = yes && test "$pass" = link ; then - $echo + # Warn about portability, can't link against -module's on some + # systems (darwin). Don't bleat about dlopened modules though! + dlopenmodule="" + for dlpremoduletest in $dlprefiles; do + if test "X$dlpremoduletest" = "X$lib"; then + dlopenmodule="$dlpremoduletest" + break + fi + done + if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then + echo if test "$linkmode" = prog; then - $echo "*** Warning: Linking the executable $output against the loadable module" + $ECHO "*** Warning: Linking the executable $output against the loadable module" else - $echo "*** Warning: Linking the shared library $output against the loadable module" + $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi - $echo "*** $linklib is not portable!" + $ECHO "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then @@ -2567,7 +6717,7 @@ EOF *) case "$compile_rpath " in *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" + *) func_append compile_rpath " $absdir" ;; esac ;; esac @@ -2576,7 +6726,7 @@ EOF *) case "$finalize_rpath " in *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" + *) func_append finalize_rpath " $libdir" ;; esac ;; esac @@ -2585,17 +6735,19 @@ EOF if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names - realname="$2" - shift; shift - libname=`eval \\$echo \"$libname_spec\"` + shift + realname="$1" + shift + libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in - *cygwin* | mingw*) - major=`expr $current - $age` + *cygwin* | mingw* | *cegcc*) + func_arith $current - $age + major=$func_arith_result versuffix="-$major" ;; esac @@ -2606,43 +6758,29 @@ EOF # Make a new name for the extract_expsyms_cmds to use soroot="$soname" - soname=`$echo $soroot | ${SED} -e 's/^.*\///'` - newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" + func_basename "$soroot" + soname="$func_basename_result" + func_stripname 'lib' '.dll' "$soname" + newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else - $show "extracting exported symbol list from \`$soname'" - save_ifs="$IFS"; IFS='~' - cmds=$extract_expsyms_cmds - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" + func_verbose "extracting exported symbol list from \`$soname'" + func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else - $show "generating import library for \`$soname'" - save_ifs="$IFS"; IFS='~' - cmds=$old_archive_from_expsyms_cmds - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" + func_verbose "generating import library for \`$soname'" + func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" - if test "$linkmode" = prog || test "$mode" != relink; then + if test "$linkmode" = prog || test "$opt_mode" != relink; then add_shlibpath= add_dir= add= @@ -2657,17 +6795,21 @@ EOF *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) - # if the lib is a module then we can not link against - # it, someone is ignoring the new warnings I added + # if the lib is a (non-dlopened) module then we can not + # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | - $EGREP ": [^:]* bundle" >/dev/null ; then - $echo "** Warning, lib $linklib is a module, not a shared library" - if test -z "$old_library" ; then - $echo - $echo "** And there doesn't seem to be a static archive available" - $echo "** The link will probably fail, sorry" - else - add="$dir/$old_library" + $GREP ": [^:]* bundle" >/dev/null ; then + if test "X$dlopenmodule" != "X$lib"; then + $ECHO "*** Warning: lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + echo + echo "*** And there doesn't seem to be a static archive available" + echo "*** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + elif test -n "$old_library"; then + add="$dir/$old_library" fi fi esac @@ -2685,7 +6827,8 @@ EOF fi ;; relink) - if test "$hardcode_direct" = yes; then + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" @@ -2693,7 +6836,7 @@ EOF if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" + func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi @@ -2709,14 +6852,13 @@ EOF esac if test "$lib_linked" != yes; then - $echo "$modename: configuration error: unsupported hardcode properties" - exit $EXIT_FAILURE + func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; - *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then @@ -2725,23 +6867,24 @@ EOF else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" - if test "$hardcode_direct" != yes && \ - test "$hardcode_minus_L" != yes && \ + if test "$hardcode_direct" != yes && + test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi - if test "$linkmode" = prog || test "$mode" = relink; then + if test "$linkmode" = prog || test "$opt_mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes; then + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" @@ -2749,15 +6892,15 @@ EOF elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + *) func_append finalize_shlibpath "$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then - add="$inst_prefix_dir$libdir/$linklib" + add="$inst_prefix_dir$libdir/$linklib" else - add="$libdir/$linklib" + add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. @@ -2766,7 +6909,7 @@ EOF if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" + func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi @@ -2801,21 +6944,21 @@ EOF # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. - $echo - $echo "*** Warning: This system can not link to static lib archive $lib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have." + echo + $ECHO "*** Warning: This system can not link to static lib archive $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then - $echo "*** But as you try to build a module library, libtool will still create " - $echo "*** a static module, that should work as long as the dlopening application" - $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module @@ -2839,120 +6982,113 @@ EOF temp_deplibs= for libdir in $dependency_libs; do case $libdir in - -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` + -R*) func_stripname '-R' '' "$libdir" + temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; - *) xrpath="$xrpath $temp_xrpath";; + *) func_append xrpath " $temp_xrpath";; esac;; - *) temp_deplibs="$temp_deplibs $libdir";; + *) func_append temp_deplibs " $libdir";; esac done dependency_libs="$temp_deplibs" fi - newlib_search_path="$newlib_search_path $absdir" + func_append newlib_search_path " $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" - if test "X$duplicate_deps" = "Xyes" ; then + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result";; + *) func_resolve_sysroot "$deplib" ;; + esac + if $opt_preserve_dup_deps ; then case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + *" $func_resolve_sysroot_result "*) + func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi - tmp_libs="$tmp_libs $deplib" + func_append tmp_libs " $func_resolve_sysroot_result" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do + path= case $deplib in -L*) path="$deplib" ;; *.la) - dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$deplib" && dir="." + func_resolve_sysroot "$deplib" + deplib=$func_resolve_sysroot_result + func_dirname "$deplib" "" "." + dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac - if grep "^installed=no" $deplib > /dev/null; then - path="$absdir/$objdir" - else - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - if test -z "$libdir"; then - $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - if test "$absdir" != "$libdir"; then - $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 - fi - path="$absdir" - fi - depdepl= + if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) - # we do not want to link against static libs, - # but need to link against shared + depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done - if test -f "$path/$depdepl" ; then - depdepl="$path/$depdepl" + if test -f "$absdir/$objdir/$depdepl" ; then + depdepl="$absdir/$objdir/$depdepl" + darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + if test -z "$darwin_install_name"; then + darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + fi + func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" + func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" + path= fi - # do not add paths which are already there - case " $newlib_search_path " in - *" $path "*) ;; - *) newlib_search_path="$newlib_search_path $path";; - esac fi - path="" ;; *) - path="-L$path" + path="-L$absdir/$objdir" ;; esac + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + test "$absdir" != "$libdir" && \ + func_warning "\`$deplib' seems to be moved" + + path="-L$absdir" + fi ;; - -l*) - case $host in - *-*-darwin*) - # Again, we only want to link against shared libraries - eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` - for tmp in $newlib_search_path ; do - if test -f "$tmp/lib$tmp_libs.dylib" ; then - eval depdepl="$tmp/lib$tmp_libs.dylib" - break - fi - done - path="" - ;; - *) continue ;; - esac - ;; - *) continue ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac - case " $deplibs " in - *" $depdepl "*) ;; - *) deplibs="$depdepl $deplibs" ;; - esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs + if test "$pass" = link; then + if test "$linkmode" = "prog"; then + compile_deplibs="$new_inherited_linker_flags $compile_deplibs" + finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" + else + compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + fi + fi dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries @@ -2967,7 +7103,7 @@ EOF for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir" ;; + *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= @@ -3025,10 +7161,10 @@ EOF -L*) case " $tmp_libs " in *" $deplib "*) ;; - *) tmp_libs="$tmp_libs $deplib" ;; + *) func_append tmp_libs " $deplib" ;; esac ;; - *) tmp_libs="$tmp_libs $deplib" ;; + *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" @@ -3044,98 +7180,96 @@ EOF ;; esac if test -n "$i" ; then - tmp_libs="$tmp_libs $i" + func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" + fi + if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 - fi - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + func_warning "\`-dlopen' is ignored for archives" fi - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 - fi + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for archives" ;; + esac - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 - fi + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for archives" - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 - fi + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for archives" - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 - fi + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for archives" - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 - fi + test -n "$release" && \ + func_warning "\`-release' is ignored for archives" + + test -n "$export_symbols$export_symbols_regex" && \ + func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" - objs="$objs$old_deplibs" + func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + func_stripname 'lib' '.la' "$outputname" + name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) - if test "$module" = no; then - $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi + test "$module" = no && \ + func_fatal_help "libtool library \`$output' must begin with \`lib'" + if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + func_stripname '' '.la' "$outputname" + name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else - libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + func_stripname '' '.la' "$outputname" + libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then - $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 - exit $EXIT_FAILURE + func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else - $echo - $echo "*** Warning: Linking the shared library $output against the non-libtool" - $echo "*** objects $objs is not portable!" - libobjs="$libobjs $objs" + echo + $ECHO "*** Warning: Linking the shared library $output against the non-libtool" + $ECHO "*** objects $objs is not portable!" + func_append libobjs " $objs" fi fi - if test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 - fi + test "$dlself" != no && \ + func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath - if test "$#" -gt 2; then - $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 - fi - install_libdir="$2" + shift + test "$#" -gt 1 && \ + func_warning "ignoring multiple \`-rpath's for a libtool library" + + install_libdir="$1" oldlibs= if test -z "$rpath"; then @@ -3149,25 +7283,21 @@ EOF build_old_libs=yes fi - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 - fi + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for convenience libraries" - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 - fi + test -n "$release" && \ + func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 + shift IFS="$save_ifs" - if test -n "$8"; then - $echo "$modename: too many parameters to \`-version-info'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi + test -n "$7" && \ + func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts @@ -3175,9 +7305,9 @@ EOF case $vinfo_number in yes) - number_major="$2" - number_minor="$3" - number_revision="$4" + number_major="$1" + number_minor="$2" + number_revision="$3" # # There are really only two kinds -- those that # use the current revision as the major version @@ -3186,27 +7316,30 @@ EOF # which has an extra 1 added just for fun # case $version_type in - darwin|linux|osf|windows) - current=`expr $number_major + $number_minor` + darwin|linux|osf|windows|none) + func_arith $number_major + $number_minor + current=$func_arith_result age="$number_minor" revision="$number_revision" ;; - freebsd-aout|freebsd-elf|sunos) + freebsd-aout|freebsd-elf|qnx|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) - current=`expr $number_major + $number_minor - 1` + func_arith $number_major + $number_minor + current=$func_arith_result age="$number_minor" revision="$number_minor" + lt_irix_increment=no ;; esac ;; no) - current="$2" - revision="$3" - age="$4" + current="$1" + revision="$2" + age="$3" ;; esac @@ -3214,34 +7347,30 @@ EOF case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE + func_error "CURRENT \`$current' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE + func_error "REVISION \`$revision' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE + func_error "AGE \`$age' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then - $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE + func_error "AGE \`$age' is greater than the current interface number \`$current'" + func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. @@ -3254,11 +7383,14 @@ EOF darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header - major=.`expr $current - $age` + func_arith $current - $age + major=.$func_arith_result versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... - minor_current=`expr $current + 1` - verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + func_arith $current + 1 + minor_current=$func_arith_result + xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) @@ -3268,11 +7400,16 @@ EOF freebsd-elf) major=".$current" - versuffix=".$current"; + versuffix=".$current" ;; irix | nonstopux) - major=`expr $current - $age + 1` + if test "X$lt_irix_increment" = "Xno"; then + func_arith $current - $age + else + func_arith $current - $age + 1 + fi + major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; @@ -3283,8 +7420,10 @@ EOF # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do - iface=`expr $revision - $loop` - loop=`expr $loop - 1` + func_arith $revision - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result verstring="$verstring_prefix$major.$iface:$verstring" done @@ -3294,25 +7433,34 @@ EOF ;; linux) - major=.`expr $current - $age` + func_arith $current - $age + major=.$func_arith_result versuffix="$major.$age.$revision" ;; osf) - major=.`expr $current - $age` + func_arith $current - $age + major=.$func_arith_result versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do - iface=`expr $current - $loop` - loop=`expr $loop - 1` + func_arith $current - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result verstring="$verstring:${iface}.0" done # Make executables depend on our current version. - verstring="$verstring:${current}.0" + func_append verstring ":${current}.0" + ;; + + qnx) + major=".$current" + versuffix=".$current" ;; sunos) @@ -3323,14 +7471,13 @@ EOF windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. - major=`expr $current - $age` + func_arith $current - $age + major=$func_arith_result versuffix="-$major" ;; *) - $echo "$modename: unknown library version type \`$version_type'" 1>&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit $EXIT_FAILURE + func_fatal_configuration "unknown library version type \`$version_type'" ;; esac @@ -3364,7 +7511,7 @@ EOF # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then - $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi @@ -3372,58 +7519,62 @@ EOF # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi + fi - if test "$mode" != relink; then + func_generate_dlsyms "$libname" "$libname" "yes" + func_append libobjs " $symfileobj" + test "X$libobjs" = "X " && libobjs= + + if test "$opt_mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= - tempremovelist=`$echo "$output_objdir/*"` + tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in - *.$objext) + *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then - if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 - then + if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then continue fi fi - removelist="$removelist $p" + func_append removelist " $p" ;; *) ;; esac done - if test -n "$removelist"; then - $show "${rm}r $removelist" - $run ${rm}r $removelist - fi + test -n "$removelist" && \ + func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - oldlibs="$oldlibs $output_objdir/$libname.$libext" + func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. - oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. - for path in $notinst_path; do - lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` - deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` - dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` - done + #for path in $notinst_path; do + # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` + # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` + # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` + #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do - temp_xrpath="$temp_xrpath -R$libdir" + func_replace_sysroot "$libdir" + func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; + *) func_append finalize_rpath " $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then @@ -3437,7 +7588,7 @@ EOF for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; - *) dlfiles="$dlfiles $lib" ;; + *) func_append dlfiles " $lib" ;; esac done @@ -3447,19 +7598,19 @@ EOF for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; - *) dlprefiles="$dlprefiles $lib" ;; + *) func_append dlprefiles " $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework - deplibs="$deplibs -framework System" + func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. @@ -3473,10 +7624,10 @@ EOF *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; - *) + *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then - deplibs="$deplibs -lc" + func_append deplibs " -lc" fi ;; esac @@ -3510,123 +7661,139 @@ EOF # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. - $rm conftest.c + $opt_dry_run || $RM conftest.c cat > conftest.c <<EOF int main() { return 0; } EOF - $rm conftest - $LTCC $LTCFLAGS -o conftest conftest.c $deplibs - if test "$?" -eq 0 ; then + $opt_dry_run || $RM conftest + if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then ldd_output=`ldd conftest` for i in $deplibs; do - name=`expr $i : '-l\(.*\)'` - # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" -ne "0"; then + case $i in + -l*) + func_stripname -l '' "$i" + name=$func_stripname_result if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $i "*) - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" i="" ;; esac - fi + fi if test -n "$i" ; then - libname=`eval \\$echo \"$libname_spec\"` - deplib_matches=`eval \\$echo \"$library_names_spec\"` - set dummy $deplib_matches - deplib_match=$2 + libname=`eval "\\$ECHO \"$libname_spec\""` + deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` + set dummy $deplib_matches; shift + deplib_match=$1 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" else droppeddeps=yes - $echo - $echo "*** Warning: dynamic linker does not accept needed library $i." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which I believe you do not have" - $echo "*** because a test_compile did reveal that the linker did not use it for" - $echo "*** its dynamic dependency list that programs get resolved with at runtime." + echo + $ECHO "*** Warning: dynamic linker does not accept needed library $i." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which I believe you do not have" + echo "*** because a test_compile did reveal that the linker did not use it for" + echo "*** its dynamic dependency list that programs get resolved with at runtime." fi fi - else - newdeplibs="$newdeplibs $i" - fi + ;; + *) + func_append newdeplibs " $i" + ;; + esac done else # Error occurred in the first compile. Let's try to salvage # the situation: Compile a separate program for each library. for i in $deplibs; do - name=`expr $i : '-l\(.*\)'` - # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" != "0"; then - $rm conftest - $LTCC $LTCFLAGS -o conftest conftest.c $i - # Did it work? - if test "$?" -eq 0 ; then + case $i in + -l*) + func_stripname -l '' "$i" + name=$func_stripname_result + $opt_dry_run || $RM conftest + if $LTCC $LTCFLAGS -o conftest conftest.c $i; then ldd_output=`ldd conftest` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $i "*) - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" i="" ;; esac fi if test -n "$i" ; then - libname=`eval \\$echo \"$libname_spec\"` - deplib_matches=`eval \\$echo \"$library_names_spec\"` - set dummy $deplib_matches - deplib_match=$2 + libname=`eval "\\$ECHO \"$libname_spec\""` + deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` + set dummy $deplib_matches; shift + deplib_match=$1 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" else droppeddeps=yes - $echo - $echo "*** Warning: dynamic linker does not accept needed library $i." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because a test_compile did reveal that the linker did not use this one" - $echo "*** as a dynamic dependency that programs can get resolved with at runtime." + echo + $ECHO "*** Warning: dynamic linker does not accept needed library $i." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because a test_compile did reveal that the linker did not use this one" + echo "*** as a dynamic dependency that programs can get resolved with at runtime." fi fi else droppeddeps=yes - $echo - $echo "*** Warning! Library $i is needed by this library but I was not able to" - $echo "*** make it link in! You will probably need to install it or some" - $echo "*** library that it depends on before this library will be fully" - $echo "*** functional. Installing it before continuing would be even better." + echo + $ECHO "*** Warning! Library $i is needed by this library but I was not able to" + echo "*** make it link in! You will probably need to install it or some" + echo "*** library that it depends on before this library will be fully" + echo "*** functional. Installing it before continuing would be even better." fi - else - newdeplibs="$newdeplibs $i" - fi + ;; + *) + func_append newdeplibs " $i" + ;; + esac done fi ;; file_magic*) - set dummy $deplibs_check_method - file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + set dummy $deplibs_check_method; shift + file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do - name=`expr $a_deplib : '-l\(.*\)'` - # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" != "0"; then + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then - libname=`eval \\$echo \"$libname_spec\"` + libname=`eval "\\$ECHO \"$libname_spec\""` + if test -n "$file_magic_glob"; then + libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob` + else + libnameglob=$libname + fi + test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + if test "$want_nocaseglob" = yes; then + shopt -s nocaseglob + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + $nocaseglob + else + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + fi for potent_lib in $potential_libs; do # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null \ - | grep " -> " >/dev/null; then + if ls -lLd "$potent_lib" 2>/dev/null | + $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an @@ -3639,13 +7806,13 @@ EOF potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; esac done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ - | ${SED} 10q \ - | $EGREP "$file_magic_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | + $SED -e 10q | + $EGREP "$file_magic_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi @@ -3654,50 +7821,52 @@ EOF fi if test -n "$a_deplib" ; then droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for file magic test)" + $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a file magic. Last file checked: $potlib" + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a file magic. Last file checked: $potlib" fi fi - else + ;; + *) # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi + func_append newdeplibs " $a_deplib" + ;; + esac done # Gone through all deplibs. ;; match_pattern*) - set dummy $deplibs_check_method - match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do - name=`expr $a_deplib : '-l\(.*\)'` - # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then - libname=`eval \\$echo \"$libname_spec\"` + libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test - if eval $echo \"$potent_lib\" 2>/dev/null \ - | ${SED} 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" + if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ + $EGREP "$match_pattern_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi @@ -3706,46 +7875,48 @@ EOF fi if test -n "$a_deplib" ; then droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for regex pattern test)" + $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a regex pattern. Last file checked: $potlib" + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi - else + ;; + *) # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi + func_append newdeplibs " $a_deplib" + ;; + esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" - tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ - -e 's/ -[LR][^ ]*//g'` + tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` + tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` done fi - if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ - | grep . >/dev/null; then - $echo + case $tmp_deplibs in + *[!\ \ ]*) + echo if test "X$deplibs_check_method" = "Xnone"; then - $echo "*** Warning: inter-library dependencies are not supported in this platform." + echo "*** Warning: inter-library dependencies are not supported in this platform." else - $echo "*** Warning: inter-library dependencies are not known to be supported." + echo "*** Warning: inter-library dependencies are not known to be supported." fi - $echo "*** All declared inter-library dependencies are being dropped." + echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes - fi + ;; + esac ;; esac versuffix=$versuffix_save @@ -3756,24 +7927,24 @@ EOF case $host in *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` + # On Rhapsody replace the C library with the System framework + newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then - $echo - $echo "*** Warning: libtool could not satisfy all declared inter-library" - $echo "*** dependencies of module $libname. Therefore, libtool will create" - $echo "*** a static module, that should work as long as the dlopening" - $echo "*** application is linked with the -dlopen flag." + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + $ECHO "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" @@ -3783,16 +7954,16 @@ EOF build_libtool_libs=no fi else - $echo "*** The inter-library dependencies that have been dropped here will be" - $echo "*** automatically added whenever a program is linked with this library" - $echo "*** or is declared to -dlopen it." + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then - $echo - $echo "*** Since this library must not contain undefined symbols," - $echo "*** because either the platform does not support them or" - $echo "*** it was explicitly requested with -no-undefined," - $echo "*** libtool will only create a static version of it." + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module @@ -3806,7 +7977,14 @@ EOF # Done checking deplibs! deplibs=$newdeplibs fi - + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + case $host in + *-*-darwin*) + newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list @@ -3817,7 +7995,7 @@ EOF *) case " $deplibs " in *" -L$path/$objdir "*) - new_libs="$new_libs -L$path/$objdir" ;; + func_append new_libs " -L$path/$objdir" ;; esac ;; esac @@ -3827,15 +8005,14 @@ EOF -L*) case " $new_libs " in *" $deplib "*) ;; - *) new_libs="$new_libs $deplib" ;; + *) func_append new_libs " $deplib" ;; esac ;; - *) new_libs="$new_libs $deplib" ;; + *) func_append new_libs " $deplib" ;; esac done deplibs="$new_libs" - # All the library-specific variables (install_libdir is set above). library_names= old_library= @@ -3848,10 +8025,12 @@ EOF hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" - test "$mode" != relink && rpath="$compile_rpath$rpath" + test "$opt_mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else @@ -3860,18 +8039,18 @@ EOF *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" - dep_rpath="$dep_rpath $flag" + func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; + *) func_apped perm_rpath " $libdir" ;; esac fi done @@ -3889,7 +8068,7 @@ EOF # We should set the runpath_var. rpath= for dir in $perm_rpath; do - rpath="$rpath$dir:" + func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi @@ -3897,7 +8076,7 @@ EOF fi shlibpath="$finalize_shlibpath" - test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi @@ -3906,8 +8085,9 @@ EOF eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names - realname="$2" - shift; shift + shift + realname="$1" + shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" @@ -3922,83 +8102,166 @@ EOF linknames= for link do - linknames="$linknames $link" + func_append linknames " $link" done # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` + test "X$libobjs" = "X " && libobjs= + + delfiles= + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" + export_symbols="$output_objdir/$libname.uexp" + func_append delfiles " $export_symbols" + fi + + orig_export_symbols= + case $host_os in + cygwin* | mingw* | cegcc*) + if test -n "$export_symbols" && test -z "$export_symbols_regex"; then + # exporting using user supplied symfile + if test "x`$SED 1q $export_symbols`" != xEXPORTS; then + # and it's NOT already a .def file. Must figure out + # which of the given symbols are data symbols and tag + # them as such. So, trigger use of export_symbols_cmds. + # export_symbols gets reassigned inside the "prepare + # the list of exported symbols" if statement, so the + # include_expsyms logic still works. + orig_export_symbols="$export_symbols" + export_symbols= + always_export_symbols=yes + fi + fi + ;; + esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - $show "generating symbol list for \`$libname.la'" + func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols + $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do + for cmd1 in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" - if len=`expr "X$cmd" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - $show "$cmd" - $run eval "$cmd" || exit $? - skipped_export=false + # Take the normal branch if the nm_file_list_spec branch + # doesn't work or if tool conversion is not needed. + case $nm_file_list_spec~$to_tool_file_cmd in + *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) + try_normal_branch=yes + eval cmd=\"$cmd1\" + func_len " $cmd" + len=$func_len_result + ;; + *) + try_normal_branch=no + ;; + esac + if test "$try_normal_branch" = yes \ + && { test "$len" -lt "$max_cmd_len" \ + || test "$max_cmd_len" -le -1; } + then + func_show_eval "$cmd" 'exit $?' + skipped_export=false + elif test -n "$nm_file_list_spec"; then + func_basename "$output" + output_la=$func_basename_result + save_libobjs=$libobjs + save_output=$output + output=${output_objdir}/${output_la}.nm + func_to_tool_file "$output" + libobjs=$nm_file_list_spec$func_to_tool_file_result + func_append delfiles " $output" + func_verbose "creating $NM input file list: $output" + for obj in $save_libobjs; do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > "$output" + eval cmd=\"$cmd1\" + func_show_eval "$cmd" 'exit $?' + output=$save_output + libobjs=$save_libobjs + skipped_export=false else - # The command line is too long to execute in one step. - $show "using reloadable object file for export list..." - skipped_export=: + # The command line is too long to execute in one step. + func_verbose "using reloadable object file for export list..." + skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" - if test -n "$export_symbols_regex"; then - $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" - $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - $show "$mv \"${export_symbols}T\" \"$export_symbols\"" - $run eval '$mv "${export_symbols}T" "$export_symbols"' + if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then - $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do - case " $convenience " in - *" $test_deplib "*) ;; - *) - tmp_deplibs="$tmp_deplibs $test_deplib" - ;; - esac + case " $convenience " in + *" $test_deplib "*) ;; + *) + func_append tmp_deplibs " $test_deplib" + ;; + esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec" && + test "$compiler_needs_object" = yes && + test -z "$libobjs"; then + # extract the archives, so we have objects to list. + # TODO: could optimize this to just extract one archive. + whole_archive_flag_spec= + fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" + func_append generated " $gentop" func_extract_archives $gentop $convenience - libobjs="$libobjs $func_extract_archives_result" + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= fi fi - + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" - linker_flags="$linker_flags $flag" + func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking - if test "$mode" = relink; then - $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? + if test "$opt_mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. @@ -4011,22 +8274,24 @@ EOF cmds=$module_cmds fi else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval test_cmds=\"$archive_expsym_cmds\" - cmds=$archive_expsym_cmds - else - eval test_cmds=\"$archive_cmds\" - cmds=$archive_cmds + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && - len=`expr "X$test_cmds" : ".*" 2>/dev/null` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + func_len " $test_cmds" && + len=$func_len_result && + test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else - # The command line is too long to link in one step, link piecewise. - $echo "creating reloadable object files..." + # The command line is too long to link in one step, link piecewise + # or, if using GNU ld and skipped_export is not :, use a linker + # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we @@ -4040,77 +8305,171 @@ EOF save_libobjs=$libobjs fi save_output=$output - output_la=`$echo "X$output" | $Xsed -e "$basename"` + func_basename "$output" + output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= - delfiles= last_robj= k=1 - output=$output_objdir/$output_la-${k}.$objext - # Loop over the list of objects to be linked. - for obj in $save_libobjs - do - eval test_cmds=\"$reload_cmds $objlist $last_robj\" - if test "X$objlist" = X || - { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && - test "$len" -le "$max_cmd_len"; }; then - objlist="$objlist $obj" + + if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then + output=${output_objdir}/${output_la}.lnkscript + func_verbose "creating GNU ld script: $output" + echo 'INPUT (' > $output + for obj in $save_libobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + echo ')' >> $output + func_append delfiles " $output" + func_to_tool_file "$output" + output=$func_to_tool_file_result + elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then + output=${output_objdir}/${output_la}.lnk + func_verbose "creating linker input file list: $output" + : > $output + set x $save_libobjs + shift + firstobj= + if test "$compiler_needs_object" = yes; then + firstobj="$1 " + shift + fi + for obj + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + func_append delfiles " $output" + func_to_tool_file "$output" + output=$firstobj\"$file_list_spec$func_to_tool_file_result\" + else + if test -n "$save_libobjs"; then + func_verbose "creating reloadable object files..." + output=$output_objdir/$output_la-${k}.$objext + eval test_cmds=\"$reload_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + if test "X$objlist" = X || + test "$len" -lt "$max_cmd_len"; then + func_append objlist " $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + reload_objs=$objlist + eval concat_cmds=\"$reload_cmds\" + else + # All subsequent reloadable object files will link in + # the last one created. + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + func_arith $k + 1 + k=$func_arith_result + output=$output_objdir/$output_la-${k}.$objext + objlist=" $obj" + func_len " $last_robj" + func_arith $len0 + $func_len_result + len=$func_arith_result + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\${concat_cmds}$reload_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" + fi + func_append delfiles " $output" + else - # The command $test_cmds is almost too long, add a - # command to the queue. - if test "$k" -eq 1 ; then - # The first file doesn't have a previous command to add. - eval concat_cmds=\"$reload_cmds $objlist $last_robj\" - else - # All subsequent reloadable object files will link in - # the last one created. - eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" + output= + fi + + if ${skipped_export-false}; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + libobjs=$output + # Append the command to create the export file. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi - last_robj=$output_objdir/$output_la-${k}.$objext - k=`expr $k + 1` - output=$output_objdir/$output_la-${k}.$objext - objlist=$obj - len=1 fi - done - # Handle the remaining objects by creating one last - # reloadable object file. All subsequent reloadable object - # files will link in the last one created. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" - - if ${skipped_export-false}; then - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols - libobjs=$output - # Append the command to create the export file. - eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" - fi - - # Set up a command to remove the reloadable object files - # after they are used. - i=0 - while test "$i" -lt "$k" - do - i=`expr $i + 1` - delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" - done - $echo "creating a temporary reloadable object file: $output" + test -n "$save_libobjs" && + func_verbose "creating a temporary reloadable object file: $output" - # Loop through the commands generated above and execute them. - save_ifs="$IFS"; IFS='~' - for cmd in $concat_cmds; do + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" + + if test -n "$export_symbols_regex" && ${skipped_export-false}; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + + if ${skipped_export-false}; then + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + fi libobjs=$output # Restore the value of output. @@ -4118,6 +8477,7 @@ EOF if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. @@ -4130,28 +8490,45 @@ EOF cmds=$module_cmds fi else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - cmds=$archive_expsym_cmds - else - cmds=$archive_cmds + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds fi fi + fi + + if test -n "$delfiles"; then + # Append the command to remove temporary files to $cmds. + eval cmds=\"\$cmds~\$RM $delfiles\" + fi + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" - # Append the command to remove the reloadable object files - # to the just-reset $cmds. - eval cmds=\"\$cmds~\$rm $delfiles\" + func_extract_archives $gentop $dlprefiles + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= fi + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || { + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit - if test "$mode" = relink; then - $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' + if test "$opt_mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) fi exit $lt_exit @@ -4160,13 +8537,12 @@ EOF IFS="$save_ifs" # Restore the uninstalled library and exit - if test "$mode" = relink; then - $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + if test "$opt_mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then - $show "${rm}r $gentop" - $run ${rm}r "$gentop" + func_show_eval '${RM}r "$gentop"' fi fi @@ -4176,8 +8552,7 @@ EOF # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then - $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" - $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done @@ -4190,38 +8565,35 @@ EOF ;; obj) - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 - fi - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + func_warning "\`-dlopen' is ignored for objects" fi - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 - fi + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for objects" ;; + esac - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 - fi + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for objects" - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 - fi + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for objects" - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 - fi + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for objects" + + test -n "$release" && \ + func_warning "\`-release' is ignored for objects" case $output in *.lo) - if test -n "$objs$old_deplibs"; then - $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 - exit $EXIT_FAILURE - fi - libobj="$output" - obj=`$echo "X$output" | $Xsed -e "$lo2o"` + test -n "$objs$old_deplibs" && \ + func_fatal_error "cannot build library object \`$output' from non-libtool objects" + + libobj=$output + func_lo2o "$libobj" + obj=$func_lo2o_result ;; *) libobj= @@ -4230,7 +8602,7 @@ EOF esac # Delete the old objects. - $run $rm $obj $libobj + $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create @@ -4239,40 +8611,36 @@ EOF reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec + # -Wl from whole_archive_flag_spec and hope we can get by with + # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then - eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` else gentop="$output_objdir/${obj}x" - generated="$generated $gentop" + func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi + # If we're not building shared, we need to use non_pic_objs + test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" + # Create the old-style object. - reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" - cmds=$reload_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" + func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop + func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS @@ -4280,14 +8648,13 @@ EOF if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop + func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" - # $run eval "echo timestamp > $libobj" || exit $? + # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi @@ -4295,20 +8662,11 @@ EOF # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" - cmds=$reload_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" + func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop + func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS @@ -4316,39 +8674,45 @@ EOF prog) case $host in - *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; + *cygwin*) func_stripname '' '.exe' "$output" + output=$func_stripname_result.exe;; esac - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 - fi + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for programs" - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 - fi + test -n "$release" && \ + func_warning "\`-release' is ignored for programs" - if test "$preload" = yes; then - if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && - test "$dlopen_self_static" = unknown; then - $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." - fi - fi + test "$preload" = yes \ + && test "$dlopen_support" = unknown \ + && test "$dlopen_self" = unknown \ + && test "$dlopen_self_static" = unknown && \ + func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework - compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` - finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in - *darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - if test "$tagname" = CXX ; then - compile_command="$compile_command ${wl}-bind_at_load" - finalize_command="$finalize_command ${wl}-bind_at_load" - fi - ;; + *-*-darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + # But is supposedly fixed on 10.4 or later (yay!). + if test "$tagname" = CXX ; then + case ${MACOSX_DEPLOYMENT_TARGET-10.0} in + 10.[0123]) + func_append compile_command " ${wl}-bind_at_load" + func_append finalize_command " ${wl}-bind_at_load" + ;; + esac + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; esac @@ -4361,7 +8725,7 @@ EOF *) case " $compile_deplibs " in *" -L$path/$objdir "*) - new_libs="$new_libs -L$path/$objdir" ;; + func_append new_libs " -L$path/$objdir" ;; esac ;; esac @@ -4371,17 +8735,17 @@ EOF -L*) case " $new_libs " in *" $deplib "*) ;; - *) new_libs="$new_libs $deplib" ;; + *) func_append new_libs " $deplib" ;; esac ;; - *) new_libs="$new_libs $deplib" ;; + *) func_append new_libs " $deplib" ;; esac done compile_deplibs="$new_libs" - compile_command="$compile_command $compile_deplibs" - finalize_command="$finalize_command $finalize_deplibs" + func_append compile_command " $compile_deplibs" + func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. @@ -4389,7 +8753,7 @@ EOF # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; + *) func_append finalize_rpath " $libdir" ;; esac done fi @@ -4408,30 +8772,32 @@ EOF *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" + func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; + *) func_append perm_rpath " $libdir" ;; esac fi case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; - *) dllsearchpath="$dllsearchpath:$libdir";; + ::) dllsearchpath=$libdir;; + *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; - *) dllsearchpath="$dllsearchpath:$testbindir";; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; esac ;; esac @@ -4457,18 +8823,18 @@ EOF *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" + func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; - *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + *) func_append finalize_perm_rpath " $libdir" ;; esac fi done @@ -4482,281 +8848,57 @@ EOF if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. - compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi - dlsyms= - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - if test -n "$NM" && test -n "$global_symbol_pipe"; then - dlsyms="${outputname}S.c" - else - $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 - fi - fi - - if test -n "$dlsyms"; then - case $dlsyms in - "") ;; - *.c) - # Discover the nlist of each of the dlfiles. - nlist="$output_objdir/${outputname}.nm" - - $show "$rm $nlist ${nlist}S ${nlist}T" - $run $rm "$nlist" "${nlist}S" "${nlist}T" - - # Parse the name list into a source file. - $show "creating $output_objdir/$dlsyms" - - test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ -/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ -/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ - -#ifdef __cplusplus -extern \"C\" { -#endif - -/* Prevent the only kind of declaration conflicts we can make. */ -#define lt_preloaded_symbols some_other_symbol - -/* External symbol declarations for the compiler. */\ -" - - if test "$dlself" = yes; then - $show "generating symbol list for \`$output'" - - test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" - - # Add our own program objects to the symbol list. - progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - for arg in $progfiles; do - $show "extracting global C symbols from \`$arg'" - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - if test -n "$exclude_expsyms"; then - $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - if test -n "$export_symbols_regex"; then - $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - export_symbols="$output_objdir/$outputname.exp" - $run $rm $export_symbols - $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - case $host in - *cygwin* | *mingw* ) - $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' - ;; - esac - else - $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' - $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' - $run eval 'mv "$nlist"T "$nlist"' - case $host in - *cygwin* | *mingw* ) - $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' - ;; - esac - fi - fi - - for arg in $dlprefiles; do - $show "extracting global C symbols from \`$arg'" - name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` - $run eval '$echo ": $name " >> "$nlist"' - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - if test -z "$run"; then - # Make sure we have at least an empty file. - test -f "$nlist" || : > "$nlist" - - if test -n "$exclude_expsyms"; then - $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T - $mv "$nlist"T "$nlist" - fi - - # Try sorting and uniquifying the output. - if grep -v "^: " < "$nlist" | - if sort -k 3 </dev/null >/dev/null 2>&1; then - sort -k 3 - else - sort +2 - fi | - uniq > "$nlist"S; then - : - else - grep -v "^: " < "$nlist" > "$nlist"S - fi - - if test -f "$nlist"S; then - eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' - else - $echo '/* NONE */' >> "$output_objdir/$dlsyms" - fi - - $echo >> "$output_objdir/$dlsyms" "\ - -#undef lt_preloaded_symbols - -#if defined (__STDC__) && __STDC__ -# define lt_ptr void * -#else -# define lt_ptr char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -" - - case $host in - *cygwin* | *mingw* ) - $echo >> "$output_objdir/$dlsyms" "\ -/* DATA imports from DLLs on WIN32 can't be const, because - runtime relocations are performed -- see ld's documentation - on pseudo-relocs */ -struct { -" - ;; - * ) - $echo >> "$output_objdir/$dlsyms" "\ -const struct { -" - ;; - esac - - - $echo >> "$output_objdir/$dlsyms" "\ - const char *name; - lt_ptr address; -} -lt_preloaded_symbols[] = -{\ -" - - eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" - - $echo >> "$output_objdir/$dlsyms" "\ - {0, (lt_ptr) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif\ -" - fi - - pic_flag_for_symtable= - case $host in - # compiling the symbol table file with pic_flag works around - # a FreeBSD bug that causes programs to crash when -lm is - # linked before any other PIC object. But we must not use - # pic_flag when linking with -static. The problem exists in - # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. - *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; - esac;; - *-*-hpux*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag";; - esac - esac + func_generate_dlsyms "$outputname" "@PROGRAM@" "no" - # Now compile the dynamic symbol file. - $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? - - # Clean up the generated files. - $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" - $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" - - # Transform the symbol file into the correct name. - case $host in - *cygwin* | *mingw* ) - if test -f "$output_objdir/${outputname}.def" ; then - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` - else - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - fi - ;; - * ) - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - ;; - esac - ;; - *) - $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 - exit $EXIT_FAILURE - ;; - esac - else - # We keep going just in case the user didn't refer to - # lt_preloaded_symbols. The linker will fail if global_symbol_pipe - # really was required. - - # Nullify the symbol file. - compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + # template prelinking step + if test -n "$prelink_cmds"; then + func_execute_cmds "$prelink_cmds" 'exit $?' fi - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + wrappers_required=yes + case $host in + *cegcc* | *mingw32ce*) + # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. + wrappers_required=no + ;; + *cygwin* | *mingw* ) + if test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + *) + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + esac + if test "$wrappers_required" = no; then # Replace the output file specification. - compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. - $show "$link_command" - $run eval "$link_command" - exit_status=$? + exit_status=0 + func_show_eval "$link_command" 'exit_status=$?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi # Delete the generated files. - if test -n "$dlsyms"; then - $show "$rm $output_objdir/${outputname}S.${objext}" - $run $rm "$output_objdir/${outputname}S.${objext}" + if test -f "$output_objdir/${outputname}S.${objext}"; then + func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' fi exit $exit_status fi - if test -n "$shlibpath_var"; then - # We should set the shlibpath_var - rpath= - for dir in $temp_rpath; do - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) - # Absolute path. - rpath="$rpath$dir:" - ;; - *) - # Relative path: add a thisdir entry. - rpath="$rpath\$thisdir/$dir:" - ;; - esac - done - temp_rpath="$rpath" - fi - if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi @@ -4771,7 +8913,7 @@ static const void *lt_preloaded_setup() { # We should set the runpath_var. rpath= for dir in $perm_rpath; do - rpath="$rpath$dir:" + func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi @@ -4779,7 +8921,7 @@ static const void *lt_preloaded_setup() { # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do - rpath="$rpath$dir:" + func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi @@ -4789,12 +8931,18 @@ static const void *lt_preloaded_setup() { # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. - link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. - $run $rm $output + $opt_dry_run || $RM $output # Link the executable and exit - $show "$link_command" - $run eval "$link_command" || exit $? + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + exit $EXIT_SUCCESS fi @@ -4803,13 +8951,13 @@ static const void *lt_preloaded_setup() { link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" - $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 - $echo "$modename: \`$output' will be relinked during installation" 1>&2 + func_warning "this platform does not like uninstalled shared libraries" + func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then - relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= @@ -4821,594 +8969,98 @@ static const void *lt_preloaded_setup() { fi # Replace the output file specification. - link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. - $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname + + func_show_eval "$link_command" 'exit $?' - $show "$link_command" - $run eval "$link_command" || exit $? + if test -n "$postlink_cmds"; then + func_to_tool_file "$output_objdir/$outputname" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi # Now create the wrapper script. - $show "creating $output" + func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else - var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` - relink_command="$var=\"$var_value\"; export $var; $relink_command" + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi - # Quote $echo for shipping. - if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then - case $progpath in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; - *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; - esac - qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` - else - qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` - fi - - # Only actually do things if our run command is non-null. - if test -z "$run"; then + # Only actually do things if not in dry run mode. + $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in - *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; + *.exe) func_stripname '' '.exe' "$output" + output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe - outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; + func_stripname '' '.exe' "$outputname" + outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) - output_name=`basename $output` - output_path=`dirname $output` - cwrappersource="$output_path/$objdir/lt-$output_name.c" - cwrapper="$output_path/$output_name.exe" - $rm $cwrappersource $cwrapper - trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 - - cat > $cwrappersource <<EOF - -/* $cwrappersource - temporary wrapper executable for $objdir/$outputname - Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP - - The $output program cannot be directly executed until all the libtool - libraries that it depends on are installed. - - This wrapper executable should never be moved out of the build directory. - If it is, it will not operate correctly. - - Currently, it simply execs the wrapper *script* "/bin/sh $output", - but could eventually absorb all of the scripts functionality and - exec $objdir/$outputname directly. -*/ -EOF - cat >> $cwrappersource<<"EOF" -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <malloc.h> -#include <stdarg.h> -#include <assert.h> -#include <string.h> -#include <ctype.h> -#include <sys/stat.h> - -#if defined(PATH_MAX) -# define LT_PATHMAX PATH_MAX -#elif defined(MAXPATHLEN) -# define LT_PATHMAX MAXPATHLEN -#else -# define LT_PATHMAX 1024 -#endif - -#ifndef DIR_SEPARATOR -# define DIR_SEPARATOR '/' -# define PATH_SEPARATOR ':' -#endif - -#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ - defined (__OS2__) -# define HAVE_DOS_BASED_FILE_SYSTEM -# ifndef DIR_SEPARATOR_2 -# define DIR_SEPARATOR_2 '\\' -# endif -# ifndef PATH_SEPARATOR_2 -# define PATH_SEPARATOR_2 ';' -# endif -#endif - -#ifndef DIR_SEPARATOR_2 -# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) -#else /* DIR_SEPARATOR_2 */ -# define IS_DIR_SEPARATOR(ch) \ - (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) -#endif /* DIR_SEPARATOR_2 */ - -#ifndef PATH_SEPARATOR_2 -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) -#else /* PATH_SEPARATOR_2 */ -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) -#endif /* PATH_SEPARATOR_2 */ - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -/* -DDEBUG is fairly common in CFLAGS. */ -#undef DEBUG -#if defined DEBUGWRAPPER -# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) -#else -# define DEBUG(format, ...) -#endif - -const char *program_name = NULL; - -void * xmalloc (size_t num); -char * xstrdup (const char *string); -const char * base_name (const char *name); -char * find_executable(const char *wrapper); -int check_executable(const char *path); -char * strendzap(char *str, const char *pat); -void lt_fatal (const char *message, ...); - -int -main (int argc, char *argv[]) -{ - char **newargz; - int i; - - program_name = (char *) xstrdup (base_name (argv[0])); - DEBUG("(main) argv[0] : %s\n",argv[0]); - DEBUG("(main) program_name : %s\n",program_name); - newargz = XMALLOC(char *, argc+2); -EOF - - cat >> $cwrappersource <<EOF - newargz[0] = (char *) xstrdup("$SHELL"); -EOF - - cat >> $cwrappersource <<"EOF" - newargz[1] = find_executable(argv[0]); - if (newargz[1] == NULL) - lt_fatal("Couldn't find %s", argv[0]); - DEBUG("(main) found exe at : %s\n",newargz[1]); - /* we know the script has the same name, without the .exe */ - /* so make sure newargz[1] doesn't end in .exe */ - strendzap(newargz[1],".exe"); - for (i = 1; i < argc; i++) - newargz[i+1] = xstrdup(argv[i]); - newargz[argc+1] = NULL; - - for (i=0; i<argc+1; i++) - { - DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); - ; - } - -EOF - - case $host_os in - mingw*) - cat >> $cwrappersource <<EOF - execv("$SHELL",(char const **)newargz); -EOF - ;; - *) - cat >> $cwrappersource <<EOF - execv("$SHELL",newargz); -EOF - ;; - esac - - cat >> $cwrappersource <<"EOF" - return 127; -} - -void * -xmalloc (size_t num) -{ - void * p = (void *) malloc (num); - if (!p) - lt_fatal ("Memory exhausted"); - - return p; -} - -char * -xstrdup (const char *string) -{ - return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL -; -} - -const char * -base_name (const char *name) -{ - const char *base; - -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - /* Skip over the disk name in MSDOS pathnames. */ - if (isalpha ((unsigned char)name[0]) && name[1] == ':') - name += 2; -#endif - - for (base = name; *name; name++) - if (IS_DIR_SEPARATOR (*name)) - base = name + 1; - return base; -} - -int -check_executable(const char * path) -{ - struct stat st; - - DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); - if ((!path) || (!*path)) - return 0; - - if ((stat (path, &st) >= 0) && - ( - /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ -#if defined (S_IXOTH) - ((st.st_mode & S_IXOTH) == S_IXOTH) || -#endif -#if defined (S_IXGRP) - ((st.st_mode & S_IXGRP) == S_IXGRP) || -#endif - ((st.st_mode & S_IXUSR) == S_IXUSR)) - ) - return 1; - else - return 0; -} - -/* Searches for the full path of the wrapper. Returns - newly allocated full path name if found, NULL otherwise */ -char * -find_executable (const char* wrapper) -{ - int has_slash = 0; - const char* p; - const char* p_next; - /* static buffer for getcwd */ - char tmp[LT_PATHMAX + 1]; - int tmp_len; - char* concat_name; - - DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); - - if ((wrapper == NULL) || (*wrapper == '\0')) - return NULL; - - /* Absolute path? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') - { - concat_name = xstrdup (wrapper); - if (check_executable(concat_name)) - return concat_name; - XFREE(concat_name); - } - else - { -#endif - if (IS_DIR_SEPARATOR (wrapper[0])) - { - concat_name = xstrdup (wrapper); - if (check_executable(concat_name)) - return concat_name; - XFREE(concat_name); - } -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - } -#endif - - for (p = wrapper; *p; p++) - if (*p == '/') - { - has_slash = 1; - break; - } - if (!has_slash) - { - /* no slashes; search PATH */ - const char* path = getenv ("PATH"); - if (path != NULL) - { - for (p = path; *p; p = p_next) - { - const char* q; - size_t p_len; - for (q = p; *q; q++) - if (IS_PATH_SEPARATOR(*q)) - break; - p_len = q - p; - p_next = (*q == '\0' ? q : q + 1); - if (p_len == 0) - { - /* empty path: current directory */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); - tmp_len = strlen(tmp); - concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - } - else - { - concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); - memcpy (concat_name, p, p_len); - concat_name[p_len] = '/'; - strcpy (concat_name + p_len + 1, wrapper); - } - if (check_executable(concat_name)) - return concat_name; - XFREE(concat_name); - } - } - /* not found in PATH; assume curdir */ - } - /* Relative path | not found in path: prepend cwd */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); - tmp_len = strlen(tmp); - concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - - if (check_executable(concat_name)) - return concat_name; - XFREE(concat_name); - return NULL; -} - -char * -strendzap(char *str, const char *pat) -{ - size_t len, patlen; - - assert(str != NULL); - assert(pat != NULL); - - len = strlen(str); - patlen = strlen(pat); - - if (patlen <= len) - { - str += len - patlen; - if (strcmp(str, pat) == 0) - *str = '\0'; - } - return str; -} - -static void -lt_error_core (int exit_status, const char * mode, - const char * message, va_list ap) -{ - fprintf (stderr, "%s: %s: ", program_name, mode); - vfprintf (stderr, message, ap); - fprintf (stderr, ".\n"); - - if (exit_status >= 0) - exit (exit_status); -} - -void -lt_fatal (const char *message, ...) -{ - va_list ap; - va_start (ap, message); - lt_error_core (EXIT_FAILURE, "FATAL", message, ap); - va_end (ap); -} -EOF - # we should really use a build-platform specific compiler - # here, but OTOH, the wrappers (shell script and this C one) - # are only useful if you want to execute the "real" binary. - # Since the "real" binary is built for $host, then this - # wrapper might as well be built for $host, too. - $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource - ;; - esac - $rm $output - trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 - - $echo > $output "\ -#! $SHELL - -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# The $output program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='${SED} -e 1s/^X//' -sed_quote_subst='$sed_quote_subst' - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variable: - notinst_deplibs='$notinst_deplibs' -else - # When we are sourced in execute mode, \$file and \$echo are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - echo=\"$qecho\" - file=\"\$0\" - # Make sure echo works. - if test \"X\$1\" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift - elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then - # Yippee, \$echo works! - : - else - # Restart under the correct shell, and then maybe \$echo will work. - exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} - fi - fi\ -" - $echo >> $output "\ - - # Find the directory that this script lives in. - thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` - done - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - $echo >> $output "\ - program=lt-'$outputname'$exeext - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || \\ - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" - - if test ! -d \"\$progdir\"; then - $mkdir \"\$progdir\" - else - $rm \"\$progdir/\$file\" - fi" - - $echo >> $output "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if relink_command_output=\`eval \$relink_command 2>&1\`; then : - else - $echo \"\$relink_command_output\" >&2 - $rm \"\$progdir/\$file\" - exit $EXIT_FAILURE - fi - fi - - $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $rm \"\$progdir/\$program\"; - $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $rm \"\$progdir/\$file\" - fi" - else - $echo >> $output "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - $echo >> $output "\ - - if test -f \"\$progdir/\$program\"; then" - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $echo >> $output "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` - - export $shlibpath_var -" - fi - - # fixup the dll searchpath if we need to. - if test -n "$dllsearchpath"; then - $echo >> $output "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi + func_dirname_and_basename "$output" "" "." + output_name=$func_basename_result + output_path=$func_dirname_result + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $RM $cwrappersource $cwrapper + trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + func_emit_cwrapperexe_src > $cwrappersource + + # The wrapper executable is built using the $host compiler, + # because it contains $host paths and files. If cross- + # compiling, it, like the target executable, must be + # executed on the $host or under an emulation environment. + $opt_dry_run || { + $LTCC $LTCFLAGS -o $cwrapper $cwrappersource + $STRIP $cwrapper + } - $echo >> $output "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2*) - $echo >> $output "\ - exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} -" + # Now, create the wrapper script for func_source use: + func_ltwrapper_scriptname $cwrapper + $RM $func_ltwrapper_scriptname_result + trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 + $opt_dry_run || { + # note: this script will not be executed, so do not chmod. + if test "x$build" = "x$host" ; then + $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result + else + func_emit_wrapper no > $func_ltwrapper_scriptname_result + fi + } ;; + * ) + $RM $output + trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 - *) - $echo >> $output "\ - exec \"\$progdir/\$program\" \${1+\"\$@\"} -" + func_emit_wrapper no > $output + chmod +x $output ;; esac - $echo >> $output "\ - \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" - exit $EXIT_FAILURE - fi - else - # The program doesn't exist. - \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 - \$echo \"This script is just a wrapper for \$program.\" 1>&2 - $echo \"See the $PACKAGE documentation for more information.\" 1>&2 - exit $EXIT_FAILURE - fi -fi\ -" - chmod +x $output - fi + } exit $EXIT_SUCCESS ;; esac @@ -5417,7 +9069,7 @@ fi\ for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then - oldobjs="$libobjs_save" + oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else @@ -5426,22 +9078,35 @@ fi\ build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" + if test "$preload" = yes && test -f "$symfileobj"; then + func_append oldobjs " $symfileobj" + fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" + func_append generated " $gentop" func_extract_archives $gentop $addlibs - oldobjs="$oldobjs $func_extract_archives_result" + func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - cmds=$old_archive_from_new_cmds + cmds=$old_archive_from_new_cmds else + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append oldobjs " $func_extract_archives_result" + fi + # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a @@ -5450,32 +9115,22 @@ fi\ # not supported by libtool). if (for obj in $oldobjs do - $echo "X$obj" | $Xsed -e 's%^.*/%%' + func_basename "$obj" + $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else - $echo "copying selected object files to avoid basename conflicts..." - - if test -z "$gentop"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - exit_status=$? - if test "$exit_status" -ne 0 && test ! -d "$gentop"; then - exit $exit_status - fi - fi - + echo "copying selected object files to avoid basename conflicts..." + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do - objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + func_basename "$obj" + objbase="$func_basename_result" case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) @@ -5483,58 +9138,72 @@ fi\ # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase - counter=`expr $counter + 1` + func_arith $counter + 1 + counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done - $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - $run ln "$obj" "$gentop/$newobj" || - $run cp "$obj" "$gentop/$newobj" - oldobjs="$oldobjs $gentop/$newobj" + func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + func_append oldobjs " $gentop/$newobj" ;; - *) oldobjs="$oldobjs $obj" ;; + *) func_append oldobjs " $obj" ;; esac done fi - eval cmds=\"$old_archive_cmds\" - if len=`expr "X$cmds" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + func_len " $cmds" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + elif test -n "$archiver_list_spec"; then + func_verbose "using command file archive linking..." + for obj in $oldobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > $output_objdir/$libname.libcmd + func_to_tool_file "$output_objdir/$libname.libcmd" + oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts - $echo "using piecewise archive linking..." + func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs - + oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done + eval test_cmds=\"$old_archive_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 for obj in $save_oldobjs do - oldobjs="$objlist $obj" - objlist="$objlist $obj" - eval test_cmds=\"$old_archive_cmds\" - if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && - test "$len" -le "$max_cmd_len"; then + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + func_append objlist " $obj" + if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then - RANLIB=$save_RANLIB + RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= + len=$len0 fi done RANLIB=$save_RANLIB @@ -5546,49 +9215,39 @@ fi\ fi fi fi - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - eval cmd=\"$cmd\" - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" + func_execute_cmds "$cmds" 'exit $?' done - if test -n "$generated"; then - $show "${rm}r$generated" - $run ${rm}r$generated - fi + test -n "$generated" && \ + func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" - $show "creating $output" + func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else - var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` - relink_command="$var=\"$var_value\"; export $var; $relink_command" + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi - # Only create the output if not a dry run. - if test -z "$run"; then + $opt_dry_run || { for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then @@ -5600,38 +9259,59 @@ fi\ for deplib in $dependency_libs; do case $deplib in *.la) - name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` + func_basename "$deplib" + name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - if test -z "$libdir"; then - $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - newdependency_libs="$newdependency_libs $libdir/$name" + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" + ;; + -L*) + func_stripname -L '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -L$func_replace_sysroot_result" ;; - *) newdependency_libs="$newdependency_libs $deplib" ;; + -R*) + func_stripname -R '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -R$func_replace_sysroot_result" + ;; + *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= + for lib in $dlfiles; do - name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - if test -z "$libdir"; then - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - newdlfiles="$newdlfiles $libdir/$name" + case $lib in + *.la) + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" + ;; + *) func_append newdlfiles " $lib" ;; + esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do - name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - if test -z "$libdir"; then - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - newdlprefiles="$newdlprefiles $libdir/$name" + case $lib in + *.la) + # Only pass preopened files to the pseudo-archive (for + # eventual linking with the app. that links it) if we + # didn't already link the preopened objects directly into + # the library: + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" + ;; + esac done dlprefiles="$newdlprefiles" else @@ -5641,7 +9321,7 @@ fi\ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac - newdlfiles="$newdlfiles $abs" + func_append newdlfiles " $abs" done dlfiles="$newdlfiles" newdlprefiles= @@ -5650,19 +9330,37 @@ fi\ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac - newdlprefiles="$newdlprefiles $abs" + func_append newdlprefiles " $abs" done dlprefiles="$newdlprefiles" fi - $rm $output + $RM $output # place dlname in correct position for cygwin + # In fact, it would be nice if we could use this code for all target + # systems that can't hard-code library paths into their executables + # and that have no shared library path variable independent of PATH, + # but it turns out we can't easily determine that from inspecting + # libtool variables, so we have to hard-code the OSs to which it + # applies here; at the moment, that means platforms that use the PE + # object format with DLL files. See the long comment at the top of + # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) + # If a -bindir argument was supplied, place the dll there. + if test "x$bindir" != x ; + then + func_relative_path "$install_libdir" "$bindir" + tdlname=$func_relative_path_result$dlname + else + # Otherwise fall back on heuristic. + tdlname=../bin/$dlname + fi + ;; esac - $echo > $output "\ + $ECHO > $output "\ # $outputname - a libtool library file -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. @@ -5676,9 +9374,15 @@ library_names='$library_names' # The name of the static archive. old_library='$old_library' +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='$new_inherited_linker_flags' + # Libraries that this one depends upon. dependency_libs='$dependency_libs' +# Names of additional weak libraries provided by this library +weak_library_names='$weak_libs' + # Version information for $libname. current=$current age=$age @@ -5697,746 +9401,29 @@ dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then - $echo >> $output "\ + $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done - fi + } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. - $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" - $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? + func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS - ;; - - # libtool install mode - install) - modename="$modename: install" - - # There may be an optional sh(1) argument at the beginning of - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || - # Allow the use of GNU shtool's install command. - $echo "X$nonopt" | grep shtool > /dev/null; then - # Aesthetically quote it. - arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - install_prog="$arg " - arg="$1" - shift - else - install_prog= - arg=$nonopt - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog$arg" - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir=no - stripme= - for arg - do - if test -n "$dest"; then - files="$files $dest" - dest=$arg - continue - fi - - case $arg in - -d) isdir=yes ;; - -f) - case " $install_prog " in - *[\\\ /]cp\ *) ;; - *) prev=$arg ;; - esac - ;; - -g | -m | -o) prev=$arg ;; - -s) - stripme=" -s" - continue - ;; - -*) - ;; - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - prev= - else - dest=$arg - continue - fi - ;; - esac - - # Aesthetically quote the argument. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog $arg" - done - - if test -z "$install_prog"; then - $echo "$modename: you must specify an install program" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - if test -n "$prev"; then - $echo "$modename: the \`$prev' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - if test -z "$files"; then - if test -z "$dest"; then - $echo "$modename: no file or destination specified" 1>&2 - else - $echo "$modename: you must specify a destination" 1>&2 - fi - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Strip any trailing slash from the destination. - dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" - destname= - else - destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` - test "X$destdir" = "X$dest" && destdir=. - destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` - - # Not a directory, so check to see that there is only one file specified. - set dummy $files - if test "$#" -gt 2; then - $echo "$modename: \`$dest' is not a directory" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - fi - case $destdir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - for file in $files; do - case $file in - *.lo) ;; - *) - $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - esac - done - ;; - esac - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - staticlibs= - future_libdirs= - current_libdirs= - for file in $files; do - - # Do each installation. - case $file in - *.$libext) - # Do the static libraries later. - staticlibs="$staticlibs $file" - ;; - - *.la) - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - library_names= - old_library= - relink_command= - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) current_libdirs="$current_libdirs $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) future_libdirs="$future_libdirs $libdir" ;; - esac - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ - test "X$dir" = "X$file/" && dir= - dir="$dir$objdir" - - if test -n "$relink_command"; then - # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` - - # Don't allow the user to place us outside of our expected - # location b/c this prevents finding dependent libraries that - # are installed to the same prefix. - # At present, this check doesn't affect windows .dll's that - # are installed into $libdir/../bin (currently, that works fine) - # but it's something to keep an eye on. - if test "$inst_prefix_dir" = "$destdir"; then - $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 - exit $EXIT_FAILURE - fi - - if test -n "$inst_prefix_dir"; then - # Stick the inst_prefix_dir data into the link command. - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` - else - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` - fi - - $echo "$modename: warning: relinking \`$file'" 1>&2 - $show "$relink_command" - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - exit $EXIT_FAILURE - fi - fi - - # See the names of the shared library. - set dummy $library_names - if test -n "$2"; then - realname="$2" - shift - shift - - srcname="$realname" - test -n "$relink_command" && srcname="$realname"T - - # Install the shared library and build the symlinks. - $show "$install_prog $dir/$srcname $destdir/$realname" - $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? - if test -n "$stripme" && test -n "$striplib"; then - $show "$striplib $destdir/$realname" - $run eval "$striplib $destdir/$realname" || exit $? - fi - - if test "$#" -gt 0; then - # Delete the old symlinks, and create new ones. - # Try `ln -sf' first, because the `ln' binary might depend on - # the symlink we replace! Solaris /bin/ln does not understand -f, - # so we also need to try rm && ln -s. - for linkname - do - if test "$linkname" != "$realname"; then - $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" - $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" - fi - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - cmds=$postinstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - fi - - # Install the pseudo-library for information purposes. - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - instname="$dir/$name"i - $show "$install_prog $instname $destdir/$name" - $run eval "$install_prog $instname $destdir/$name" || exit $? - - # Maybe install the static library, too. - test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" - ;; - - *.lo) - # Install (i.e. copy) a libtool object. - - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case $destfile in - *.lo) - staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` - ;; - *.$objext) - staticdest="$destfile" - destfile= - ;; - *) - $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - # Install the libtool object if requested. - if test -n "$destfile"; then - $show "$install_prog $file $destfile" - $run eval "$install_prog $file $destfile" || exit $? - fi - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` - - $show "$install_prog $staticobj $staticdest" - $run eval "$install_prog \$staticobj \$staticdest" || exit $? - fi - exit $EXIT_SUCCESS - ;; - - *) - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # If the file is missing, and there is a .exe on the end, strip it - # because it is most likely a libtool script we actually want to - # install - stripped_ext="" - case $file in - *.exe) - if test ! -f "$file"; then - file=`$echo $file|${SED} 's,.exe$,,'` - stripped_ext=".exe" - fi - ;; - esac - - # Do a test to see if this is really a libtool program. - case $host in - *cygwin*|*mingw*) - wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` - ;; - *) - wrapper=$file - ;; - esac - if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then - notinst_deplibs= - relink_command= - - # Note that it is not necessary on cygwin/mingw to append a dot to - # foo even if both foo and FILE.exe exist: automatic-append-.exe - # behavior happens only for exec(3), not for open(2)! Also, sourcing - # `FILE.' does not work on cygwin managed mounts. - # - # If there is no directory component, then add one. - case $wrapper in - */* | *\\*) . ${wrapper} ;; - *) . ./${wrapper} ;; - esac - - # Check the variables that should have been set. - if test -z "$notinst_deplibs"; then - $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 - exit $EXIT_FAILURE - fi - - finalize=yes - for lib in $notinst_deplibs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - # If there is no directory component, then add one. - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - fi - libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test - if test -n "$libdir" && test ! -f "$libfile"; then - $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 - finalize=no - fi - done - - relink_command= - # Note that it is not necessary on cygwin/mingw to append a dot to - # foo even if both foo and FILE.exe exist: automatic-append-.exe - # behavior happens only for exec(3), not for open(2)! Also, sourcing - # `FILE.' does not work on cygwin managed mounts. - # - # If there is no directory component, then add one. - case $wrapper in - */* | *\\*) . ${wrapper} ;; - *) . ./${wrapper} ;; - esac - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - if test "$finalize" = yes && test -z "$run"; then - tmpdir=`func_mktempdir` - file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` - - $show "$relink_command" - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - ${rm}r "$tmpdir" - continue - fi - file="$outputname" - else - $echo "$modename: warning: cannot relink \`$file'" 1>&2 - fi - else - # Install the binary that we compiled earlier. - file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - # remove .exe since cygwin /usr/bin/install will append another - # one anyway - case $install_prog,$host in - */usr/bin/install*,*cygwin*) - case $file:$destfile in - *.exe:*.exe) - # this is ok - ;; - *.exe:*) - destfile=$destfile.exe - ;; - *:*.exe) - destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` - ;; - esac - ;; - esac - $show "$install_prog$stripme $file $destfile" - $run eval "$install_prog\$stripme \$file \$destfile" || exit $? - test -n "$outputname" && ${rm}r "$tmpdir" - ;; - esac - done - - for file in $staticlibs; do - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - - $show "$install_prog $file $oldlib" - $run eval "$install_prog \$file \$oldlib" || exit $? - - if test -n "$stripme" && test -n "$old_striplib"; then - $show "$old_striplib $oldlib" - $run eval "$old_striplib $oldlib" || exit $? - fi - - # Do each command in the postinstall commands. - cmds=$old_postinstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$future_libdirs"; then - $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 - fi - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - test -n "$run" && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' - else - exit $EXIT_SUCCESS - fi - ;; - - # libtool finish mode - finish) - modename="$modename: finish" - libdirs="$nonopt" - admincmds= - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for dir - do - libdirs="$libdirs $dir" - done - - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - cmds=$finish_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || admincmds="$admincmds - $cmd" - done - IFS="$save_ifs" - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $run eval "$cmds" || admincmds="$admincmds - $cmds" - fi - done - fi - - # Exit here if they wanted silent mode. - test "$show" = : && exit $EXIT_SUCCESS - - $echo "X----------------------------------------------------------------------" | $Xsed - $echo "Libraries have been installed in:" - for libdir in $libdirs; do - $echo " $libdir" - done - $echo - $echo "If you ever happen to want to link against installed libraries" - $echo "in a given directory, LIBDIR, you must either use libtool, and" - $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - $echo "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - $echo " during execution" - fi - if test -n "$runpath_var"; then - $echo " - add LIBDIR to the \`$runpath_var' environment variable" - $echo " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - $echo " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - $echo " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - $echo - $echo "See any operating system documentation about shared libraries for" - $echo "more information, such as the ld(1) and ld.so(8) manual pages." - $echo "X----------------------------------------------------------------------" | $Xsed - exit $EXIT_SUCCESS - ;; - - # libtool execute mode - execute) - modename="$modename: execute" - - # The first argument is the command name. - cmd="$nonopt" - if test -z "$cmd"; then - $echo "$modename: you must specify a COMMAND" 1>&2 - $echo "$help" - exit $EXIT_FAILURE - fi - - # Handle -dlopen flags immediately. - for file in $execute_dlfiles; do - if test ! -f "$file"; then - $echo "$modename: \`$file' is not a file" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - dir= - case $file in - *.la) - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Read the libtool library. - dlname= - library_names= - - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" - continue - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - - if test -f "$dir/$objdir/$dlname"; then - dir="$dir/$objdir" - else - $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit $EXIT_FAILURE - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - ;; - - *) - $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 - continue - ;; - esac - - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" - - # Now add the directory to shlibpath_var. - if eval "test -z \"\$$shlibpath_var\""; then - eval "$shlibpath_var=\"\$dir\"" - else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" - fi - done - - # This variable tells wrapper scripts just to set shlibpath_var - # rather than running their programs. - libtool_execute_magic="$magic" - - # Check if any of the arguments is a wrapper script. - args= - for file - do - case $file in - -*) ;; - *) - # Do a test to see if this is really a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` - args="$args \"$file\"" - done +} - if test -z "$run"; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi +{ test "$opt_mode" = link || test "$opt_mode" = relink; } && + func_mode_link ${1+"$@"} - # Restore saved environment variables - if test "${save_LC_ALL+set}" = set; then - LC_ALL="$save_LC_ALL"; export LC_ALL - fi - if test "${save_LANG+set}" = set; then - LANG="$save_LANG"; export LANG - fi - # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" - else - # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" - $echo "export $shlibpath_var" - fi - $echo "$cmd$args" - exit $EXIT_SUCCESS - fi - ;; - - # libtool clean and uninstall mode - clean | uninstall) - modename="$modename: $mode" - rm="$nonopt" +# func_mode_uninstall arg... +func_mode_uninstall () +{ + $opt_debug + RM="$nonopt" files= rmforce= exit_status=0 @@ -6448,44 +9435,41 @@ relink_command=\"$relink_command\"" for arg do case $arg in - -f) rm="$rm $arg"; rmforce=yes ;; - -*) rm="$rm $arg" ;; - *) files="$files $arg" ;; + -f) func_append RM " $arg"; rmforce=yes ;; + -*) func_append RM " $arg" ;; + *) func_append files " $arg" ;; esac done - if test -z "$rm"; then - $echo "$modename: you must specify an RM program" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi + test -z "$RM" && \ + func_fatal_help "you must specify an RM program" rmdirs= - origobjdir="$objdir" for file in $files; do - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - if test "X$dir" = "X$file"; then - dir=. - objdir="$origobjdir" + func_dirname "$file" "" "." + dir="$func_dirname_result" + if test "X$dir" = X.; then + odir="$objdir" else - objdir="$dir/$origobjdir" + odir="$dir/$objdir" fi - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - test "$mode" = uninstall && objdir="$dir" + func_basename "$file" + name="$func_basename_result" + test "$opt_mode" = uninstall && odir="$dir" - # Remember objdir for removal later, being careful to avoid duplicates - if test "$mode" = clean; then + # Remember odir for removal later, being careful to avoid duplicates + if test "$opt_mode" = clean; then case " $rmdirs " in - *" $objdir "*) ;; - *) rmdirs="$rmdirs $objdir" ;; + *" $odir "*) ;; + *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. - if (test -L "$file") >/dev/null 2>&1 \ - || (test -h "$file") >/dev/null 2>&1 \ - || test -f "$file"; then + if { test -L "$file"; } >/dev/null 2>&1 || + { test -h "$file"; } >/dev/null 2>&1 || + test -f "$file"; then : elif test -d "$file"; then exit_status=1 @@ -6499,55 +9483,32 @@ relink_command=\"$relink_command\"" case $name in *.la) # Possibly a libtool archive, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - . $dir/$name + if func_lalib_p "$file"; then + func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do - rmfiles="$rmfiles $objdir/$n" + func_append rmfiles " $odir/$n" done - test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + test -n "$old_library" && func_append rmfiles " $odir/$old_library" - case "$mode" in + case "$opt_mode" in clean) - case " $library_names " in - # " " in the beginning catches empty $dlname + case " $library_names " in *" $dlname "*) ;; - *) rmfiles="$rmfiles $objdir/$dlname" ;; + *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac - test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. - cmds=$postuninstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then - exit_status=1 - fi - done - IFS="$save_ifs" + func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. - cmds=$old_postuninstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then - exit_status=1 - fi - done - IFS="$save_ifs" + func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; @@ -6557,286 +9518,95 @@ relink_command=\"$relink_command\"" *.lo) # Possibly a libtool object, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if func_lalib_p "$file"; then # Read the .lo file - . $dir/$name + func_source $dir/$name # Add PIC object to the list of files to remove. - if test -n "$pic_object" \ - && test "$pic_object" != none; then - rmfiles="$rmfiles $dir/$pic_object" + if test -n "$pic_object" && + test "$pic_object" != none; then + func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" \ - && test "$non_pic_object" != none; then - rmfiles="$rmfiles $dir/$non_pic_object" + if test -n "$non_pic_object" && + test "$non_pic_object" != none; then + func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) - if test "$mode" = clean ; then + if test "$opt_mode" = clean ; then noexename=$name case $file in *.exe) - file=`$echo $file|${SED} 's,.exe$,,'` - noexename=`$echo $name|${SED} 's,.exe$,,'` + func_stripname '' '.exe' "$file" + file=$func_stripname_result + func_stripname '' '.exe' "$name" + noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe - rmfiles="$rmfiles $file" + func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - relink_command= - . $dir/$noexename + if func_ltwrapper_p "$file"; then + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + relink_command= + func_source $func_ltwrapper_scriptname_result + func_append rmfiles " $func_ltwrapper_scriptname_result" + else + relink_command= + func_source $dir/$noexename + fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + func_append rmfiles " $odir/$name $odir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" + func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name" ; then - rmfiles="$rmfiles $objdir/lt-${noexename}.c" + func_append rmfiles " $odir/lt-${noexename}.c" fi fi fi ;; esac - $show "$rm $rmfiles" - $run $rm $rmfiles || exit_status=1 + func_show_eval "$RM $rmfiles" 'exit_status=1' done - objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then - $show "rmdir $dir" - $run rmdir $dir >/dev/null 2>&1 + func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status - ;; +} - "") - $echo "$modename: you must specify a MODE" 1>&2 - $echo "$generic_help" 1>&2 - exit $EXIT_FAILURE - ;; - esac +{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && + func_mode_uninstall ${1+"$@"} - if test -z "$exec_cmd"; then - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$generic_help" 1>&2 - exit $EXIT_FAILURE - fi -fi # test -z "$show_help" +test -z "$opt_mode" && { + help="$generic_help" + func_fatal_help "you must specify a MODE" +} + +test -z "$exec_cmd" && \ + func_fatal_help "invalid operation mode \`$opt_mode'" if test -n "$exec_cmd"; then - eval exec $exec_cmd + eval exec "$exec_cmd" exit $EXIT_FAILURE fi -# We need to display help for each of the modes. -case $mode in -"") $echo \ -"Usage: $modename [OPTION]... [MODE-ARG]... - -Provide generalized library-building support services. - - --config show all configuration variables - --debug enable verbose shell tracing --n, --dry-run display commands without modifying any files - --features display basic configuration information and exit - --finish same as \`--mode=finish' - --help display this help message and exit - --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] - --quiet same as \`--silent' - --silent don't print informational messages - --tag=TAG use configuration variables from tag TAG - --version print version information - -MODE must be one of the following: - - clean remove files from the build directory - compile compile a source file into a libtool object - execute automatically set library path, then run a program - finish complete the installation of libtool libraries - install install libraries or executables - link create a library or an executable - uninstall remove libraries from an installed directory - -MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for -a more detailed description of MODE. - -Report bugs to <bug-libtool@gnu.org>." - exit $EXIT_SUCCESS - ;; - -clean) - $echo \ -"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... - -Remove files from the build directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, object or program, all the files associated -with it are deleted. Otherwise, only FILE itself is deleted using RM." - ;; +exit $exit_status -compile) - $echo \ -"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE - -Compile a source file into a libtool library object. - -This mode accepts the following additional options: - - -o OUTPUT-FILE set the output file name to OUTPUT-FILE - -prefer-pic try to building PIC objects only - -prefer-non-pic try to building non-PIC objects only - -static always build a \`.o' file suitable for static linking - -COMPILE-COMMAND is a command to be used in creating a \`standard' object file -from the given SOURCEFILE. - -The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." - ;; - -execute) - $echo \ -"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... - -Automatically set library path, then run a program. - -This mode accepts the following additional options: - - -dlopen FILE add the directory containing FILE to the library path - -This mode sets the library path environment variable according to \`-dlopen' -flags. - -If any of the ARGS are libtool executable wrappers, then they are translated -into their corresponding uninstalled binary, and any of their required library -directories are added to the library path. - -Then, COMMAND is executed, with ARGS as arguments." - ;; - -finish) - $echo \ -"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... - -Complete the installation of libtool libraries. - -Each LIBDIR is a directory that contains libtool libraries. - -The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." - ;; - -install) - $echo \ -"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... - -Install executables or libraries. - -INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - -link) - $echo \ -"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... - -Link object files or libraries together to form another library, or to -create an executable program. - -LINK-COMMAND is a command using the C compiler that you would use to create -a program from several object files. - -The following components of LINK-COMMAND are treated specially: - - -all-static do not do any dynamic linking at all - -avoid-version do not add a version suffix if possible - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime - -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols - -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) - -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE - -export-symbols-regex REGEX - try to export only the symbols matching REGEX - -LLIBDIR search LIBDIR for required installed libraries - -lNAME OUTPUT-FILE requires the installed library libNAME - -module build a library that can dlopened - -no-fast-install disable the fast-install mode - -no-install link a not-installable executable - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects - -precious-files-regex REGEX - don't remove output files matching REGEX - -release RELEASE specify package release information - -rpath LIBDIR the created library will eventually be installed in LIBDIR - -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -static do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -All other options (arguments beginning with \`-') are ignored. - -Every other argument is treated as a filename. Files ending in \`.la' are -treated as uninstalled libtool libraries, other files are standard or library -object files. - -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, -only library objects (\`.lo' files) may be specified, and \`-rpath' is -required, except when creating a convenience library. - -If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created -using \`ar' and \`ranlib', or on Windows using \`lib'. - -If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file -is created, otherwise an executable program is created." - ;; - -uninstall) - $echo \ -"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... - -Remove libraries from an installation directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." - ;; - -*) - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; -esac - -$echo -$echo "Try \`$modename --help' for more information about other modes." - -exit $? # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting @@ -6850,14 +9620,17 @@ exit $? # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared -disable_libs=shared +build_libtool_libs=no +build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static -disable_libs=static +build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: +# vi:sw=2 + diff --git a/sntp/main.c b/sntp/main.c index 0cc4f03..9ddb5bf 100644 --- a/sntp/main.c +++ b/sntp/main.c @@ -1,1735 +1,471 @@ -/* Copyright (C) 1996, 1997, 2000 N.M. Maclaren - Copyright (C) 1996, 1997, 2000 The University of Cambridge - -This is a complete SNTP implementation, which was easier to write than to port -xntp to a new version of Unix with any hope of maintaining it thereafter. It -supports the full SNTP (RFC 2030) client- and server-side challenge-response -and broadcast protocols. It should achieve nearly optimal accuracy with very -few transactions, provided only that a client has access to a trusted server -and that communications are not INVARIABLY slow. As this is the environment in -which 90-99% of all NTP systems are run .... - -The specification of this program is: - - sntp [ --help | -h | -? ] [ -v | -V | -W ] - [ -q [ -f savefile ] | - [ { -r | -a } [ -P prompt ] [ -l lockfile ] ] - [ -c count ] [ -e minerr ][ -E maxerr ] - [ -d delay | -x [ separation ] [ -f savefile ] ] - [ -4 | -6 ] [ address(es) ] ] - - --help, -h and -? all print the syntax of the command. - - -v indicates that diagnostic messages should be written to standard error, -and -V requests more output for investigating apparently inconsistent -timestamps. -W requests very verbose debugging output, and will interfere with -the timing when writing to the terminal (because of line buffered output from -C); it is useful only when debugging the source. Note that the times produced -by -V and -W are the corrections needed, and not the error in the local clock. - - -q indicates that it will query a savefile that is being maintained by -it being run in daemon mode. - - The default is that it should behave as a client, and the following options -are then relevant: - - -r indicates that the system clock should be reset by 'settimeofday'. -Naturally, this will work only if the user has enough privilege. - - -a indicates that the system clock should be reset by 'adjtime'. -Naturally, this will work only if the user has enough privilege. - - -x indicates that the program should run as a daemon (i.e. forever), and -allow for clock drift. - - -4 or -6 force dns resolving to ipv4 or ipv6 addresses. - - The default is to write the current date and time to the standard output in -a format like '1996 Oct 15 20:17:25.123 + 4.567 +/- 0.089 secs', indicating the -estimated true (local) time and the error in the local clock. In daemon mode, -it will add drift information in a format like ' + 1.3 +/- 0.1 ppm', and -display this at roughly 'separation' intervals. - - 'minerr' is the maximum ignorable variation between the clocks. Acceptable -values are from 0.001 to 1, and the default is 0.1 if 'address' is specified -and 0.5 otherwise. - - 'maxerr' is the maximum value of various delays that are deemed acceptable. -Acceptable values are from 1 to 60, and the default is 5. It should sometimes -be increased if there are problems with the network, NTP server or system -clock, but take care. - - 'prompt' is the maximum clock change that will be made automatically. -Acceptable values are from 1 to 3600, and the default is 30. If the program is -being run interactively, larger values will cause a prompt. The value may also -be 'no', and the change will be made without prompting. - - 'count' is the maximum number of NTP packets to require. Acceptable values -are from 1 to 25 if 'address' is specified and '-x' is not, and from 5 to 25 -otherwise; the default is 5. If the maximum isn't enough, you need a better -consistency algorithm than this program uses. Don't increase it. - - 'delay' is a rough limit on the total running time in seconds. Acceptable -values are from 1 to 3600, and the default is 15 if 'address' is specified and -300 otherwise. - - 'separation' is the time to wait between calls to the server in minutes if -'address' is specified, and the minimum time between broadcast packets if not. -Acceptable values are from 1 to 1440 (a day), and the default is 300. - - 'lockfile' may be used in an update mode to ensure that there is only -one copy of sntp running at once. The default is installation-dependent, -but will usually be /etc/sntp.pid. - - 'savefile' may be used in daemon mode to store a record of previous -packets, which may speed up recalculating the drift after sntp has to be -restarted (e.g. because of network or server outages). The default is -installation-dependent, but will usually be /etc/sntp.state. Note that -there is no locking of this file, and using it twice may cause chaos. - - 'address' is the DNS name or IP number of a host to poll; if no name is -given, the program waits for broadcasts. Note that a single component numeric -address is not allowed. - -For sanity, it is also required that 'minerr' < 'maxerr' < 'delay' (if -listening for broadcasts, 'delay/count' and, in daemon mode, 'separation') and, -for sordid Unixish reasons, that 2*'count' < 'delay'. The last could be fixed, -but isn't worth it. Note that none of the above values are closely linked to -the limits described in the NTP protocol (RFC 1305). Do not increase the -compiled-in bounds excessively, or the code will fail. - -The algorithm used to decide whether to accept a correction is whether it would -seem to improve matters. Unlike the 'xntp' suite, little attempt is made to -handle really knotted scenarios, and diagnostics are written to standard error. -In non-daemon client mode, it is intended to be run as a command or in a 'cron' -job. Unlike 'ntpdate', its default mode is simply to display the clock error. - -It assumes that floating-point arithmetic is tolerably efficient, which is true -for even the cheapest personal computer nowadays. If, however, you want to -port this to a toaster, you may have problems! - -In its terminating modes, its return code is EXIT_SUCCESS if the operation was -completed successfully and EXIT_FAILURE otherwise. - -In daemon mode, it runs for ever and stops with a return code EXIT_FAILURE -only after a severe error. In daemon mode, it will fail if the server is -inaccessible for a long time or seriously sick, and will need manual -restarting. - - -WARNING: this program has reached its 'hack count' and needs restructuring, -badly. Perhaps the worst code is in run_daemon(). You are advised not to -fiddle unless you really have to. */ - - - -#include "header.h" - -#include <limits.h> -#include <float.h> -#include <math.h> - -#define MAIN -#include "kludges.h" -#undef MAIN - - - -/* NTP definitions. Note that these assume 8-bit bytes - sigh. There is -little point in parameterising everything, as it is neither feasible nor -useful. It would be very useful if more fields could be defined as -unspecified. The NTP packet-handling routines contain a lot of extra -assumptions. */ - -#define JAN_1970 2208988800.0 /* 1970 - 1900 in seconds */ -#define NTP_SCALE 4294967296.0 /* 2^32, of course! */ - -#define NTP_PACKET_MIN 48 /* Without authentication */ -#define NTP_PACKET_MAX 68 /* With authentication (ignored) */ -#define NTP_DISP_FIELD 8 /* Offset of dispersion field */ -#define NTP_REFERENCE 16 /* Offset of reference timestamp */ -#define NTP_ORIGINATE 24 /* Offset of originate timestamp */ -#define NTP_RECEIVE 32 /* Offset of receive timestamp */ -#define NTP_TRANSMIT 40 /* Offset of transmit timestamp */ - -#define NTP_LI_FUDGE 0 /* The current 'status' */ -#define NTP_VERSION 3 /* The current version */ -#define NTP_VERSION_MAX 4 /* The maximum valid version */ -#define NTP_STRATUM 15 /* The current stratum as a server */ -#define NTP_STRATUM_MAX 15 /* The maximum valid stratum */ -#define NTP_POLLING 8 /* The current 'polling interval' */ -#define NTP_PRECISION 0 /* The current 'precision' - 1 sec. */ - -#define NTP_ACTIVE 1 /* NTP symmetric active request */ -#define NTP_PASSIVE 2 /* NTP symmetric passive response */ -#define NTP_CLIENT 3 /* NTP client request */ -#define NTP_SERVER 4 /* NTP server response */ -#define NTP_BROADCAST 5 /* NTP server broadcast */ - -#define NTP_INSANITY 3600.0 /* Errors beyond this are hopeless */ -#define RESET_MIN 15 /* Minimum period between resets */ -#define ABSCISSA 3.0 /* Scale factor for standard errors */ - - - -/* Local definitions and global variables (mostly options). These are all of -the quantities that control the main actions of the program. The first three -are the only ones that are exported to other modules. */ - -const char *argv0 = NULL; /* For diagnostics only - not NULL */ -int verbose = 0, /* Default = 0, -v = 1, -V = 2, -W = 3 */ - operation = 0; /* Defined in header.h - see action */ -const char *lockname = NULL; /* The name of the lock file */ -int unprivport = 0; /* Use an unpriv port for query? */ - -#define COUNT_MAX 25 /* Do NOT increase this! */ -#define WEEBLE_FACTOR 1.2 /* See run_server() and run_daemon() */ -#define ETHERNET_MAX 5 /* See run_daemon() and run_client() */ - -#define action_display 1 /* Just display the result */ -#define action_reset 2 /* Reset using 'settimeofday' */ -#define action_adjust 3 /* Reset using 'adjtime' */ -#define action_broadcast 4 /* Behave as a server, broadcasting */ -#define action_server 5 /* Behave as a server for clients */ -#define action_query 6 /* Query a daemon savefile */ - -#define save_read_only 1 /* Read the saved state only */ -#define save_read_check 2 /* Read and check it */ -#define save_write 3 /* Write the saved state */ -#define save_clear 4 /* Clear the saved state */ - -static const char version[] = VERSION; /* For reverse engineering :-) */ -static int action = 0, /* Defined above - see operation */ - count = 0, /* -c value in seconds */ - delay = 0, /* -d or -x value in seconds */ - attempts = 0, /* Packets transmitted up to 2*count */ - waiting = 0, /* -d/-c except for in daemon mode */ - locked = 0; /* set_lock(1) has been called */ -static double outgoing[2*COUNT_MAX], /* Transmission timestamps */ - minerr = 0.0, /* -e value in seconds */ - maxerr = 0.0, /* -E value in seconds */ - prompt = 0.0, /* -p value in seconds */ - dispersion = 0.0; /* The source dispersion in seconds */ -static FILE *savefile = NULL; /* Holds the data to restart from */ - - - -/* The unpacked NTP data structure, with all the fields even remotely relevant -to SNTP. */ - -typedef struct NTP_DATA { - unsigned char status, version, mode, stratum, polling; - signed char precision; - double dispersion, reference, originate, receive, transmit, current; -} ntp_data; - - - -/* The following structure is used to keep a record of packets in daemon mode; -it contains only the information that is actually used for the drift and error -calculations. */ - -typedef struct { - double dispersion, weight, when, offset, error; -} data_record; - -void syntax(int); -void display_data(ntp_data *); -void display_packet(unsigned char *, int); -void pack_ntp(unsigned char *, int, ntp_data *); -void unpack_ntp(ntp_data *, unsigned char *, int); -void make_packet(ntp_data *, int); -int read_packet(int, ntp_data *, double *, double *); -void format_time(char *, int, double, double, double, double, int); -double reset_clock(double, double, int); -void run_server(void); -double estimate_stats(int *, int *, data_record *, double, double *, double *, - double *, double *, double *, double *, int *, int); -double correct_drift(double *, double *, double); -void handle_saving(int, int *, int *, int *, data_record *, double *, - double *, double *); -void query_savefile(void); -void run_daemon(char **, int, int); -void run_client(char **, int); - -void fatal (int syserr, const char *message, const char *insert) { - -/* Issue a diagnostic and stop. Be a little paranoid about recursion. */ - - int k = errno; - static int called = 0; - - if (message != NULL) { - fprintf(stderr,"%s: ",argv0); - fprintf(stderr,message,insert); - fprintf(stderr,"\n"); - } - errno = k; - if (syserr) perror(argv0); - if (! called) { - called = 1; - if (savefile != NULL && fclose(savefile)) - fatal(1,"unable to close the daemon save file",NULL); - if (locked) set_lock(0); - } - exit(EXIT_FAILURE); -} - - - -void syntax (int halt) { - -/* The standard, unfriendly Unix error message. Some errors are diagnosed more -helpfully. This is called before any files or sockets are opened. */ - - fprintf(stderr,"Syntax: %s [ --help | -h | -? ] [ -v | -V | -W ] \n",argv0); - fprintf(stderr," [ -q [ -f savefile ] |\n"); - fprintf(stderr," [ { -r | -a } [ -P prompt ] [ -l lockfile ] ]\n"); - fprintf(stderr," [ -c count ] [ -e minerr ] [ -E maxerr ]\n"); - fprintf(stderr," [ -d delay | -x [ separation ] "); - fprintf(stderr,"[ -f savefile ] ]\n"); - fprintf(stderr," [ -4 | -6 ] [-u] [ address(es) ] ]\n"); - if (halt) exit(EXIT_FAILURE); -} - - - -void display_data (ntp_data *data) { - -/* This formats the essential NTP data, as a debugging aid. */ - - fprintf(stderr,"sta=%d ver=%d mod=%d str=%d pol=%d dis=%.6f ref=%.6f\n", - data->status,data->version,data->mode,data->stratum,data->polling, - data->dispersion,data->reference); - fprintf(stderr,"ori=%.6f rec=%.6f\n",data->originate,data->receive); - fprintf(stderr,"tra=%.6f cur=%.6f\n",data->transmit,data->current); -} - - - -void display_packet (unsigned char *packet, int length) { - -/* This formats a possible packet very roughly, as a debugging aid. */ - - int i; - - if (length < NTP_PACKET_MIN || length > NTP_PACKET_MAX) return; - for (i = 0; i < length; ++i) { - if (i != 0 && i%32 == 0) - fprintf(stderr,"\n"); - else if (i != 0 && i%4 == 0) - fprintf(stderr," "); - fprintf(stderr,"%.2x",packet[i]); - } - fprintf(stderr,"\n"); +#include <config.h> + +#include "main.h" +#include "kod_management.h" +#include "networking.h" +#include "utilities.h" +#include "log.h" + +int ai_fam_pref = AF_UNSPEC; + +struct key *keys = NULL; + +void set_li_vn_mode (struct pkt *spkt, char leap, char version, char mode); +int sntp_main (int argc, char **argv); +int on_wire (struct addrinfo *host, struct addrinfo *bcastaddr); +int set_time (double offset); + +#define NORMALIZE_TIMEVAL(tv) \ +do { \ + while ((tv).tv_usec < 0) { \ + (tv).tv_usec += 1000000; \ + (tv).tv_sec--; \ + } \ + while ((tv).tv_usec > 999999) { \ + (tv).tv_usec -= 1000000; \ + (tv).tv_sec++; \ + } \ +} while (0) + + +/* + * The actual main function. + */ +int +sntp_main ( + int argc, + char **argv + ) +{ + register int c; + struct kod_entry *reason = NULL; + int optct; + /* boolean, u_int quiets gcc4 signed overflow warning */ + u_int sync_data_suc; + struct addrinfo **bcastaddr = NULL; + struct addrinfo **resh = NULL; + struct addrinfo *ai; + int resc; + int kodc; + int ow_ret; + int bcast = 0; + char *hostname; + + optct = optionProcess(&sntpOptions, argc, argv); + argc -= optct; + argv += optct; + + /* Initialize logging system */ + init_logging(); + if (HAVE_OPT(LOGFILE)) + open_logfile(OPT_ARG(LOGFILE)); + + msyslog(LOG_NOTICE, "Started sntp"); + + /* IPv6 available? */ + if (isc_net_probeipv6() != ISC_R_SUCCESS) { + ai_fam_pref = AF_INET; +#ifdef DEBUG + printf("No ipv6 support available, forcing ipv4\n"); +#endif + } else { + /* Check for options -4 and -6 */ + if (HAVE_OPT(IPV4)) + ai_fam_pref = AF_INET; + else if (HAVE_OPT(IPV6)) + ai_fam_pref = AF_INET6; + } + + /* Parse config file if declared TODO */ + + /* + * If there's a specified KOD file init KOD system. If not use + * default file. For embedded systems with no writable + * filesystem, -K /dev/null can be used to disable KoD storage. + */ + if (HAVE_OPT(KOD)) + kod_init_kod_db(OPT_ARG(KOD)); + else + kod_init_kod_db("/var/db/ntp-kod"); + + if (HAVE_OPT(KEYFILE)) + auth_init(OPT_ARG(KEYFILE), &keys); + +#ifdef EXERCISE_KOD_DB + add_entry("192.168.169.170", "DENY"); + add_entry("192.168.169.171", "DENY"); + add_entry("192.168.169.172", "DENY"); + add_entry("192.168.169.173", "DENY"); + add_entry("192.168.169.174", "DENY"); + delete_entry("192.168.169.174", "DENY"); + delete_entry("192.168.169.172", "DENY"); + delete_entry("192.168.169.170", "DENY"); + if ((kodc = search_entry("192.168.169.173", &reason)) == 0) + printf("entry for 192.168.169.173 not found but should have been!\n"); + else + free(reason); +#endif + + /* Considering employing a variable that prevents functions of doing anything until + * everything is initialized properly + */ + resc = resolve_hosts((const char **)argv, argc, &resh, ai_fam_pref); + if (resc < 1) { + printf("Unable to resolve hostname(s)\n"); + return -1; + } + bcast = ENABLED_OPT(BROADCAST); + if (bcast) { + const char * myargv[2]; + + myargv[0] = OPT_ARG(BROADCAST); + myargv[1] = NULL; + bcast = resolve_hosts(myargv, 1, &bcastaddr, ai_fam_pref); + } + + /* Select a certain ntp server according to simple criteria? For now + * let's just pay attention to previous KoDs. + */ + sync_data_suc = FALSE; + for (c = 0; c < resc && !sync_data_suc; c++) { + ai = resh[c]; + do { + hostname = addrinfo_to_str(ai); + if ((kodc = search_entry(hostname, &reason)) == 0) { + if (is_reachable(ai)) { + ow_ret = on_wire(ai, bcast ? bcastaddr[0] : NULL); + if (0 == ow_ret) + sync_data_suc = TRUE; + } + } else { + printf("%d prior KoD%s for %s, skipping.\n", + kodc, (kodc > 1) ? "s" : "", hostname); + free(reason); + } + free(hostname); + ai = ai->ai_next; + } while (NULL != ai); + freeaddrinfo(resh[c]); + } + free(resh); + + if (!sync_data_suc) + return 1; + return 0; } - - -void pack_ntp (unsigned char *packet, int length, ntp_data *data) { - -/* Pack the essential data into an NTP packet, bypassing struct layout and -endian problems. Note that it ignores fields irrelevant to SNTP. */ - - int i, k; - double d; - - memset(packet,0,(size_t)length); - packet[0] = (data->status<<6)|(data->version<<3)|data->mode; - packet[1] = data->stratum; - packet[2] = data->polling; - packet[3] = data->precision; - d = data->originate/NTP_SCALE; - for (i = 0; i < 8; ++i) { - if ((k = (int)(d *= 256.0)) >= 256) k = 255; - packet[NTP_ORIGINATE+i] = k; - d -= k; - } - d = data->receive/NTP_SCALE; - for (i = 0; i < 8; ++i) { - if ((k = (int)(d *= 256.0)) >= 256) k = 255; - packet[NTP_RECEIVE+i] = k; - d -= k; - } - d = data->transmit/NTP_SCALE; - for (i = 0; i < 8; ++i) { - if ((k = (int)(d *= 256.0)) >= 256) k = 255; - packet[NTP_TRANSMIT+i] = k; - d -= k; - } -} - - - -void unpack_ntp (ntp_data *data, unsigned char *packet, int length) { - -/* Unpack the essential data from an NTP packet, bypassing struct layout and -endian problems. Note that it ignores fields irrelevant to SNTP. */ - - int i; - double d; - - data->current = current_time(JAN_1970); /* Best to come first */ - data->status = (packet[0] >> 6); - data->version = (packet[0] >> 3)&0x07; - data->mode = packet[0]&0x07; - data->stratum = packet[1]; - data->polling = packet[2]; - data->precision = packet[3]; - d = 0.0; - for (i = 0; i < 4; ++i) d = 256.0*d+packet[NTP_DISP_FIELD+i]; - data->dispersion = d/65536.0; - d = 0.0; - for (i = 0; i < 8; ++i) d = 256.0*d+packet[NTP_REFERENCE+i]; - data->reference = d/NTP_SCALE; - d = 0.0; - for (i = 0; i < 8; ++i) d = 256.0*d+packet[NTP_ORIGINATE+i]; - data->originate = d/NTP_SCALE; - d = 0.0; - for (i = 0; i < 8; ++i) d = 256.0*d+packet[NTP_RECEIVE+i]; - data->receive = d/NTP_SCALE; - d = 0.0; - for (i = 0; i < 8; ++i) d = 256.0*d+packet[NTP_TRANSMIT+i]; - data->transmit = d/NTP_SCALE; +static union { + struct pkt pkt; + char buf[1500]; +} rbuf; + +#define r_pkt rbuf.pkt + +int +generate_pkt ( + struct pkt *x_pkt, + const struct timeval *tv_xmt, + int key_id, + struct key *pkt_key + ) +{ + l_fp xmt; + int pkt_len = LEN_PKT_NOMAC; + memset(x_pkt, 0, sizeof(struct pkt)); + TVTOTS(tv_xmt, &xmt); + HTONL_FP(&xmt, &(x_pkt->xmt)); + x_pkt->stratum = STRATUM_TO_PKT(STRATUM_UNSPEC); + x_pkt->ppoll = 8; + /* FIXME! Modus broadcast + adr. check -> bdr. pkt */ + set_li_vn_mode(x_pkt, LEAP_NOTINSYNC, 4, 3); + if (pkt_key != NULL) { + int mac_size = 20; /* max room for MAC */ + x_pkt->exten[0] = htonl(key_id); + mac_size = make_mac((char *)x_pkt, pkt_len, mac_size, pkt_key, (char *)&x_pkt->exten[1]); + if (mac_size) + pkt_len += mac_size + 4; + } + return pkt_len; } - - -void make_packet (ntp_data *data, int mode) { - -/* Create an outgoing NTP packet, either from scratch or starting from a -request from a client. Note that it implements the NTP specification, even -when this is clearly misguided, except possibly for the setting of LI. It -would be easy enough to add a sanity flag, but I am not in the business of -designing an alternative protocol (however much better it might be). */ - - data->status = NTP_LI_FUDGE<<6; - data->stratum = NTP_STRATUM; - data->reference = data->dispersion = 0.0; - if (mode == NTP_SERVER) { - data->mode = (data->mode == NTP_CLIENT ? NTP_SERVER : NTP_PASSIVE); - data->originate = data->transmit; - data->receive = data->current; - } else { - data->version = NTP_VERSION; - data->mode = mode; - data->polling = NTP_POLLING; - data->precision = NTP_PRECISION; - data->receive = data->originate = 0.0; - } - data->current = data->transmit = current_time(JAN_1970); -} - - - -int read_packet (int which, ntp_data *data, double *off, double *err) { - -/* Check the packet and work out the offset and optionally the error. Note -that this contains more checking than xntp does. This returns 0 for success, 1 -for failure and 2 for an ignored broadcast packet (a kludge for servers). Note -that it must not change its arguments if it fails. */ - - unsigned char receive[NTP_PACKET_MAX+1]; - double delay1, delay2, x, y; - int response = 0, failed, length, i, k; - -/* Read the packet and deal with diagnostics. */ - - if ((length = read_socket(which,receive,NTP_PACKET_MAX+1,waiting)) <= 0) - return 1; - if (length < NTP_PACKET_MIN || length > NTP_PACKET_MAX) { - if (verbose) - fprintf(stderr,"%s: bad length %d for NTP packet on socket %d\n", - argv0,length,which); - return 1; - } - if (verbose > 2) { - fprintf(stderr,"Incoming packet on socket %d:\n",which); - display_packet(receive,length); - } - unpack_ntp(data,receive,length); - if (verbose > 2) display_data(data); - -/* Start by checking that the packet looks reasonable. Be a little paranoid, -but allow for version 1 semantics and sick clients. */ - - if (operation == op_listen) - failed = (data->mode != NTP_BROADCAST); - else { - failed = (data->mode != NTP_SERVER && data->mode != NTP_PASSIVE); - response = 1; - } - if (failed || data->status == 3 || data->version < 1 || - data->version > NTP_VERSION_MAX || - data->stratum > NTP_STRATUM_MAX) { - if (verbose) - fprintf(stderr, - "%s: Unusable NTP packet rejected on socket %d (f=%d, status %d, version %d, stratum %d)\n", - argv0, which, - failed, data->status, data->version, data->stratum); - return 1; - } - -/* Note that the conventions are very poorly defined in the NTP protocol, so we -have to guess. Any full NTP server perpetrating completely unsynchronised -packets is an abomination, anyway, so reject it. */ - - delay1 = data->transmit-data->receive; - delay2 = data->current-data->originate; - failed = ( - ( data->stratum != 0 - /* && data->stratum != NTP_STRATUM_MAX */ - && data->reference == 0.0 - ) - || data->transmit == 0.0 - ); - if (response && - (data->originate == 0.0 || data->receive == 0.0 || - (data->reference != 0.0 && data->receive < data->reference) || - delay1 < 0.0 || delay1 > NTP_INSANITY || delay2 < 0.0 || - data->dispersion > NTP_INSANITY)) - failed = 1; - if (failed) { - if (verbose) - fprintf(stderr, - "%s: incomprehensible NTP packet rejected on socket %d\n", - argv0,which); - return 1; - } - if (data->stratum == NTP_STRATUM_MAX) { - fprintf(stderr, - "%s: unsynch NTP response on socket %d\n", - argv0,which); - return 1; - } - -/* If it is a response, check that it corresponds to one of our requests and -has got here in a reasonable length of time. */ - - if (response) { - k = 0; - for (i = 0; i < attempts; ++i) - if (data->originate == outgoing[i]) { - outgoing[i] = 0.0; - ++k; - } - if (k != 1 || delay2 > NTP_INSANITY) { - if (verbose) - fprintf(stderr, - "%s: bad response from NTP server rejected on socket %d\n", - argv0,which); - return 1; - } - } - -/* Now return the time information. If it is a server response, it contains -enough information that we can be almost certain that we have not been fooled -too badly. Heaven help us with broadcasts - make a wild kludge here, and see -elsewhere for other kludges. */ - - if (dispersion < data->dispersion) dispersion = data->dispersion; - if (operation == op_listen) { - *off = data->transmit-data->current; - *err = NTP_INSANITY; - } else { - x = data->receive-data->originate; - y = (data->transmit == 0.0 ? 0.0 : data->transmit-data->current); - *off = 0.5*(x+y); - *err = x-y; - x = data->current-data->originate; - if (0.5*x > *err) *err = 0.5*x; - } - return 0; -} - - - -void format_time (char *text, int length, double offset, double error, - double drift, double drifterr, int precision) { - -/* Format the current time into a string, with the extra information as -requested. Note that the rest of the program uses the correction needed, which -is what is printed for diagnostics, but this formats the error in the local -system for display to users. So the results from this are the negation of -those printed by the verbose options. */ - - int milli, len; - time_t now; - struct tm *gmt; - static const char *months[] = { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" - }; - -/* Work out and format the current local time. Note that some semi-ANSI -systems do not set the return value from (s)printf. */ - - now = convert_time(current_time(offset),&milli); - errno = 0; - if ((gmt = localtime(&now)) == NULL) - fatal(1,"unable to work out local time",NULL); - len = 21; - if (length <= len) fatal(0,"internal error calling format_time",NULL); - errno = 0; - precision /= -3; - len += precision; - sprintf(text,"%.4d %s %.2d %.2d:%.2d:%.2d.%.*d", - gmt->tm_year+1900,months[gmt->tm_mon],gmt->tm_mday, - gmt->tm_hour,gmt->tm_min,gmt->tm_sec,precision,milli); - if (strlen(text) != len) - fatal(1,"unable to format current local time",NULL); - -/* Append the information about the offset, if requested. */ - - if (error >= 0.0) { - if (length < len+30) - fatal(0,"internal error calling format_time",NULL); - errno = 0; - sprintf(&text[len]," %c %.*f +/- %.*f secs",(offset > 0.0 ? '-' : '+'), - precision,(offset > 0.0 ? offset : -offset), - precision,dispersion+error); - if (strlen(&text[len]) < 22) - fatal(1,"unable to format clock correction",NULL); - } - -/* Append the information about the drift, if requested. */ - - if (drifterr >= 0.0) { - len = strlen(text); - if (length < len+25) - fatal(0,"internal error calling format_time",NULL); - errno = 0; - sprintf(&text[len]," %c %.1f +/- %.1f ppm", - (drift > 0.0 ? '-' : '+'),1.0e6*fabs(drift), - 1.0e6*drifterr); - if (strlen(&text[len]) < 17) - fatal(1,"unable to format clock correction",NULL); - } - -/* It would be better to check for field overflow, but it is a lot of code to -trap extremely implausible scenarios. This will usually stop chaos from -spreading. */ - - if (strlen(text) >= length) - fatal(0,"internal error calling format_time",NULL); -} - - - -double reset_clock (double offset, double error, int daemon) { - -/* Reset the clock, if appropriate, and return the correction actually used. -This contains most of the checking for whether changes are worthwhile, except -in daemon mode. */ - - double absoff = (offset < 0 ? -offset : offset); - char text[50]; - -/* If the correction is large, ask for confirmation before proceeding. */ - - if (absoff > prompt) { - if (! daemon && ftty(stdin) && ftty(stdout)) { - printf("The time correction is %.3f +/- %.3f+%.3f seconds\n", - offset,dispersion,error); - printf("Do you want to correct the time anyway? "); - fflush(stdout); - if (toupper(getchar()) != 'Y') { - printf("OK - quitting\n"); - fatal(0,NULL,NULL); - } - } else { - sprintf(text,"%.3f +/- %.3f+%.3f",offset,dispersion,error); - fatal(0,"time correction too large: %s seconds",text); - } - } - -/* See if the correction is reasonably reliable and worth making. */ - - if (absoff < (daemon ? 0.5 : 1.0)*minerr) { - if (daemon ? verbose > 1 : verbose) - fprintf(stderr,"%s: correction %.3f +/- %.3f+%.3f secs - ignored\n", - argv0,offset,dispersion,error); - return 0.0; - } else if (absoff < 2.0*error) { - if (daemon ? verbose > 1 : verbose) - fprintf(stderr, - "%s: correction %.3f +/- %.3f+%.3f secs - suppressed\n", - argv0,offset,dispersion,error); - return 0.0; - } - -/* Make the correction. Provide some protection against the previous -correction not having completed, but it will rarely help much. */ - - adjust_time(offset,(action == action_reset ? 1 : 0), - (daemon ? 2.0*minerr : 0.0)); - if (daemon ? verbose > 1 : verbose) { - format_time(text,50,0.0,-1.0,0.0,-1.0,-10); - fprintf(stderr, - "%s: time changed by %.3f secs to %s +/- %.3f+%.3f\n", - argv0,offset,text,dispersion,error); - } - return offset; -} - - -double estimate_stats (int *a_total, int *a_index, data_record *record, - double correction, double *a_disp, double *a_when, double *a_offset, - double *a_error, double *a_drift, double *a_drifterr, int *a_wait, - int update) { - -/* This updates the running statistics and returns the best estimate of what to -do now. It returns the timestamp relevant to the correction. If broadcasts -are rare and the drift is large, it will fail - you should then use a better -synchronisation method. It will also fail if something goes severely wrong -(e.g. if the local clock is reset by another process or the transmission errors -are beyond reason). - -There is a kludge for synchronisation loss during down time. If it detects -this, it will update only the history data and return zero; this is then -handled specially in run_daemon(). While it could correct the offset, this -might not always be the right thing to do. */ - - double weight, disp, when, offset, error, drift, drifterr, - now, e, w, x, y, z; - int total = *a_total, index = *a_index, wait = *a_wait, i; - char text[50]; +int +handle_pkt ( + int rpktl, + struct pkt *rpkt, + struct addrinfo *host + ) +{ + struct timeval tv_dst; + int sw_case, digits; + char *hostname = NULL, *ref, *ts_str = NULL; + double offset, precision, root_dispersion; + char addr_buf[INET6_ADDRSTRLEN]; + char *p_SNTP_PRETEND_TIME; + time_t pretend_time; + + if(rpktl > 0) + sw_case = 1; + else + sw_case = rpktl; + + switch(sw_case) { + case SERVER_UNUSEABLE: + return -1; + break; + + case PACKET_UNUSEABLE: + break; -/* Correct the previous data and store a new entry in the circular buffer. */ - - for (i = 0; i < total; ++i) { - record[i].when += correction; - record[i].offset -= correction; - } - if (update) { - record[index].dispersion = *a_disp; - record[index].when = *a_when; - record[index].offset = *a_offset; - if (verbose > 1) - fprintf(stderr,"%s: corr=%.3f when=%.3f disp=%.3f off=%.3f", - argv0,correction,*a_when,*a_disp,*a_offset); /* See below */ - if (operation == op_listen) { - if (verbose > 1) fprintf(stderr,"\n"); - record[index].error = minerr; - record[index].weight = 1.0; - } else { - if (verbose > 1) fprintf(stderr," err=%.3f\n",*a_error); - record[index].error = x = *a_error; - record[index].weight = 1.0/(x > minerr ? x*x : minerr*minerr); - } - if (++index >= count) index = 0; - *a_index = index; - if (++total > count) total = count; - *a_total = total; - if (verbose > 2) - fprintf(stderr,"corr=%.6f tot=%d ind=%d\n",correction,total,index); - } - -/* If there is insufficient data yet, use the latest estimates and return -forthwith. Note that this will not work for broadcasts, but they will be -disabled in run_daemon(). */ - - if ((operation == op_listen && total < count && update) || total < 3) { - *a_drift = 0.0; - *a_drifterr = -1.0; - *a_wait = delay; - return *a_when; - } - -/* Work out the average time, offset, error etc. Note that the dispersion is -not subject to the central limit theorem. Unfortunately, the variation in the -source's dispersion is our only indication of how consistent its clock is. */ - - disp = weight = when = offset = y = 0.0; - for (i = 0; i < total; ++i) { - weight += w = record[i].weight; - when += w*record[i].when; - offset += w*record[i].offset; - y += w*record[i].dispersion; - if (disp < record[i].dispersion) - disp = record[i].dispersion; - } - when /= weight; - offset /= weight; - y /= weight; - if (verbose > 2) - fprintf(stderr,"disp=%.6f wgt=%.3f when=%.6f off=%.6f\n", - disp,weight,when,offset); - -/* If there is enough data, estimate the drift and errors by regression. Note -that it is essential to calculate the mean square error, not the mean error. */ - - error = drift = x = z = 0.0; - for (i = 0; i < total; ++i) { - w = record[i].weight/weight; - x += w*(record[i].when-when)*(record[i].when-when); - drift += w*(record[i].when-when)*(record[i].offset-offset); - z += w*(record[i].offset-offset)*(record[i].offset-offset); - error += w*record[i].error*record[i].error+ - 2.0*w*(record[i].dispersion-y)*(record[i].dispersion-y); - } - if (verbose > 2) - fprintf(stderr,"X2=%.3f XY=%.6f Y2=%.9f E2=%.9f ",x,drift,z,error); - -/* When calculating the errors, add some paranoia mainly to check for coding -errors and complete lunacy, attempting to retry if at all possible. Because -glitches at this point are so common, log a reset even in non-verbose mode. -There will be more thorough checks later. Note that we cannot usefully check -the error for broadcasts. */ - - z -= drift*drift/x; - if (verbose > 2) fprintf(stderr,"S2=%.9f\n",z); - if (! update) { - if (z > 1.0e6) - fatal(0,"stored data too unreliable for time estimation",NULL); - } else if (operation == op_client) { - e = error+disp*disp+minerr*minerr; - if (z > e) { - if (verbose || z >= maxerr*maxerr) - fprintf(stderr, - "%s: excessively high error %.3f > %.3f > %.3f\n", - argv0,sqrt(z),sqrt(e),sqrt(error)); - if (total <= 1) - return 0.0; - else if (z < maxerr*maxerr) { - sprintf(text,"resetting on error %.3g > %.3g", - sqrt(z),sqrt(e)); - log_message(text); - return 0.0; - } else - fatal(0,"incompatible (i.e. erroneous) timestamps",NULL); - } else if (z > error && verbose) - fprintf(stderr, - "%s: anomalously high error %.3f > %.3f, but < %.3f\n", - argv0,sqrt(z),sqrt(error),sqrt(e)); - } else { - if (z > maxerr*maxerr) - fatal(0,"broadcasts too unreliable for time estimation",NULL); - } - drift /= x; - drifterr = ABSCISSA*sqrt(z/(x*total)); - error = (operation == op_listen ? minerr : 0.0)+ABSCISSA*sqrt(z/total); - if (verbose > 2) - fprintf(stderr,"err=%.6f drift=%.6f+/-%.6f\n",error,drift,drifterr); - if (error+drifterr*delay > NTP_INSANITY) - fatal(0,"unable to get a reasonable drift estimate",NULL); - -/* Estimate the optimal short-loop period, checking it carefully. Remember to -check that this whole process is likely to be accurate enough and that the -delay function may be inaccurate. */ - - wait = delay; - x = (drift < 0.0 ? -drift : drift); - if (x*delay < 0.5*minerr) { - if (verbose > 2) fprintf(stderr,"Drift too small to correct\n"); - } else if (x < 2.0*drifterr) { - if (verbose > 2) - fprintf(stderr,"Drift correction suppressed\n"); - } else { - if ((z = drifterr*delay) < 0.5*minerr) z = 0.5*minerr; - wait = (x < z/delay ? delay : (int)(z/x+0.5)); - wait = (int)(delay/(int)(delay/(double)wait+0.999)+0.999); - if (wait > delay) - fatal(0,"internal error in drift calculation",NULL); - if (update && (drift*wait > maxerr || wait < RESET_MIN)) { - sprintf(text,"%.6f+/-%.6f",drift,drifterr); - fatal(0,"drift correction too large: %s",text); - } - } - if (wait < *a_wait/2) wait = *a_wait/2; - if (wait > *a_wait*2) wait = *a_wait*2; - -/* Now work out what the correction should be, as distinct from what it should -have been, remembering that older times are less certain. */ - - now = current_time(JAN_1970); - x = now-when; - offset += x*drift; - error += x*drifterr; - for (i = 0; i < total; ++i) { - x = now-record[i].when; - z = record[i].error+x*drifterr; - if (z < error) { - when = record[i].when; - offset = record[i].offset+x*drift; - error = z; - } - } - if (verbose > 2) - fprintf(stderr,"now=%.6f when=%.6f off=%.6f err=%.6f wait=%d\n", - now,when,offset,error,wait); - -/* Finally, return the result. */ - - *a_disp = disp; - *a_when = when; - *a_offset = offset; - *a_error = error; - *a_drift = drift; - *a_drifterr = drifterr; - *a_wait = wait; - return now; + case SERVER_AUTH_FAIL: + break; + + case KOD_DEMOBILIZE: + /* Received a DENY or RESTR KOD packet */ + hostname = addrinfo_to_str(host); + ref = (char *)&rpkt->refid; + add_entry(hostname, ref); + + if (ENABLED_OPT(NORMALVERBOSE)) + printf("sntp handle_pkt: Received KOD packet with code: %c%c%c%c from %s, demobilizing all connections\n", + ref[0], ref[1], ref[2], ref[3], + hostname); + + msyslog(LOG_WARNING, "Received a KOD packet with code %c%c%c%c from %s, demobilizing all connections", + ref[0], ref[1], ref[2], ref[3], hostname); + break; + + case KOD_RATE: + /* Hmm... probably we should sleep a bit here */ + break; + + case 1: + if (ENABLED_OPT(NORMALVERBOSE)) { + getnameinfo(host->ai_addr, host->ai_addrlen, addr_buf, + sizeof(addr_buf), NULL, 0, NI_NUMERICHOST); + printf("sntp handle_pkt: Received %i bytes from %s\n", rpktl, addr_buf); + } + + GETTIMEOFDAY(&tv_dst, (struct timezone *)NULL); + + p_SNTP_PRETEND_TIME = getenv("SNTP_PRETEND_TIME"); + if (p_SNTP_PRETEND_TIME) { +#if SIZEOF_TIME_T == 4 + sscanf(p_SNTP_PRETEND_TIME, "%ld", &pretend_time); +#elif SIZEOF_TIME_T == 8 + sscanf(p_SNTP_PRETEND_TIME, "%lld", &pretend_time); +#else +# include "GRONK: unexpected value for SIZEOF_TIME_T" +#endif + tv_dst.tv_sec = pretend_time; + } + + offset_calculation(rpkt, rpktl, &tv_dst, &offset, + &precision, &root_dispersion); + + for (digits = 0; (precision *= 10.) < 1.; ++digits) + /* empty */ ; + if (digits > 6) + digits = 6; + + ts_str = tv_to_str(&tv_dst); + printf("%s ", ts_str); + if (offset > 0) + printf("+"); + printf("%.*f", digits, offset); + if (root_dispersion > 0.) + printf(" +/- %f secs", root_dispersion); + printf("\n"); + free(ts_str); + + if (p_SNTP_PRETEND_TIME) + return 0; + + if (ENABLED_OPT(SETTOD) || ENABLED_OPT(ADJTIME)) + return set_time(offset); + + return 0; + } + + return 1; } - - -double correct_drift (double *a_when, double *a_offset, double drift) { - -/* Correct for the drift since the last time it was done, provided that a long -enough time has elapsed. And do remember to kludge up the time and -discrepancy, when appropriate. */ - - double d, x; - - d = current_time(JAN_1970)-*a_when; - *a_when += d; - x = *a_offset+d*drift; - if (verbose > 2) - fprintf(stderr,"Correction %.6f @ %.6f off=%.6f ",x,*a_when,*a_offset); - if (d >= waiting && (x < 0.0 ? -x : x) >= 0.5*minerr) { - if (verbose > 2) fprintf(stderr,"performed\n"); - adjust_time(x,(action == action_reset ? 1 : 0),0.5*minerr); - *a_offset = 0.0; - return x; - } else { - if (verbose > 2) fprintf(stderr,"ignored\n"); - *a_offset = x; - return 0.0; - } +void +offset_calculation ( + struct pkt *rpkt, + int rpktl, + struct timeval *tv_dst, + double *offset, + double *precision, + double *root_dispersion + ) +{ + l_fp p_rec, p_xmt, p_ref, p_org, tmp, dst; + u_fp p_rdly, p_rdsp; + double t21, t34, delta; + + /* Convert timestamps from network to host byte order */ + p_rdly = NTOHS_FP(rpkt->rootdelay); + p_rdsp = NTOHS_FP(rpkt->rootdisp); + NTOHL_FP(&rpkt->reftime, &p_ref); + NTOHL_FP(&rpkt->org, &p_org); + NTOHL_FP(&rpkt->rec, &p_rec); + NTOHL_FP(&rpkt->xmt, &p_xmt); + + *precision = LOGTOD(rpkt->precision); +#ifdef DEBUG + printf("sntp precision: %f\n", *precision); +#endif /* DEBUG */ + + *root_dispersion = FPTOD(p_rdsp); + +#ifdef DEBUG + printf("sntp rootdelay: %f\n", FPTOD(p_rdly)); + printf("sntp rootdisp: %f\n", *root_dispersion); + + pkt_output(rpkt, rpktl, stdout); + + printf("sntp offset_calculation: rpkt->reftime:\n"); + l_fp_output(&(rpkt->reftime), stdout); + printf("sntp offset_calculation: rpkt->org:\n"); + l_fp_output(&(rpkt->org), stdout); + printf("sntp offset_calculation: rpkt->rec:\n"); + l_fp_output(&(rpkt->rec), stdout); + printf("sntp offset_calculation: rpkt->rec:\n"); + l_fp_output_bin(&(rpkt->rec), stdout); + printf("sntp offset_calculation: rpkt->rec:\n"); + l_fp_output_dec(&(rpkt->rec), stdout); + printf("sntp offset_calculation: rpkt->xmt:\n"); + l_fp_output(&(rpkt->xmt), stdout); +#endif + + /* Compute offset etc. */ + tmp = p_rec; + L_SUB(&tmp, &p_org); + LFPTOD(&tmp, t21); + TVTOTS(tv_dst, &dst); + dst.l_ui += JAN_1970; + tmp = p_xmt; + L_SUB(&tmp, &dst); + LFPTOD(&tmp, t34); + *offset = (t21 + t34) / 2.; + delta = t21 - t34; + + if (ENABLED_OPT(NORMALVERBOSE)) + printf("sntp offset_calculation:\tt21: %.6f\t\t t34: %.6f\n\t\tdelta: %.6f\t offset: %.6f\n", + t21, t34, delta, *offset); } - - -void handle_saving (int operation, int *total, int *index, int *cycle, - data_record *record, double *previous, double *when, double *correction) { - -/* This handles the saving and restoring of the state to a file. While it is -subject to spoofing, this is not a major security problem. But, out of general -paranoia, check everything in sight when restoring. Note that this function -has no external effect if something goes wrong. */ - - struct { - data_record record[COUNT_MAX]; - double previous, when, correction; - int operation, delay, count, total, index, cycle, waiting; - } buffer; - double x, y; - int i, j; - - if (savefile == NULL) return; - -/* Read the restart file and print its data in diagnostic mode. Note that some -care is necessary to avoid introducing a security exposure - but we trust the -C library not to trash the stack on bad numbers! */ - - if (operation == save_read_only || operation == save_read_check) { - if (fread(&buffer,sizeof(buffer),1,savefile) != 1 || ferror(savefile)) { - if (ferror(savefile)) - fatal(1,"unable to read record from daemon save file",NULL); - else if (verbose) - fprintf(stderr,"%s: bad daemon restart information\n",argv0); - return; - } - if (verbose > 2) { - fprintf(stderr,"Reading prev=%.6f when=%.6f corr=%.6f\n", - buffer.previous,buffer.when,buffer.correction); - fprintf(stderr,"op=%d dly=%d cnt=%d tot=%d ind=%d cyc=%d wait=%d\n", - buffer.operation,buffer.delay,buffer.count,buffer.total, - buffer.index,buffer.cycle,buffer.waiting); - if (buffer.total < COUNT_MAX) - for (i = 0; i < buffer.total; ++i) - fprintf(stderr, - "disp=%.6f wgt=%.3f when=%.6f off=%.6f err=%.6f\n", - buffer.record[i].dispersion,buffer.record[i].weight, - buffer.record[i].when,buffer.record[i].offset, - buffer.record[i].error); - } - - -/* Start checking the data for sanity. */ - - if (buffer.operation == 0 && buffer.delay == 0 && buffer.count == 0) { - if (operation < 0) - fatal(0,"the daemon save file has been cleared",NULL); - if (verbose) - fprintf(stderr,"%s: restarting from a cleared file\n",argv0); - return; - } - if (operation == save_read_check) { - if (buffer.operation != operation || buffer.delay != delay || - buffer.count != count) { - if (verbose) - fprintf(stderr,"%s: different parameters for restart\n", - argv0); - return; - } - if (buffer.total < 1 || buffer.total > count || buffer.index < 0 || - buffer.index >= count || buffer.cycle < 0 || - buffer.cycle >= count || buffer.correction < -maxerr || - buffer.correction > maxerr || buffer.waiting < RESET_MIN || - buffer.waiting > delay || buffer.previous > buffer.when || - buffer.previous < buffer.when-count*delay || - buffer.when >= *when) { - if (verbose) - fprintf(stderr,"%s: corrupted restart information\n",argv0); - return; - } - -/* Checking the record is even more tedious. */ - - x = *when; - y = 0.0; - for (i = 0; i < buffer.total; ++i) { - if (buffer.record[i].dispersion < 0.0 || - buffer.record[i].dispersion > maxerr || - buffer.record[i].weight <= 0.0 || - buffer.record[i].weight > 1.001/(minerr*minerr) || - buffer.record[i].offset < -count*maxerr || - buffer.record[i].offset > count*maxerr || - buffer.record[i].error < 0.0 || - buffer.record[i].error > maxerr) { - if (verbose) - fprintf(stderr,"%s: corrupted restart record\n",argv0); - return; - } - if (buffer.record[i].when < x) x = buffer.record[i].when; - if (buffer.record[i].when > y) y = buffer.record[i].when; - } - -/* Check for consistency and, finally, whether this is too old. */ - - if (y > buffer.when || y-x < (buffer.total-1)*delay || - y-x > (buffer.total-1)*count*delay) { - if (verbose) - fprintf(stderr,"%s: corrupted restart times\n",argv0); - return; - } - if (buffer.when < *when-count*delay) { - if (verbose) - fprintf(stderr,"%s: restart information too old\n",argv0); - return; - } - } - -/* If we get here, just copy the data back. */ - - memcpy(record,buffer.record,sizeof(buffer.record)); - *previous = buffer.previous; - *when = buffer.when; - *correction = buffer.correction; - *total = buffer.total; - *index = buffer.index; - *cycle = buffer.cycle; - waiting = buffer.waiting; - memset(&buffer,0,sizeof(buffer)); - -/* Print out the data if requested. */ - - if (verbose > 1) { - fprintf(stderr,"%s: prev=%.3f when=%.3f corr=%.3f\n", - argv0,*previous,*when,*correction); - for (i = 0; i < *total; ++i) { - if ((j = i+*index-*total) < 0) j += *total; - fprintf(stderr,"%s: when=%.3f disp=%.3f off=%.3f", - argv0,record[j].when,record[j].dispersion,record[j].offset); - if (operation == op_client) - fprintf(stderr," err=%.3f\n",record[j].error); - else - fprintf(stderr,"\n"); - } - } - -/* All errors on output are fatal. */ - - } else if (operation == save_write) { - memcpy(buffer.record,record,sizeof(buffer.record)); - buffer.previous = *previous; - buffer.when = *when; - buffer.correction = *correction; - buffer.operation = operation; - buffer.delay = delay; - buffer.count = count; - buffer.total = *total; - buffer.index = *index; - buffer.cycle = *cycle; - buffer.waiting = waiting; - if (fseek(savefile,0l,SEEK_SET) != 0 || - fwrite(&buffer,sizeof(buffer),1,savefile) != 1 || - fflush(savefile) != 0 || ferror(savefile)) - fatal(1,"unable to write record to daemon save file",NULL); - if (verbose > 2) { - fprintf(stderr,"Writing prev=%.6f when=%.6f corr=%.6f\n", - *previous,*when,*correction); - fprintf(stderr,"op=%d dly=%d cnt=%d tot=%d ind=%d cyc=%d wait=%d\n", - operation,delay,count,*total,*index,*cycle,waiting); - if (*total < COUNT_MAX) - for (i = 0; i < *total; ++i) - fprintf(stderr, - "disp=%.6f wgt=%.3f when=%.6f off=%.6f err=%.6f\n", - record[i].dispersion,record[i].weight, - record[i].when,record[i].offset,record[i].error); - } - -/* Clearing the save file is similar. */ - - } else if (operation == save_clear) { - if (fseek(savefile,0l,SEEK_SET) != 0 || - fwrite(&buffer,sizeof(buffer),1,savefile) != 1 || - fflush(savefile) != 0 || ferror(savefile)) - fatal(1,"unable to clear daemon save file",NULL); - } else - fatal(0,"internal error in handle_saving",NULL); +/* The heart of (S)NTP, exchange NTP packets and compute values to correct the local clock */ +int +on_wire ( + struct addrinfo *host, + struct addrinfo *bcast + ) +{ + char addr_buf[INET6_ADDRSTRLEN]; + register int try; + SOCKET sock; + struct key *pkt_key = NULL; + int key_id = 0; + struct timeval tv_xmt; + struct pkt x_pkt; + int error, rpktl, handle_pkt_res; + + + if (ENABLED_OPT(AUTHENTICATION)) { + key_id = (int) OPT_ARG(AUTHENTICATION); + get_key(key_id, &pkt_key); + } + for (try=0; try<5; try++) { + memset(&r_pkt, 0, sizeof rbuf); + + error = GETTIMEOFDAY(&tv_xmt, (struct timezone *)NULL); + tv_xmt.tv_sec += JAN_1970; + +#ifdef DEBUG + printf("sntp on_wire: Current time sec: %i msec: %i\n", (unsigned int) tv_xmt.tv_sec, + (unsigned int) tv_xmt.tv_usec); +#endif + + if (bcast) { + create_socket(&sock, (sockaddr_u *)bcast->ai_addr); + rpktl = recv_bcst_pkt(sock, &r_pkt, sizeof rbuf, (sockaddr_u *)bcast->ai_addr); + closesocket(sock); + } else { + int pkt_len = generate_pkt(&x_pkt, &tv_xmt, key_id, pkt_key); + + create_socket(&sock, (sockaddr_u *)host->ai_addr); + sendpkt(sock, (sockaddr_u *)host->ai_addr, &x_pkt, pkt_len); + rpktl = recvpkt(sock, &r_pkt, sizeof rbuf, &x_pkt); + closesocket(sock); + } + + handle_pkt_res = handle_pkt(rpktl, &r_pkt, host); + if (handle_pkt_res < 1) + return handle_pkt_res; + } + + getnameinfo(host->ai_addr, host->ai_addrlen, addr_buf, sizeof(addr_buf), NULL, 0, NI_NUMERICHOST); + msyslog(LOG_DEBUG, "Received no useable packet from %s!", addr_buf); + + return -1; } - - -void query_savefile (void) { - -/* This queries a daemon save file. */ - - double previous, when, correction = 0.0, offset = 0.0, error = -1.0, - drift = 0.0, drifterr = -1.0; - data_record record[COUNT_MAX]; - int total = 0, index = 0, cycle = 0; - char text[100]; - -/* This is a few lines stripped out of run_daemon() and slightly hacked. */ - - previous = when = current_time(JAN_1970); - if (verbose > 2) { - format_time(text,50,0.0,-1.0,0.0,-1.0,-10); - fprintf(stderr,"Started=%.6f %s\n",when,text); - } - handle_saving(save_read_only,&total,&index,&cycle,record,&previous,&when, - &correction); - estimate_stats(&total,&index,record,correction,&dispersion, - &when,&offset,&error,&drift,&drifterr,&waiting,0); - format_time(text,100,offset,error,drift,drifterr,-10); - printf("%s\n",text); - if (fclose(savefile)) fatal(1,"unable to close daemon save file",NULL); - if (verbose > 2) fprintf(stderr,"Stopped normally\n"); - exit(EXIT_SUCCESS); +/* Compute the 8 bits for li_vn_mode */ +void +set_li_vn_mode ( + struct pkt *spkt, + char leap, + char version, + char mode + ) +{ + if (leap > 3) { + msyslog(LOG_DEBUG, "set_li_vn_mode: leap > 3 using max. 3"); + leap = 3; + } + + if (mode > 7) { + msyslog(LOG_DEBUG, "set_li_vn_mode: mode > 7, using client mode 3"); + mode = 3; + } + + spkt->li_vn_mode = leap << 6; + spkt->li_vn_mode |= version << 3; + spkt->li_vn_mode |= mode; } - - -void run_daemon (char *hostnames[], int nhosts, int initial) { - -/* This does not adjust the time between calls to the server, but it does -adjust the time between clock resets. This function will survive short periods -of server inaccessibility or network glitches, but not long ones, and will then -need restarting manually. - -It is far too complex for a single function, but could really only be -simplified by making most of its variables global or by a similarly horrible -trick. Oh, for nested scopes as in Algol 68! */ - - double history[COUNT_MAX], started, previous, when, correction = 0.0, - weeble = 1.0, accepts = 0.0, rejects = 0.0, flushes = 0.0, - replicates = 0.0, skips = 0.0, offset = 0.0, error = -1.0, - drift = 0.0, drifterr = -1.0, maxoff = 0.0, x; - data_record record[COUNT_MAX]; - int total = 0, index = 0, item = 0, rej_level = 0, rep_level = 0, - cycle = 0, retry = 1, i, j, k; - unsigned char transmit[NTP_PACKET_MIN]; - ntp_data data; - char text[100]; - -/* After initialising, restore from a previous run if possible. Note that -only a few of the variables are actually needed to control the operation and -the rest are mainly for diagnostics. */ - - started = previous = when = current_time(JAN_1970); - if (verbose > 2) { - format_time(text,50,0.0,-1.0,0.0,-1.0,-10); - fprintf(stderr,"Started=%.6f %s\n",when,text); - } - if (initial) { - handle_saving(save_read_check,&total,&index,&cycle,record, - &previous,&when,&correction); - cycle = (nhosts > 0 ? cycle%nhosts : 0); - if (total > 0 && started-previous < delay) { - if (verbose > 2) fprintf(stderr,"Last packet too recent\n"); - retry = 0; - } - if (verbose > 2) - fprintf(stderr,"prev=%.6f when=%.6f retry=%d\n", - previous,when,retry); - for (i = 0; i < nhosts; ++i) open_socket(i,hostnames[i],delay); - if (action != action_display) { - set_lock(1); - locked = 1; - } - } - dispersion = 0.0; - attempts = 0; - for (i = 0; i < count; ++i) history[i] = 0.0; - while (1) { - -/* Print out a reasonable amount of diagnostics, rather like a server. Note -that it may take a little time, but shouldn't affect the estimates much. Then -check that we aren't in a failing loop. */ - - if (verbose > 2) fprintf(stderr,"item=%d rej=%d\n",item,rej_level); - x = current_time(JAN_1970)-started; - if (verbose && - x/3600.0+accepts+rejects+flushes+replicates+skips >= weeble) { - weeble *= WEEBLE_FACTOR; - x -= 3600.0*(i = (int)(x/3600.0)); - x -= 60.0*(j = (int)(x/60.0)); - if (i > 0) - fprintf(stderr,"%s: after %d hours %d mins ",argv0,i,j); - else if (j > 0) - fprintf(stderr,"%s: after %d mins %.0f secs ",argv0,j,x); - else - fprintf(stderr,"%s: after %.1f secs ",argv0,x); - fprintf(stderr,"acc. %.0f rej. %.0f flush %.0f", - accepts,rejects,flushes); - if (operation == op_listen) - fprintf(stderr," rep. %.0f skip %.0f",replicates,skips); - fprintf(stderr," max.off. %.3f corr. %.3f\n",maxoff,correction); - format_time(text,100,offset,error,drift,drifterr,-10); - fprintf(stderr,"%s: %s\n",argv0,text); - maxoff = 0.0; - } - if (current_time(JAN_1970)-previous > count*delay) { - if (verbose) - fprintf(stderr,"%s: no packets in too long a period\n",argv0); - return; - } - -/* Listen for the next broadcast packet. This allows up to ETHERNET_MAX -replications per packet, for systems with multiple addresses for receiving -broadcasts; the only reason for a limit is to protect against broken NTP -servers always returning the same time. */ - - if (operation == op_listen) { - flushes += flush_socket(0); - if (read_packet(0,&data,&offset,&error)) { - ++rejects; - if (++rej_level > count) - fatal(0,"too many bad or lost packets",NULL); - if (action != action_display && drifterr >= 0.0) { - correction += correct_drift(&when,&offset,drift); - handle_saving(save_write,&total,&index,&cycle,record, - &previous,&when,&correction); - } - continue; - } - if ((rej_level -= (count < 5 ? count : 5)) < 0) rej_level = 0; - x = data.transmit; - for (i = 0; i < count; ++i) - if (x == history[i]) { - ++replicates; - if (++rep_level > ETHERNET_MAX) - fatal(0,"too many replicated packets",NULL); - goto continue1; - } - rep_level = 0; - history[item] = x; - if (++item >= count) item = 0; - -/* Accept a packet only after a long enough period has elapsed. */ - - when = data.current; - if (! retry && when < previous+delay) { - if (verbose > 2) fprintf(stderr,"Skipping too recent packet\n"); - ++skips; - continue; - } - retry = 0; - if (verbose > 2) - fprintf(stderr,"Offset=%.6f @ %.6f disp=%.6f\n", - offset,when,dispersion); - -/* Handle the client/server model. It keeps a record of transmitted times, -mainly out of paranoia. The waiting time is kludged up to attempt to provide -reasonable resilience against both lost packets and dead servers. But it -won't handle much of either, and will stop after a while, needing manual -restarting. Running it under cron is the best approach. */ - - } else { - if (! retry) { - if (verbose > 2) fprintf(stderr,"Sleeping for %d\n",waiting); - do_nothing(waiting); - } - make_packet(&data,NTP_CLIENT); - outgoing[item] = data.transmit; - if (++item >= 2*count) item = 0; - if (attempts < 2*count) ++attempts; - if (verbose > 2) { - fprintf(stderr,"Outgoing packet on socket %d:\n",cycle); - display_data(&data); - } - pack_ntp(transmit,NTP_PACKET_MIN,&data); - if (verbose > 2) display_packet(transmit,NTP_PACKET_MIN); - flushes += flush_socket(cycle); - write_socket(cycle,transmit,NTP_PACKET_MIN); - -/* Read the packet and check that it is an appropriate response. Because this -is rather more numerically sensitive than simple resynchronisation, reject all -very inaccurate packets. Be careful if you modify this, because the error -handling is rather nasty to avoid replicating code. */ - - k = read_packet(cycle,&data,&offset,&error); - if (++cycle >= nhosts) cycle = 0; - if (! k) - when = (data.originate+data.current)/2.0; - else if (action != action_display && drifterr >= 0.0) { - correction += correct_drift(&when,&offset,drift); - handle_saving(save_write,&total,&index,&cycle,record, - &previous,&when,&correction); - } - if (! k && ! retry && when < previous+delay-2) { - if (verbose) - fprintf(stderr,"%s: packets out of order on socket %d\n", - argv0,cycle); - k = 1; - } - if (! k && data.current-data.originate > maxerr) { - if (verbose) - fprintf(stderr, - "%s: very slow response rejected on socket %d\n", - argv0,cycle); - k = 1; - } - -/* Count the number of rejected packets and fail if there are too many. */ - - if (k) { - ++rejects; - if (++rej_level > count) - fatal(0,"too many bad or lost packets",NULL); - else { - retry = 1; - continue; - } - } else - retry = 0; - if ((rej_level -= (count < 5 ? count : 5)) < 0) rej_level = 0; - if (verbose > 2) - fprintf(stderr,"Offset=%.6f+/-%.6f @ %.6f disp=%.6f\n", - offset,error,when,dispersion); - } - -/* Calculate the statistics, and display the results or make the initial -correction. Note that estimate_stats() will return zero if a timestamp -indicates synchronisation loss (usually due to down time or a change of server, -somewhere upstream), and that the recovery operation is unstructured, so great -care should be taken when modifying it. Also, we want to clear the saved state -is the statistics are bad. */ - - handle_saving(save_clear,&total,&index,&cycle,record,&previous,&when, - &correction); - ++accepts; - dispersion = data.dispersion; - previous = when = - estimate_stats(&total,&index,record,correction,&dispersion, - &when,&offset,&error,&drift,&drifterr,&waiting,1); - if (verbose > 2) { - fprintf(stderr,"tot=%d ind=%d dis=%.3f when=%.3f off=%.3f ", - total,index,dispersion,when,offset); - fprintf(stderr,"err=%.3f wait=%d\n",error,waiting); - } - if (when == 0.0) return; - x = (maxoff < 0.0 ? -maxoff : maxoff); - if ((offset < 0.0 ? -offset : offset) > x) maxoff = offset; - correction = 0.0; - if (operation == op_client || accepts >= count) { - if (action == action_display) { - format_time(text,100,offset,error,drift,drifterr,-10); - printf("%s\n",text); - } else { - x = reset_clock(offset,error,1); - correction += x; - offset -= x; - } - } else - waiting = delay; - handle_saving(save_write,&total,&index,&cycle,record,&previous,&when, - &correction); - -/* Now correct the clock for a while, before getting another packet and -updating the statistics. */ - - while (when < previous+delay-waiting) { - do_nothing(waiting); - if (action == action_display) - when += waiting; - else { - correction += correct_drift(&when,&offset,drift); - handle_saving(save_write,&total,&index,&cycle,record, - &previous,&when,&correction); - } - } -continue1: ; - } -} - - - -void run_client (char *hostnames[], int nhosts) { - -/* Get enough responses to do something with; or not, as the case may be. Note -that it allows for half of the packets to be bad, so may make up to twice as -many attempts as specified by the -c value. The deadline checking is merely -paranoia, to protect against broken signal handling - it cannot easily be -triggered if the signal handling works. */ - - double history[COUNT_MAX], guesses[COUNT_MAX], offset, error, deadline, - a, b, x, y; - int precs[COUNT_MAX], precision = 0; - int accepts = 0, rejects = 0, flushes = 0, replicates = 0, cycle = 0, k; - unsigned char transmit[NTP_PACKET_MIN]; - ntp_data data; - char text[100]; - - if (verbose > 2) { - format_time(text,50,0.0,-1.0,0.0,-1.0,-10); - fprintf(stderr,"Started=%.6f %s\n",current_time(JAN_1970),text); - } - for (k = 0; k < nhosts; ++k) open_socket(k,hostnames[k],delay); - if (action != action_display) { - set_lock(1); - locked = 1; - } - attempts = 0; - deadline = current_time(JAN_1970)+delay; - -/* Listen to broadcast packets and select the best (i.e. earliest). This will -be sensitive to a bad NTP broadcaster, but I believe such things are very rare -in practice. In any case, if you have one, it is probably the only one on your -subnet, so you are knackered! This allows up to ETHERNET_MAX replications per -packet, for systems with multiple addresses for receiving broadcasts; the only -reason for a limit is to protect against broken NTP servers always returning -the same time. */ - - if (operation == op_listen) { - while (accepts < count) { - if (current_time(JAN_1970) > deadline) - fatal(0,"not enough valid broadcasts received in time",NULL); - flushes += flush_socket(0); - if (read_packet(0,&data,&x,&y)) { - if (++rejects > count) - fatal(0,"too many bad or lost packets",NULL); - else - continue; - } else { - a = data.transmit; - for (k = 0; k < accepts; ++k) - if (a == history[k]) { - if (++replicates > ETHERNET_MAX*count) - fatal(0,"too many replicated packets",NULL); - goto continue1; - } - history[accepts] = a; - precs[accepts] = data.precision; - guesses[accepts++] = x; - } - if (verbose > 2) - fprintf(stderr,"Offset=%.6f disp=%.6f\n",x,dispersion); - else if (verbose > 1) - fprintf(stderr,"%s: offset=%.3f disp=%.3f\n", - argv0,x,dispersion); - -/* Note that bubblesort IS a good method for this amount of data. */ - - for (k = accepts-2; k >= 0; --k) - if (guesses[k] < guesses[k+1]) - break; - else { - x = guesses[k]; - guesses[k] = guesses[k+1]; - guesses[k+1] = x; - precision = precs[k]; - precs[k] = precs[k+1]; - precs[k+1] = precision; - } -continue1: ; - } - offset = guesses[0]; - precision = precs[0]; - error = minerr+guesses[count <= 5 ? count-1 : 5]-offset; - if (verbose > 2) - fprintf(stderr,"accepts=%d rejects=%d flushes=%d replicates=%d\n", - accepts,rejects,flushes,replicates); - -/* Handle the client/server model. It keeps a record of transmitted times, -mainly out of paranoia. */ - - } else { - offset = 0.0; - precision = 0; - error = NTP_INSANITY; - while (accepts < count && attempts < 2*count) { - if (current_time(JAN_1970) > deadline) - fatal(0,"not enough valid responses received in time",NULL); - make_packet(&data,NTP_CLIENT); - precs[attempts] = data.precision; - outgoing[attempts++] = data.transmit; - if (verbose > 2) { - fprintf(stderr,"Outgoing packet on socket %d:\n",cycle); - display_data(&data); - } - pack_ntp(transmit,NTP_PACKET_MIN,&data); - if (verbose > 2) display_packet(transmit,NTP_PACKET_MIN); - flushes += flush_socket(cycle); - write_socket(cycle,transmit,NTP_PACKET_MIN); - if (read_packet(cycle,&data,&x,&y)) { - if (++rejects > count) - fatal(0,"too many bad or lost packets",NULL); - else - continue; - } else - ++accepts; - if (++cycle >= nhosts) cycle = 0; - -/* Work out the most accurate time, and check that it isn't more accurate than -the results warrant. */ - - if (verbose > 2) - fprintf(stderr,"Offset=%.6f+/-%.6f disp=%.6f\n",x,y,dispersion); - else if (verbose > 1) - fprintf(stderr,"%s: offset=%.3f+/-%.3f disp=%.3f\n", - argv0,x,y,dispersion); - if ((a = x-offset) < 0.0) a = -a; - if (accepts <= 1) a = 0.0; - b = error+y; - if (y < error) { - offset = x; - error = y; - precision = data.precision; - } - if (verbose > 2) - fprintf(stderr,"best=%.6f+/-%.6f\n",offset,error); - if (a > b) { - sprintf(text,"%d",cycle); - fatal(0,"inconsistent times got from NTP server on socket %s", - text); - } - if (error <= minerr) break; - } - if (verbose > 2) - fprintf(stderr,"accepts=%d rejects=%d flushes=%d\n", - accepts,rejects,flushes); - } - -/* Tidy up the socket, issues diagnostics and perform the action. */ - - for (k = 0; k < nhosts; ++k) close_socket(k); - if (accepts == 0) fatal(0,"no acceptable packets received",NULL); - if (error > NTP_INSANITY) - fatal(0,"unable to get a reasonable time estimate",NULL); - if (verbose > 2) - fprintf(stderr,"Correction: %.6f +/- %.6f disp=%.6f\n", - offset,error,dispersion); - if (action == action_display) { - format_time(text,75,offset,error,0.0,-1.0,precision); - printf("%s\n",text); - } else - (void)reset_clock(offset,error,0); - if (locked) set_lock(0); - if (verbose > 2) fprintf(stderr,"Stopped normally\n"); - exit(EXIT_SUCCESS); -} - - - -int main (int argc, char *argv[]) { - -/* This is the entry point and all that. It decodes the arguments and calls -one of the specialised routines to do the work. */ - - char *hostnames[MAX_SOCKETS], *savename = NULL; - int daemon = 0, nhosts = 0, help = 0, args = argc-1, k; - char c; - - if (argv[0] == NULL || argv[0][0] == '\0') - argv0 = "sntp"; - else if ((argv0 = strrchr(argv[0],'/')) != NULL) - ++argv0; - else - argv0 = argv[0]; - - setvbuf(stdout,NULL,_IOLBF,BUFSIZ); - setvbuf(stderr,NULL,_IOLBF,BUFSIZ); - - if (INT_MAX < 2147483647) fatal(0,"sntp requires >= 32-bit ints",NULL); - if (DBL_EPSILON > 1.0e-13) - fatal(0,"sntp requires doubles with eps <= 1.0e-13",NULL); - for (k = 0; k < MAX_SOCKETS; ++k) hostnames[k] = NULL; - -/* Decode the arguments. */ - - while (argc > 1) { - k = 1; - if (strcmp(argv[1],"-4") == 0) - preferred_family(PREF_FAM_INET); - else if (strcmp(argv[1],"-6") == 0) - preferred_family(PREF_FAM_INET6); - else if (strcmp(argv[1],"-u") == 0) - ++unprivport; - else if (strcmp(argv[1],"-q") == 0 && action == 0) - action = action_query; - else if (strcmp(argv[1],"-r") == 0 && action == 0) - action = action_reset; - else if (strcmp(argv[1],"-a") == 0 && action == 0) - action = action_adjust; - else if (strcmp(argv[1],"-l") == 0 && lockname == NULL && argc > 2) { - lockname = argv[2]; - k = 2; - } else if ((strcmp(argv[1],"-x") == 0) && - daemon == 0) { - if (argc > 2 && sscanf(argv[2],"%d%c",&daemon,&c) == 1) { - if (daemon < 1 || daemon > 1440) - fatal(0,"%s option value out of range",argv[1]); - k = 2; - } else - daemon = 300; - } else if (strcmp(argv[1],"-f") == 0 && savename == NULL && argc > 2) { - savename = argv[2]; - k = 2; - } else if ((strcmp(argv[1],"--help") == 0 || - strcmp(argv[1],"-h") == 0 || strcmp(argv[1],"-?") == 0) && - help == 0) - help = 1; - else if (strcmp(argv[1],"-v") == 0 && verbose == 0) - verbose = 1; - else if (strcmp(argv[1],"-V") == 0 && verbose == 0) - verbose = 2; - else if (strcmp(argv[1],"-W") == 0 && verbose == 0) - verbose = 3; - else if (strcmp(argv[1],"-e") == 0 && minerr == 0.0 && argc > 2) { - if (sscanf(argv[2],"%lf%c",&minerr,&c) != 1) syntax(1); - if (minerr <= 0.000999999 || minerr > 1.0) - fatal(0,"%s option value out of range","-e"); - k = 2; - } else if (strcmp(argv[1],"-E") == 0 && maxerr == 0.0 && argc > 2) { - if (sscanf(argv[2],"%lf%c",&maxerr,&c) != 1) syntax(1); - if (maxerr < 1.0 || maxerr > 60.0) - fatal(0,"%s option value out of range","-E"); - k = 2; - } else if (strcmp(argv[1],"-P") == 0 && prompt == 0.0 && argc > 2) { - if (strcmp(argv[2],"no") == 0) - prompt = (double)INT_MAX; - else { - if (sscanf(argv[2],"%lf%c",&prompt,&c) != 1) syntax(1); - if (prompt < 1.0 || prompt > 3600.0) - fatal(0,"%s option value out of range","-p"); - } - k = 2; - } else if (strcmp(argv[1],"-d") == 0 && delay == 0 && argc > 2) { - if (sscanf(argv[2],"%d%c",&delay,&c) != 1) syntax(1); - if (delay < 1 || delay > 3600) - fatal(0,"%s option value out of range","-d"); - k = 2; - } else if (strcmp(argv[1],"-c") == 0 && count == 0 && argc > 2) { - if (sscanf(argv[2],"%d%c",&count,&c) != 1) syntax(1); - if (count < 1 || count > COUNT_MAX) - fatal(0,"%s option value out of range","-c"); - k = 2; - } else - break; - argc -= k; - argv += k; - } - -/* Check the arguments for consistency and set the defaults. */ - - if (action == action_query) { - if (argc != 1 || minerr != 0.0 || maxerr != 0.0 || count != 0 || - delay != 0 || daemon != 0 || prompt != 0.0 || lockname != NULL) - syntax(1); - } else { - if (argc < 1 || argc > MAX_SOCKETS || (daemon != 0 && delay != 0)) - syntax(1); - if ((prompt || lockname != NULL) && - action != action_reset && action != action_adjust) - syntax(1); - if (count > 0 && count < argc-1) - fatal(0,"-c value less than number of addresses",NULL); - if (argc > 1) { - operation = op_client; - for (k = 1; k < argc; ++k) { - if (argv[k][0] == '\0' || argv[k][0] == '-') - fatal(0,"invalid Internet address '%s'",argv[k]); - hostnames[k-1] = argv[k]; - } - nhosts = argc-1; - } else { - operation = op_listen; - nhosts = 0; - } - if (action == 0) action = action_display; - if (minerr <= 0.0) minerr = (operation == op_listen ? 0.5 : 0.1); - if (maxerr <= 0.0) maxerr = 5.0; - if (count == 0) count = (argc-1 < 5 ? 5 : argc-1); - if ((argc == 1 || (daemon != 0 && action != action_query)) && count < 5) - fatal(0,"at least 5 packets needed in this mode",NULL); - if ((action == action_reset || action == action_adjust) && - lockname == NULL) - lockname = LOCKNAME; - -/* The '-x' option changes the implications of many other settings, though this -is not usually apparent to the caller. Most of the time delays are to ensure -that stuck states terminate, and do not affect the result. */ - - if (daemon != 0) { - if (minerr >= maxerr || maxerr >= daemon) - fatal(0,"values not in order -e < -E < -x",NULL); - waiting = delay = daemon *= 60; - } else { - if (savename != NULL) - fatal(0,"-f can be specified only with -x",NULL); - if (delay == 0) - delay = (operation == op_listen ? 300 : - (2*count >= 15 ? 2*count+1 :15)); - if (operation == op_listen) { - if (minerr >= maxerr || maxerr >= delay/count) - fatal(0,"values not in order -e < -E < -d/-c",NULL); - } else { - if (minerr >= maxerr || maxerr >= delay) - fatal(0,"values not in order -e < -E < -d",NULL); - } - if (2*count >= delay) fatal(0,"-c must be less than half -d",NULL); - waiting = delay/count; - } - if (prompt == 0.0) prompt = 30.0; - } - if ((daemon || action == action_query) && savename == NULL) - savename = SAVENAME; - -/* Diagnose where we are, if requested, and separate out the classes of -operation. The calls do not return. */ - - if (help) syntax(args == 1); - if (verbose) { - fprintf(stderr,"%s options: a=%d v=%d e=%.3f E=%.3f P=%.3f\n", - argv0,action,verbose,minerr,maxerr,prompt); - fprintf(stderr," d=%d c=%d %c=%d op=%d l=%s f=%s", - delay,count,'x',daemon,operation, - (lockname == NULL ? "" : lockname), - (savename == NULL ? "" : savename)); - for (k = 0; k < MAX_SOCKETS; ++k) - if (hostnames[k] != NULL) fprintf(stderr," %s",hostnames[k]); - fprintf(stderr,"\n"); - } - if (nhosts == 0) nhosts = 1; /* Kludge for broadcasts */ - if (action == action_query) { - if (savename == NULL || savename[0] == '\0') - fatal(0,"no daemon save file specified",NULL); - else if ((savefile = fopen(savename,"rb")) == NULL) - fatal(0,"unable to open the daemon save file",NULL); - query_savefile(); - } else if (daemon != 0) { - if (savename != NULL && savename[0] != '\0' && - (savefile = fopen(savename,"rb+")) == NULL && - (savefile = fopen(savename,"wb+")) == NULL) - fatal(0,"unable to open the daemon save file",NULL); - run_daemon(hostnames,nhosts,1); - while (1) run_daemon(hostnames,nhosts,0); - } else - run_client(hostnames,nhosts); - fatal(0,"internal error at end of main",NULL); - return EXIT_FAILURE; +/* set_time corrects the local clock by offset with either settimeofday() or by default + * with adjtime()/adjusttimeofday(). + */ +int +set_time( + double offset + ) +{ + struct timeval tp; + + if (ENABLED_OPT(SETTOD)) { + GETTIMEOFDAY(&tp, NULL); + + tp.tv_sec += (long)offset; + tp.tv_usec += 1e6 * (offset - (long)offset); + NORMALIZE_TIMEVAL(tp); + + if (SETTIMEOFDAY(&tp, NULL) < 0) { + msyslog(LOG_ERR, "Time not set: settimeofday(): %m"); + return -1; + } + return 0; + } + + tp.tv_sec = (long)offset; + tp.tv_usec = 1e6 * (offset - (long)offset); + NORMALIZE_TIMEVAL(tp); + + if (ADJTIMEOFDAY(&tp, NULL) < 0) { + msyslog(LOG_ERR, "Time not set: adjtime(): %m"); + return -1; + } + return 0; } diff --git a/sntp/main.h b/sntp/main.h new file mode 100644 index 0000000..e6965e1 --- /dev/null +++ b/sntp/main.h @@ -0,0 +1,28 @@ +#ifndef MAIN_H +#define MAIN_H + +#include <l_stdlib.h> +#include <ntp_fp.h> +#include <ntp.h> +#include <ntp_stdlib.h> +#include <ntp_unixtime.h> +#include <isc/result.h> +#include <isc/net.h> +#include <stdio.h> + +#include <sntp-opts.h> + +#include "crypto.h" + +void set_li_vn_mode (struct pkt *spkt, char leap, char version, char mode); +int sntp_main (int argc, char **argv); +int generate_pkt (struct pkt *x_pkt, const struct timeval *tv_xmt, + int key_id, struct key *pkt_key); +int handle_pkt (int rpktl, struct pkt *rpkt, struct addrinfo *host); +void offset_calculation (struct pkt *rpkt, int rpktl, struct timeval *tv_dst, + double *offset, double *precision, + double *root_dispersion); +int on_wire (struct addrinfo *host, struct addrinfo *bcastaddr); +int set_time (double offset); + +#endif /* MAIN_H */ diff --git a/sntp/networking.c b/sntp/networking.c new file mode 100644 index 0000000..31bc5f8 --- /dev/null +++ b/sntp/networking.c @@ -0,0 +1,536 @@ +#include <config.h> +#include "networking.h" + +char adr_buf[INET6_ADDRSTRLEN]; + + +/* resolve_hosts consumes an array of hostnames/addresses and its length, stores a pointer + * to the array with the resolved hosts in res and returns the size of the array res. + * pref_family enforces IPv4 or IPv6 depending on commandline options and system + * capability. If pref_family is NULL or PF_UNSPEC any compatible family will be accepted. + * Check here: Probably getaddrinfo() can do without ISC's IPv6 availability check? + */ +int +resolve_hosts ( + const char **hosts, + int hostc, + struct addrinfo ***res, + int pref_family + ) +{ + register unsigned int a; + unsigned int resc; + struct addrinfo **tres; + + if (hostc < 1 || NULL == res) + return 0; + + tres = emalloc(sizeof(struct addrinfo *) * hostc); + for (a = 0, resc = 0; a < hostc; a++) { + struct addrinfo hints; + int error; + + tres[resc] = NULL; +#ifdef DEBUG + printf("sntp resolve_hosts: Starting host resolution for %s...\n", hosts[a]); +#endif + memset(&hints, 0, sizeof(hints)); + if (AF_UNSPEC == pref_family) + hints.ai_family = PF_UNSPEC; + else + hints.ai_family = pref_family; + hints.ai_socktype = SOCK_DGRAM; + error = getaddrinfo(hosts[a], "123", &hints, &tres[resc]); + if (error) { + msyslog(LOG_DEBUG, "Error looking up %s%s: %s", + (AF_UNSPEC == hints.ai_family) + ? "" + : (AF_INET == hints.ai_family) + ? "(A) " + : "(AAAA) ", + hosts[a], gai_strerror(error)); + } else { +#ifdef DEBUG + for (dres = tres[resc]; dres; dres = dres->ai_next) { + getnameinfo(dres->ai_addr, dres->ai_addrlen, adr_buf, sizeof(adr_buf), NULL, 0, NI_NUMERICHOST); + STDLINE + printf("Resolv No.: %i Result of getaddrinfo for %s:\n", resc, hosts[a]); + printf("socktype: %i ", dres->ai_socktype); + printf("protocol: %i ", dres->ai_protocol); + printf("Prefered socktype: %i IP: %s\n", dres->ai_socktype, adr_buf); + STDLINE + } +#endif + resc++; + } + } + + if (resc) + *res = realloc(tres, sizeof(struct addrinfo *) * resc); + else { + free(tres); + *res = NULL; + } + return resc; +} + +/* Creates a socket and returns. */ +void +create_socket ( + SOCKET *rsock, + sockaddr_u *dest + ) +{ + *rsock = socket(AF(dest), SOCK_DGRAM, 0); + + if (-1 == *rsock && ENABLED_OPT(NORMALVERBOSE)) + printf("Failed to create UDP socket with family %d\n", AF(dest)); +} + +/* Send a packet */ +void +sendpkt ( + SOCKET rsock, + sockaddr_u *dest, + struct pkt *pkt, + int len + ) +{ + int cc; + +#ifdef DEBUG + printf("sntp sendpkt: Packet data:\n"); + pkt_output(pkt, len, stdout); +#endif + + if (ENABLED_OPT(NORMALVERBOSE)) { + getnameinfo(&dest->sa, SOCKLEN(dest), adr_buf, sizeof(adr_buf), NULL, 0, NI_NUMERICHOST); + printf("sntp sendpkt: Sending packet to %s... ", adr_buf); + } + + cc = sendto(rsock, (void *)pkt, len, 0, &dest->sa, SOCKLEN(dest)); + if (cc == SOCKET_ERROR) { +#ifdef DEBUG + printf("\n sntp sendpkt: Socket error: %i. Couldn't send packet!\n", cc); +#endif + if (errno != EWOULDBLOCK && errno != ENOBUFS) { + /* oh well */ + } + } else if (ENABLED_OPT(NORMALVERBOSE)) { + printf("Packet sent.\n"); + } +} + +/* Receive raw data */ +int +recvdata( + SOCKET rsock, + sockaddr_u *sender, + char *rdata, + int rdata_length + ) +{ + GETSOCKNAME_SOCKLEN_TYPE slen; + int recvc; + +#ifdef DEBUG + printf("sntp recvdata: Trying to receive data from...\n"); +#endif + slen = sizeof(*sender); + recvc = recvfrom(rsock, rdata, rdata_length, 0, + &sender->sa, &slen); +#ifdef DEBUG + if (recvc > 0) { + printf("Received %d bytes from %s:\n", recvc, stoa(sender)); + pkt_output((struct pkt *) rdata, recvc, stdout); + } else { + saved_errno = errno; + printf("recvfrom error %d (%s)\n", errno, strerror(errno)); + errno = saved_errno; + } +#endif + return recvc; +} + +/* Receive data from broadcast. Couldn't finish that. Need to do some digging + * here, especially for protocol independence and IPv6 multicast */ +int +recv_bcst_data ( + SOCKET rsock, + char *rdata, + int rdata_len, + sockaddr_u *sas, + sockaddr_u *ras + ) +{ + char *buf; + int btrue = 1; + int recv_bytes = 0; + int rdy_socks; + GETSOCKNAME_SOCKLEN_TYPE ss_len; + struct timeval timeout_tv; + fd_set bcst_fd; +#ifdef MCAST + struct ip_mreq mdevadr; + TYPEOF_IP_MULTICAST_LOOP mtrue = 1; +#endif +#ifdef INCLUDE_IPV6_MULTICAST_SUPPORT + struct ipv6_mreq mdevadr6; +#endif + + setsockopt(rsock, SOL_SOCKET, SO_REUSEADDR, &btrue, sizeof(btrue)); + if (IS_IPV4(sas)) { + if (bind(rsock, &sas->sa, SOCKLEN(sas)) < 0) { + if (ENABLED_OPT(NORMALVERBOSE)) + printf("sntp recv_bcst_data: Couldn't bind() address %s:%d.\n", + stoa(sas), SRCPORT(sas)); + } + +#ifdef MCAST + if (setsockopt(rsock, IPPROTO_IP, IP_MULTICAST_LOOP, &mtrue, sizeof(mtrue)) < 0) { + /* some error message regarding setting up multicast loop */ + return BROADCAST_FAILED; + } + mdevadr.imr_multiaddr.s_addr = NSRCADR(sas); + mdevadr.imr_interface.s_addr = htonl(INADDR_ANY); + if (mdevadr.imr_multiaddr.s_addr == -1) { + if (ENABLED_OPT(NORMALVERBOSE)) { + printf("sntp recv_bcst_data: %s:%d is not a broad-/multicast address, aborting...\n", + stoa(sas), SRCPORT(sas)); + } + return BROADCAST_FAILED; + } + if (setsockopt(rsock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mdevadr, sizeof(mdevadr)) < 0) { + if (ENABLED_OPT(NORMALVERBOSE)) { + buf = ss_to_str(sas); + printf("sntp recv_bcst_data: Couldn't add IP membership for %s\n", buf); + free(buf); + } + } +#endif /* MCAST */ + } +#ifdef ISC_PLATFORM_HAVEIPV6 + else if (IS_IPV6(sas)) { + if (bind(rsock, &sas->sa, SOCKLEN(sas)) < 0) { + if (ENABLED_OPT(NORMALVERBOSE)) + printf("sntp recv_bcst_data: Couldn't bind() address.\n"); + } +#ifdef INCLUDE_IPV6_MULTICAST_SUPPORT + if (setsockopt(rsock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &btrue, sizeof (btrue)) < 0) { + /* some error message regarding setting up multicast loop */ + return BROADCAST_FAILED; + } + memset(&mdevadr6, 0, sizeof(mdevadr6)); + mdevadr6.ipv6mr_multiaddr = SOCK_ADDR6(sas); + if (!IN6_IS_ADDR_MULTICAST(&mdevadr6.ipv6mr_multiaddr)) { + if (ENABLED_OPT(NORMALVERBOSE)) { + buf = ss_to_str(sas); + printf("sntp recv_bcst_data: %s is not a broad-/multicast address, aborting...\n", buf); + free(buf); + } + return BROADCAST_FAILED; + } + if (setsockopt(rsock, IPPROTO_IPV6, IPV6_JOIN_GROUP, + &mdevadr6, sizeof(mdevadr6)) < 0) { + if (ENABLED_OPT(NORMALVERBOSE)) { + buf = ss_to_str(sas); + printf("sntp recv_bcst_data: Couldn't join group for %s\n", buf); + free(buf); + } + } +#endif /* INCLUDE_IPV6_MULTICAST_SUPPORT */ + } +#endif /* ISC_PLATFORM_HAVEIPV6 */ + FD_ZERO(&bcst_fd); + FD_SET(rsock, &bcst_fd); + if (ENABLED_OPT(TIMEOUT)) + timeout_tv.tv_sec = (int) OPT_ARG(TIMEOUT); + else + timeout_tv.tv_sec = 68; /* ntpd broadcasts every 64s */ + timeout_tv.tv_usec = 0; + rdy_socks = select(rsock + 1, &bcst_fd, 0, 0, &timeout_tv); + switch (rdy_socks) { + case -1: + if (ENABLED_OPT(NORMALVERBOSE)) + perror("sntp recv_bcst_data: select()"); + return BROADCAST_FAILED; + break; + case 0: + if (ENABLED_OPT(NORMALVERBOSE)) + printf("sntp recv_bcst_data: select() reached timeout (%u sec), aborting.\n", + (unsigned)timeout_tv.tv_sec); + return BROADCAST_FAILED; + break; + default: + ss_len = sizeof(*ras); + recv_bytes = recvfrom(rsock, rdata, rdata_len, 0, &ras->sa, &ss_len); + break; + } + if (recv_bytes == -1) { + if (ENABLED_OPT(NORMALVERBOSE)) + perror("sntp recv_bcst_data: recvfrom:"); + recv_bytes = BROADCAST_FAILED; + } +#ifdef MCAST + if (IS_IPV4(sas)) + setsockopt(rsock, IPPROTO_IP, IP_DROP_MEMBERSHIP, &btrue, sizeof(btrue)); +#endif +#ifdef INCLUDE_IPV6_MULTICAST_SUPPORT + if (IS_IPV6(sas)) + setsockopt(rsock, IPPROTO_IPV6, IPV6_LEAVE_GROUP, &btrue, sizeof(btrue)); +#endif + return recv_bytes; +} + +int +process_pkt ( + struct pkt *rpkt, + sockaddr_u *sas, + int pkt_len, + int mode, + struct pkt *spkt, + char * func_name + ) +{ + unsigned int key_id = 0; + struct key *pkt_key = NULL; + int is_authentic = 0; + unsigned int exten_words, exten_words_used = 0; + int mac_size; + /* + * Parse the extension field if present. We figure out whether + * an extension field is present by measuring the MAC size. If + * the number of words following the packet header is 0, no MAC + * is present and the packet is not authenticated. If 1, the + * packet is a crypto-NAK; if 3, the packet is authenticated + * with DES; if 5, the packet is authenticated with MD5; if 6, + * the packet is authenticated with SHA. If 2 or 4, the packet + * is a runt and discarded forthwith. If greater than 6, an + * extension field is present, so we subtract the length of the + * field and go around again. + */ + if (pkt_len < LEN_PKT_NOMAC || (pkt_len & 3) != 0) { +unusable: + if (ENABLED_OPT(NORMALVERBOSE)) + printf("sntp %s: Funny packet length: %i. Discarding package.\n", func_name, pkt_len); + return PACKET_UNUSEABLE; + } + /* skip past the extensions, if any */ + exten_words = ((unsigned)pkt_len - LEN_PKT_NOMAC) >> 2; + while (exten_words > 6) { + unsigned int exten_len; + exten_len = ntohl(rpkt->exten[exten_words_used]) & 0xffff; + exten_len = (exten_len + 7) >> 2; /* convert to words, add 1 */ + if (exten_len > exten_words || exten_len < 5) + goto unusable; + exten_words -= exten_len; + exten_words_used += exten_len; + } + + switch (exten_words) { + case 1: + key_id = ntohl(rpkt->exten[exten_words_used]); + printf("Crypto NAK = 0x%08x\n", key_id); + break; + case 5: + case 6: + /* Look for the key used by the server in the specified keyfile + * and if existent, fetch it or else leave the pointer untouched */ + key_id = ntohl(rpkt->exten[exten_words_used]); + get_key(key_id, &pkt_key); + if (!pkt_key) { + printf("unrecognized key ID = 0x%08x\n", key_id); + break; + } + /* Seems like we've got a key with matching keyid */ + /* Generate a md5sum of the packet with the key from our keyfile + * and compare those md5sums */ + mac_size = exten_words << 2; + if (!auth_md5((char *)rpkt, pkt_len - mac_size, mac_size - 4, pkt_key)) { + break; + } + /* Yay! Things worked out! */ + if (ENABLED_OPT(NORMALVERBOSE)) { + char *hostname = ss_to_str(sas); + printf("sntp %s: packet received from %s successfully authenticated using key id %i.\n", + func_name, hostname, key_id); + free(hostname); + } + is_authentic = 1; + break; + case 0: + break; + default: + goto unusable; + break; + } + if (!is_authentic) { + if (ENABLED_OPT(AUTHENTICATION)) { + /* We want a authenticated packet */ + if (ENABLED_OPT(NORMALVERBOSE)) { + char *hostname = ss_to_str(sas); + printf("sntp %s: packet received from %s is not authentic. Will discard it.\n", + func_name, hostname); + free(hostname); + } + return SERVER_AUTH_FAIL; + } + /* We don't know if the user wanted authentication so let's + * use it anyways */ + if (ENABLED_OPT(NORMALVERBOSE)) { + char *hostname = ss_to_str(sas); + printf("sntp %s: packet received from %s is not authentic. Authentication not enforced.\n", + func_name, hostname); + free(hostname); + } + } + /* Check for server's ntp version */ + if (PKT_VERSION(rpkt->li_vn_mode) < NTP_OLDVERSION || + PKT_VERSION(rpkt->li_vn_mode) > NTP_VERSION) { + if (ENABLED_OPT(NORMALVERBOSE)) + printf("sntp %s: Packet shows wrong version (%i)\n", + func_name, PKT_VERSION(rpkt->li_vn_mode)); + return SERVER_UNUSEABLE; + } + /* We want a server to sync with */ + if (PKT_MODE(rpkt->li_vn_mode) != mode && + PKT_MODE(rpkt->li_vn_mode) != MODE_PASSIVE) { + if (ENABLED_OPT(NORMALVERBOSE)) + printf("sntp %s: mode %d stratum %i\n", func_name, + PKT_MODE(rpkt->li_vn_mode), rpkt->stratum); + return SERVER_UNUSEABLE; + } + /* Stratum is unspecified (0) check what's going on */ + if (STRATUM_PKT_UNSPEC == rpkt->stratum) { + char *ref_char; + if (ENABLED_OPT(NORMALVERBOSE)) + printf("sntp %s: Stratum unspecified, going to check for KOD (stratum: %i)\n", + func_name, rpkt->stratum); + ref_char = (char *) &rpkt->refid; + if (ENABLED_OPT(NORMALVERBOSE)) + printf("sntp %s: Packet refid: %c%c%c%c\n", func_name, + ref_char[0], ref_char[1], ref_char[2], ref_char[3]); + /* If it's a KOD packet we'll just use the KOD information */ + if (ref_char[0] != 'X') { + if (strncmp(ref_char, "DENY", 4) == 0) + return KOD_DEMOBILIZE; + if (strncmp(ref_char, "RSTR", 4) == 0) + return KOD_DEMOBILIZE; + if (strncmp(ref_char, "RATE", 4) == 0) + return KOD_RATE; + /* There are other interesting kiss codes which might be interesting for authentication */ + } + } + /* If the server is not synced it's not really useable for us */ + if (LEAP_NOTINSYNC == PKT_LEAP(rpkt->li_vn_mode)) { + if (ENABLED_OPT(NORMALVERBOSE)) + printf("sntp %s: Server not in sync, skipping this server\n", func_name); + return SERVER_UNUSEABLE; + } + + /* + * Decode the org timestamp and make sure we're getting a response + * to our last request, but only if we're not in broadcast mode. + */ +#ifdef DEBUG + printf("rpkt->org:\n"); + l_fp_output(&rpkt->org, stdout); + printf("spkt->xmt:\n"); + l_fp_output(&spkt->xmt, stdout); +#endif + if (mode != MODE_BROADCAST && !L_ISEQU(&rpkt->org, &spkt->xmt)) { + if (ENABLED_OPT(NORMALVERBOSE)) + printf("sntp process_pkt: pkt.org and peer.xmt differ\n"); + return PACKET_UNUSEABLE; + } + + return pkt_len; +} + +int +recv_bcst_pkt ( + SOCKET rsock, + struct pkt *rpkt, + unsigned int rsize, + sockaddr_u *sas + ) +{ + sockaddr_u sender; + int pkt_len = recv_bcst_data(rsock, (char *)rpkt, rsize, sas, &sender); + if (pkt_len < 0) { + return BROADCAST_FAILED; + } + pkt_len = process_pkt(rpkt, sas, pkt_len, MODE_BROADCAST, NULL, "recv_bcst_pkt"); + return pkt_len; +} + +/* Fetch data, check if it's data for us and whether it's useable or not. If not, return + * a failure code so we can delete this server from our list and continue with another one. + */ +int +recvpkt ( + SOCKET rsock, + struct pkt *rpkt, /* received packet (response) */ + unsigned int rsize, /* size of rpkt buffer */ + struct pkt *spkt /* sent packet (request) */ + ) +{ + int rdy_socks; + int pkt_len; + sockaddr_u sender; + struct timeval timeout_tv; + fd_set recv_fd; + + FD_ZERO(&recv_fd); + FD_SET(rsock, &recv_fd); + if (ENABLED_OPT(TIMEOUT)) + timeout_tv.tv_sec = (int) OPT_ARG(TIMEOUT); + else + timeout_tv.tv_sec = 68; /* ntpd broadcasts every 64s */ + timeout_tv.tv_usec = 0; + rdy_socks = select(rsock + 1, &recv_fd, 0, 0, &timeout_tv); + switch (rdy_socks) { + case -1: + if (ENABLED_OPT(NORMALVERBOSE)) + perror("sntp recvpkt: select()"); + return PACKET_UNUSEABLE; + break; + case 0: + if (ENABLED_OPT(NORMALVERBOSE)) + printf("sntp recvpkt: select() reached timeout (%u sec), aborting.\n", + (unsigned)timeout_tv.tv_sec); + return PACKET_UNUSEABLE; + break; + default: + break; + } + pkt_len = recvdata(rsock, &sender, (char *)rpkt, rsize); + if (pkt_len > 0) + pkt_len = process_pkt(rpkt, &sender, pkt_len, MODE_SERVER, spkt, "recvpkt"); + + return pkt_len; +} + +/* + * is_reachable - check to see if we have a route to given destination + */ +int +is_reachable ( + struct addrinfo *dst + ) +{ + SOCKET sockfd = socket(dst->ai_family, SOCK_DGRAM, 0); + + if (-1 == sockfd) { +#ifdef DEBUG + printf("is_reachable: Couldn't create socket\n"); +#endif + return 0; + } + if (connect(sockfd, dst->ai_addr, SOCKLEN((sockaddr_u *)dst->ai_addr))) { + closesocket(sockfd); + return 0; + } + closesocket(sockfd); + return 1; +} diff --git a/sntp/networking.h b/sntp/networking.h new file mode 100644 index 0000000..8cb72c4 --- /dev/null +++ b/sntp/networking.h @@ -0,0 +1,129 @@ +#ifndef NETWORKING_H +#define NETWORKING_H + +#include <arpa/inet.h> +#include <netinet/in.h> + +#include <strings.h> +#include <errno.h> +#include <config.h> +#include <netdb.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/socket.h> + +#include <ntp_rfc2553.h> +#include <ntp_stdlib.h> +#include <ntp_machine.h> +#include <ntp_unixtime.h> +#include <ntp_fp.h> +#include <ntp.h> + +#include "crypto.h" +#include "log.h" +#include "sntp-opts.h" +#include "utilities.h" + +/* + * for 4.2.6 only define AUTOKEY if OPENSSL, so that backported 4.2.7 + * references to AUTOKEY work -- in 4.2.7 AUTOKEY is independent of OPENSSL + */ +#ifdef OPENSSL +#define AUTOKEY +#endif + +/* FIXME To be replaced by the constants in ntp.h */ +#define SERVER_UNUSEABLE -1 /* Skip server */ +#define PACKET_UNUSEABLE -2 /* Discard packet and try to get a useable packet again if not tried too often */ +#define SERVER_AUTH_FAIL -3 /* Authentication failed, act upon settings */ +#define KOD_DEMOBILIZE -4 /* KOD packet with code DENY or RSTR, stop all communication and save KOD information */ +#define KOD_RATE -5 /* KOD packet with code RATE, reduce poll intervall */ +#define BROADCAST_FAILED -6 + + +/* From ntpdate.c */ +int is_reachable (struct addrinfo *dst); + +int resolve_hosts (const char **hosts, int hostc, struct addrinfo ***res, int pref_family); + +void create_socket (SOCKET *rsock, sockaddr_u *dest); + +void sendpkt (SOCKET rsock, sockaddr_u *dest, struct pkt *pkt, int len); + +int recvdata (SOCKET rsock, sockaddr_u *sender, char *rdata, int rdata_len); + +int recvpkt (SOCKET rsock, struct pkt *rpkt, unsigned int rsize, struct pkt *spkt); + +int recv_bcst_data (SOCKET rsock, char *rdata, int rdata_len, sockaddr_u *sas, sockaddr_u *ras); + +int recv_bcst_pkt (SOCKET rsock, struct pkt *rpkt, unsigned int rsize, sockaddr_u *sas); + +int process_pkt (struct pkt *rpkt, sockaddr_u *sas, int pkt_len, int mode, struct pkt *spkt, char * func_name); + +/* Shortened peer structure. Not absolutely necessary yet */ +struct speer { + struct speer *next; + sockaddr_u srcadr; + u_char version; + u_char hmode; + u_char hpoll; + u_char minpoll; + u_char maxpoll; + u_int flags; + u_char num_events; + u_char ttl; + u_char leap; + u_char pmode; + u_char stratum; + u_char ppoll; + u_char precision; /* should be s_char */ + u_int32 refid; + l_fp reftime; + keyid_t keyid; + +#ifdef AUTOKEY +#define clear_to_zero opcode + u_int32 opcode; /* last request opcode */ + associd_t assoc; /* peer association ID */ + u_int32 crypto; /* peer status word */ + EVP_PKEY *pkey; /* public key */ + const EVP_MD *digest; /* message digest algorithm */ + char *subject; /* certificate subject name */ + char *issuer; /* certificate issuer name */ + struct cert_info *xinfo; /* issuer certificate */ + keyid_t pkeyid; /* previous key ID */ + keyid_t hcookie; /* host cookie */ + keyid_t pcookie; /* peer cookie */ + const struct pkey_info *ident_pkey; /* identity key */ + BIGNUM *iffval; /* identity challenge (IFF, GQ, MV) */ + const BIGNUM *grpkey; /* identity challenge key (GQ) */ + struct value cookval; /* receive cookie values */ + struct value recval; /* receive autokey values */ + struct exten *cmmd; /* extension pointer */ + u_long refresh; /* next refresh epoch */ + + /* + * Variables used by authenticated server + */ + keyid_t *keylist; /* session key ID list */ + int keynumber; /* current key number */ + struct value encrypt; /* send encrypt values */ + struct value sndval; /* send autokey values */ +#else /* !AUTOKEY follows */ +#define clear_to_zero status +#endif /* !AUTOKEY */ + + l_fp rec; /* receive time stamp */ + l_fp xmt; /* transmit time stamp */ + l_fp dst; /* destination timestamp */ + l_fp aorg; /* origin timestamp */ + l_fp borg; /* alternate origin timestamp */ + double offset; /* peer clock offset */ + double delay; /* peer roundtrip delay */ +}; + + + + + +#endif diff --git a/sntp/sntp-opts.c b/sntp/sntp-opts.c index 37c4e7c..bc657b8 100644 --- a/sntp/sntp-opts.c +++ b/sntp/sntp-opts.c @@ -1,110 +1,31 @@ /* * EDIT THIS FILE WITH CAUTION (sntp-opts.c) * - * It has been AutoGen-ed Tuesday December 8, 2009 at 08:14:49 AM EST + * It has been AutoGen-ed December 24, 2011 at 06:33:53 PM by AutoGen 5.12 * From the definitions sntp-opts.def * and the template file options * - * Generated from AutoOpts 29:0:4 templates. - */ - -/* - * This file was produced by an AutoOpts template. AutoOpts is a - * copyrighted work. This source file is not encumbered by AutoOpts - * licensing, but is provided under the licensing terms chosen by the - * sntp author or copyright holder. AutoOpts is licensed under - * the terms of the LGPL. The redistributable library (``libopts'') is - * licensed under the terms of either the LGPL or, at the users discretion, - * the BSD license. See the AutoOpts and/or libopts sources for details. + * Generated from AutoOpts 35:0:10 templates. * - * This source file is copyrighted and licensed under the following terms: + * AutoOpts is a copyrighted work. This source file is not encumbered + * by AutoOpts licensing, but is provided under the licensing terms chosen + * by the sntp author or copyright holder. AutoOpts is + * licensed under the terms of the LGPL. The redistributable library + * (``libopts'') is licensed under the terms of either the LGPL or, at the + * users discretion, the BSD license. See the AutoOpts and/or libopts sources + * for details. * - * sntp copyright 1970-2006 ntp.org - all rights reserved + * This source file is copyrighted and licensed under the following terms: * - * General Public Licence for the software known as MSNTP - * ------------------------------------------------------ - * - * (c) Copyright, N.M. Maclaren, 1996, 1997, 2000 - * (c) Copyright, University of Cambridge, 1996, 1997, 2000 - * - * - * - * Free use of MSNTP in source and binary forms is permitted, provided that this - * entire licence is duplicated in all copies, and that any documentation, - * announcements, and other materials related to use acknowledge that the software - * was developed by N.M. Maclaren (hereafter refered to as the Author) at the - * University of Cambridge. Neither the name of the Author nor the University of - * Cambridge may be used to endorse or promote products derived from this material - * without specific prior written permission. - * - * The Author and the University of Cambridge retain the copyright and all other - * legal rights to the software and make it available non-exclusively. All users - * must ensure that the software in all its derivations carries a copyright notice - * in the form: - * (c) Copyright N.M. Maclaren, - * (c) Copyright University of Cambridge. - * - * - * - * NO WARRANTY - * - * Because the MSNTP software is licensed free of charge, the Author and the - * University of Cambridge provide absolutely no warranty, either expressed or - * implied, including, but not limited to, the implied warranties of - * merchantability and fitness for a particular purpose. The entire risk as to - * the quality and performance of the MSNTP software is with you. Should MSNTP - * prove defective, you assume the cost of all necessary servicing or repair. - * - * In no event, unless required by law, will the Author or the University of - * Cambridge, or any other party who may modify and redistribute this software as - * permitted in accordance with the provisions below, be liable for damages for - * any losses whatsoever, including but not limited to lost profits, lost monies, - * lost or corrupted data, or other special, incidental or consequential losses - * that may arise out of the use or inability to use the MSNTP software. - * - * - * - * COPYING POLICY - * - * Permission is hereby granted for copying and distribution of copies of the - * MSNTP source and binary files, and of any part thereof, subject to the - * following licence conditions: - * - * 1. You may distribute MSNTP or components of MSNTP, with or without additions - * developed by you or by others. No charge, other than an "at-cost" distribution - * fee, may be charged for copies, derivations, or distributions of this material - * without the express written consent of the copyright holders. - * - * 2. You may also distribute MSNTP along with any other product for sale, - * provided that the cost of the bundled package is the same regardless of whether - * MSNTP is included or not, and provided that those interested only in MSNTP must - * be notified that it is a product freely available from the University of - * Cambridge. - * - * 3. If you distribute MSNTP software or parts of MSNTP, with or without - * additions developed by you or others, then you must either make available the - * source to all portions of the MSNTP system (exclusive of any additions made by - * you or by others) upon request, or instead you may notify anyone requesting - * source that it is freely available from the University of Cambridge. - * - * 4. You may not omit any of the copyright notices on either the source files, - * the executable files, or the documentation. - * - * 5. You may not omit transmission of this License agreement with whatever - * portions of MSNTP that are distributed. - * - * 6. Any users of this software must be notified that it is without warranty or - * guarantee of any nature, express or implied, nor is there any fitness for use - * represented. - * - * - * October 1996 - * April 1997 - * October 2000 + * see html/copyright.html + * */ +#include <sys/types.h> #include <limits.h> +#include <stdio.h> +#include <stdlib.h> #define OPTION_CODE_COMPILE 1 #include "sntp-opts.h" @@ -112,198 +33,190 @@ #ifdef __cplusplus extern "C" { #endif -tSCC zCopyright[] = - "sntp copyright (c) 1970-2006 ntp.org, all rights reserved"; -tSCC zCopyrightNotice[] = - -/* extracted from sntp-opts.def near line 12 */ -" General Public Licence for the software known as MSNTP\n\ - ------------------------------------------------------\n\n\ -\t (c) Copyright, N.M. Maclaren, 1996, 1997, 2000\n\ -\t (c) Copyright, University of Cambridge, 1996, 1997, 2000\n\n\n\n\ -Free use of MSNTP in source and binary forms is permitted, provided that this\n\ -entire licence is duplicated in all copies, and that any documentation,\n\ -announcements, and other materials related to use acknowledge that the software\n\ -was developed by N.M. Maclaren (hereafter refered to as the Author) at the\n\ -University of Cambridge. Neither the name of the Author nor the University of\n\ -Cambridge may be used to endorse or promote products derived from this material\n\ -without specific prior written permission.\n\n\ -The Author and the University of Cambridge retain the copyright and all other\n\ -legal rights to the software and make it available non-exclusively. All users\n\ -must ensure that the software in all its derivations carries a copyright notice\n\ -in the form:\n\ -\t (c) Copyright N.M. Maclaren,\n\ -\t (c) Copyright University of Cambridge.\n\n\n\n\ - NO WARRANTY\n\n\ -Because the MSNTP software is licensed free of charge, the Author and the\n\ -University of Cambridge provide absolutely no warranty, either expressed or\n\ -implied, including, but not limited to, the implied warranties of\n\ -merchantability and fitness for a particular purpose. The entire risk as to\n\ -the quality and performance of the MSNTP software is with you. Should MSNTP\n\ -prove defective, you assume the cost of all necessary servicing or repair.\n\n\ -In no event, unless required by law, will the Author or the University of\n\ -Cambridge, or any other party who may modify and redistribute this software as\n\ -permitted in accordance with the provisions below, be liable for damages for\n\ -any losses whatsoever, including but not limited to lost profits, lost monies,\n\ -lost or corrupted data, or other special, incidental or consequential losses\n\ -that may arise out of the use or inability to use the MSNTP software.\n\n\n\n\ - COPYING POLICY\n\n\ -Permission is hereby granted for copying and distribution of copies of the\n\ -MSNTP source and binary files, and of any part thereof, subject to the\n\ -following licence conditions:\n\n\ -1. You may distribute MSNTP or components of MSNTP, with or without additions\n\ -developed by you or by others. No charge, other than an \"at-cost\" distribution\n\ -fee, may be charged for copies, derivations, or distributions of this material\n\ -without the express written consent of the copyright holders.\n\n\ -2. You may also distribute MSNTP along with any other product for sale,\n\ -provided that the cost of the bundled package is the same regardless of whether\n\ -MSNTP is included or not, and provided that those interested only in MSNTP must\n\ -be notified that it is a product freely available from the University of\n\ -Cambridge.\n\n\ -3. If you distribute MSNTP software or parts of MSNTP, with or without\n\ -additions developed by you or others, then you must either make available the\n\ -source to all portions of the MSNTP system (exclusive of any additions made by\n\ -you or by others) upon request, or instead you may notify anyone requesting\n\ -source that it is freely available from the University of Cambridge.\n\n\ -4. You may not omit any of the copyright notices on either the source files,\n\ -the executable files, or the documentation.\n\n\ -5. You may not omit transmission of this License agreement with whatever\n\ -portions of MSNTP that are distributed.\n\n\ -6. Any users of this software must be notified that it is without warranty or\n\ -guarantee of any nature, express or implied, nor is there any fitness for use\n\ -represented.\n\n\n\ -October 1996\n\ -April 1997\n\ -October 2000"; +extern FILE * option_usage_fp; + +/* TRANSLATORS: choose the translation for option names wisely because you + cannot ever change your mind. */ +static char const zCopyright[38] = +"sntp 4.2.6p5\n\ +see html/copyright.html\n"; +static char const zLicenseDescrip[25] = +"see html/copyright.html\n"; + extern tUsageProc optionUsage; #ifndef NULL # define NULL 0 #endif -#ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -#endif -#ifndef EXIT_FAILURE -# define EXIT_FAILURE 1 -#endif + /* - * Ipv4 option description: + * Ipv4 option description with + * "Must also have options" and "Incompatible options": */ -tSCC zIpv4Text[] = +static char const zIpv4Text[] = "Force IPv4 DNS name resolution"; -tSCC zIpv4_NAME[] = "IPV4"; -tSCC zIpv4_Name[] = "ipv4"; +static char const zIpv4_NAME[] = "IPV4"; +static char const zIpv4_Name[] = "ipv4"; +static const int + aIpv4CantList[] = { + INDEX_OPT_IPV6, NO_EQUIVALENT }; #define IPV4_FLAGS (OPTST_DISABLED) /* - * Ipv6 option description: + * Ipv6 option description with + * "Must also have options" and "Incompatible options": */ -tSCC zIpv6Text[] = +static char const zIpv6Text[] = "Force IPv6 DNS name resolution"; -tSCC zIpv6_NAME[] = "IPV6"; -tSCC zIpv6_Name[] = "ipv6"; +static char const zIpv6_NAME[] = "IPV6"; +static char const zIpv6_Name[] = "ipv6"; +static const int + aIpv6CantList[] = { + INDEX_OPT_IPV4, NO_EQUIVALENT }; #define IPV6_FLAGS (OPTST_DISABLED) /* - * Unprivport option description: + * Normalverbose option description: */ -tSCC zUnprivportText[] = - "Use an unprivileged port"; -tSCC zUnprivport_NAME[] = "UNPRIVPORT"; -tSCC zUnprivport_Name[] = "unprivport"; -#define UNPRIVPORT_FLAGS (OPTST_DISABLED) +static char const zNormalverboseText[] = + "Normal verbose"; +static char const zNormalverbose_NAME[] = "NORMALVERBOSE"; +static char const zNormalverbose_Name[] = "normalverbose"; +#define NORMALVERBOSE_FLAGS (OPTST_DISABLED) /* - * Normalverbose option description with - * "Must also have options" and "Incompatible options": + * Kod option description: */ -tSCC zNormalverboseText[] = - "Slightly verbose"; -tSCC zNormalverbose_NAME[] = "NORMALVERBOSE"; -tSCC zNormalverbose_Name[] = "normalverbose"; -static const int - aNormalverboseCantList[] = { - INDEX_OPT_EXTRAVERBOSE, - INDEX_OPT_MEGAVERBOSE, NO_EQUIVALENT }; -#define NORMALVERBOSE_FLAGS (OPTST_DISABLED) +static char const zKodText[] = + "KoD history filename"; +static char const zKod_NAME[] = "KOD"; +static char const zKod_Name[] = "kod"; +#define KOD_FLAGS (OPTST_DISABLED \ + | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) /* - * Extraverbose option description with + * Syslog option description with * "Must also have options" and "Incompatible options": */ -tSCC zExtraverboseText[] = - "Extra verbose"; -tSCC zExtraverbose_NAME[] = "EXTRAVERBOSE"; -tSCC zExtraverbose_Name[] = "extraverbose"; +static char const zSyslogText[] = + "Logging with syslog"; +static char const zSyslog_NAME[] = "SYSLOG"; +static char const zSyslog_Name[] = "syslog"; static const int - aExtraverboseCantList[] = { - INDEX_OPT_NORMALVERBOSE, - INDEX_OPT_MEGAVERBOSE, NO_EQUIVALENT }; -#define EXTRAVERBOSE_FLAGS (OPTST_DISABLED) + aSyslogCantList[] = { + INDEX_OPT_LOGFILE, NO_EQUIVALENT }; +#define SYSLOG_FLAGS (OPTST_DISABLED) /* - * Megaverbose option description with + * Logfile option description with * "Must also have options" and "Incompatible options": */ -tSCC zMegaverboseText[] = - "Mega verbose"; -tSCC zMegaverbose_NAME[] = "MEGAVERBOSE"; -tSCC zMegaverbose_Name[] = "megaverbose"; +static char const zLogfileText[] = + "Log to specified logfile"; +static char const zLogfile_NAME[] = "LOGFILE"; +static char const zLogfile_Name[] = "logfile"; static const int - aMegaverboseCantList[] = { - INDEX_OPT_NORMALVERBOSE, - INDEX_OPT_EXTRAVERBOSE, NO_EQUIVALENT }; -#define MEGAVERBOSE_FLAGS (OPTST_DISABLED) + aLogfileCantList[] = { + INDEX_OPT_SYSLOG, NO_EQUIVALENT }; +#define LOGFILE_FLAGS (OPTST_DISABLED \ + | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) /* - * Settimeofday option description with + * Settod option description with * "Must also have options" and "Incompatible options": */ -tSCC zSettimeofdayText[] = +static char const zSettodText[] = "Set (step) the time with settimeofday()"; -tSCC zSettimeofday_NAME[] = "SETTIMEOFDAY"; -tSCC zSettimeofday_Name[] = "settimeofday"; +static char const zSettod_NAME[] = "SETTOD"; +static char const zSettod_Name[] = "settod"; static const int - aSettimeofdayCantList[] = { + aSettodCantList[] = { INDEX_OPT_ADJTIME, NO_EQUIVALENT }; -#define SETTIMEOFDAY_FLAGS (OPTST_DISABLED) +#define SETTOD_FLAGS (OPTST_DISABLED) /* * Adjtime option description with * "Must also have options" and "Incompatible options": */ -tSCC zAdjtimeText[] = +static char const zAdjtimeText[] = "Set (slew) the time with adjtime()"; -tSCC zAdjtime_NAME[] = "ADJTIME"; -tSCC zAdjtime_Name[] = "adjtime"; +static char const zAdjtime_NAME[] = "ADJTIME"; +static char const zAdjtime_Name[] = "adjtime"; static const int aAdjtimeCantList[] = { - INDEX_OPT_SETTIMEOFDAY, NO_EQUIVALENT }; + INDEX_OPT_SETTOD, NO_EQUIVALENT }; #define ADJTIME_FLAGS (OPTST_DISABLED) /* - * Help/More_Help/Version option descriptions: + * Broadcast option description: */ -tSCC zHelpText[] = "Display usage information and exit"; -tSCC zHelp_Name[] = "help"; +static char const zBroadcastText[] = + "Use broadcasts to the address specified for synchronisation"; +static char const zBroadcast_NAME[] = "BROADCAST"; +static char const zBroadcast_Name[] = "broadcast"; +#define BROADCAST_FLAGS (OPTST_DISABLED \ + | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) -tSCC zMore_HelpText[] = "Extended usage information passed thru pager"; -tSCC zMore_Help_Name[] = "more-help"; +/* + * Timeout option description: + */ +static char const zTimeoutText[] = + "Specify the number of seconds to wait for broadcasts"; +static char const zTimeout_NAME[] = "TIMEOUT"; +static char const zTimeout_Name[] = "timeout"; +#define zTimeoutDefaultArg ((char const*)68) +#define TIMEOUT_FLAGS (OPTST_DISABLED \ + | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC)) -tSCC zVersionText[] = "Output version information and exit"; -tSCC zVersion_Name[] = "version"; +/* + * Authentication option description: + */ +static char const zAuthenticationText[] = + "Enable authentication with the key auth-keynumber"; +static char const zAuthentication_NAME[] = "AUTHENTICATION"; +static char const zAuthentication_Name[] = "authentication"; +#define AUTHENTICATION_FLAGS (OPTST_DISABLED \ + | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC)) /* - * Save/Load_Opts option description: + * Keyfile option description: */ -tSCC zSave_OptsText[] = "Save the option state to a config file"; -tSCC zSave_Opts_Name[] = "save-opts"; +static char const zKeyfileText[] = + "Specify a keyfile. SNTP will look in this file for the key specified with -a"; +static char const zKeyfile_NAME[] = "KEYFILE"; +static char const zKeyfile_Name[] = "keyfile"; +#define KEYFILE_FLAGS (OPTST_DISABLED \ + | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) -tSCC zLoad_OptsText[] = "Load options from a config file"; -tSCC zLoad_Opts_NAME[] = "LOAD_OPTS"; +/* + * Help/More_Help/Version option descriptions: + */ +static char const zHelpText[] = "Display extended usage information and exit"; +static char const zHelp_Name[] = "help"; +#ifdef HAVE_WORKING_FORK +#define OPTST_MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT) +static char const zMore_Help_Name[] = "more-help"; +static char const zMore_HelpText[] = "Extended usage information passed thru pager"; +#else +#define OPTST_MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT) +#define zMore_Help_Name NULL +#define zMore_HelpText NULL +#endif +#ifdef NO_OPTIONAL_OPT_ARGS +# define OPTST_VERSION_FLAGS OPTST_IMM | OPTST_NO_INIT +#else +# define OPTST_VERSION_FLAGS OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \ + OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT +#endif -tSCC zNotLoad_Opts_Name[] = "no-load-opts"; -tSCC zNotLoad_Opts_Pfx[] = "no"; +static char const zVersionText[] = "Output version information and exit"; +static char const zVersion_Name[] = "version"; +static char const zSave_OptsText[] = "Save the option state to a config file"; +static char const zSave_Opts_Name[] = "save-opts"; +static char const zLoad_OptsText[] = "Load options from a config file"; +static char const zLoad_Opts_NAME[] = "LOAD_OPTS"; +static char const zNotLoad_Opts_Name[] = "no-load-opts"; +static char const zNotLoad_Opts_Pfx[] = "no"; #define zLoad_Opts_Name (zNotLoad_Opts_Name + 3) /* * Declare option callback procedures @@ -313,8 +226,6 @@ tSCC zNotLoad_Opts_Pfx[] = "no"; * Under test, omit argument processing, or call optionStackArg, * if multiple copies are allowed. */ -extern tOptProc - optionPagedUsage, optionVersionStderr; static tOptProc doUsageOpt; @@ -323,7 +234,10 @@ static tOptProc * When not under test, there are different procs to use */ extern tOptProc - optionPagedUsage, optionPrintVersion; + optionBooleanVal, optionNestedVal, optionNumericVal, + optionPagedUsage, optionPrintVersion, optionResetOpt, + optionStackArg, optionTimeDate, optionTimeVal, + optionUnstackArg, optionVersionStderr; static tOptProc doUsageOpt; #endif /* defined(TEST_SNTP_OPTS) */ @@ -337,89 +251,89 @@ static tOptProc * * Define the Sntp Option Descriptions. */ -static tOptDesc optDesc[ OPTION_CT ] = { +static tOptDesc optDesc[OPTION_CT] = { { /* entry idx, value */ 0, VALUE_OPT_IPV4, - /* equiv idx, value */ NO_EQUIVALENT, 0, + /* equiv idx, value */ 0, VALUE_OPT_IPV4, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ IPV4_FLAGS, 0, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, + /* must/cannot opts */ NULL, aIpv4CantList, /* option proc */ NULL, /* desc, NAME, name */ zIpv4Text, zIpv4_NAME, zIpv4_Name, /* disablement strs */ NULL, NULL }, { /* entry idx, value */ 1, VALUE_OPT_IPV6, - /* equiv idx, value */ NOLIMIT, NOLIMIT, - /* equivalenced to */ INDEX_OPT_IPV4, + /* equiv idx, value */ 1, VALUE_OPT_IPV6, + /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ IPV6_FLAGS, 0, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, + /* must/cannot opts */ NULL, aIpv6CantList, /* option proc */ NULL, /* desc, NAME, name */ zIpv6Text, zIpv6_NAME, zIpv6_Name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 2, VALUE_OPT_UNPRIVPORT, - /* equiv idx, value */ 2, VALUE_OPT_UNPRIVPORT, + { /* entry idx, value */ 2, VALUE_OPT_NORMALVERBOSE, + /* equiv idx, value */ 2, VALUE_OPT_NORMALVERBOSE, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ UNPRIVPORT_FLAGS, 0, + /* opt state flags */ NORMALVERBOSE_FLAGS, 0, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ NULL, - /* desc, NAME, name */ zUnprivportText, zUnprivport_NAME, zUnprivport_Name, + /* desc, NAME, name */ zNormalverboseText, zNormalverbose_NAME, zNormalverbose_Name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 3, VALUE_OPT_NORMALVERBOSE, - /* equiv idx, value */ 3, VALUE_OPT_NORMALVERBOSE, + { /* entry idx, value */ 3, VALUE_OPT_KOD, + /* equiv idx, value */ 3, VALUE_OPT_KOD, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ NORMALVERBOSE_FLAGS, 0, + /* opt state flags */ KOD_FLAGS, 0, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, aNormalverboseCantList, + /* must/cannot opts */ NULL, NULL, /* option proc */ NULL, - /* desc, NAME, name */ zNormalverboseText, zNormalverbose_NAME, zNormalverbose_Name, + /* desc, NAME, name */ zKodText, zKod_NAME, zKod_Name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 4, VALUE_OPT_EXTRAVERBOSE, - /* equiv idx, value */ 4, VALUE_OPT_EXTRAVERBOSE, + { /* entry idx, value */ 4, VALUE_OPT_SYSLOG, + /* equiv idx, value */ 4, VALUE_OPT_SYSLOG, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ EXTRAVERBOSE_FLAGS, 0, + /* opt state flags */ SYSLOG_FLAGS, 0, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, aExtraverboseCantList, + /* must/cannot opts */ NULL, aSyslogCantList, /* option proc */ NULL, - /* desc, NAME, name */ zExtraverboseText, zExtraverbose_NAME, zExtraverbose_Name, + /* desc, NAME, name */ zSyslogText, zSyslog_NAME, zSyslog_Name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 5, VALUE_OPT_MEGAVERBOSE, - /* equiv idx, value */ 5, VALUE_OPT_MEGAVERBOSE, + { /* entry idx, value */ 5, VALUE_OPT_LOGFILE, + /* equiv idx, value */ 5, VALUE_OPT_LOGFILE, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ MEGAVERBOSE_FLAGS, 0, + /* opt state flags */ LOGFILE_FLAGS, 0, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, aMegaverboseCantList, + /* must/cannot opts */ NULL, aLogfileCantList, /* option proc */ NULL, - /* desc, NAME, name */ zMegaverboseText, zMegaverbose_NAME, zMegaverbose_Name, + /* desc, NAME, name */ zLogfileText, zLogfile_NAME, zLogfile_Name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 6, VALUE_OPT_SETTIMEOFDAY, - /* equiv idx, value */ 6, VALUE_OPT_SETTIMEOFDAY, + { /* entry idx, value */ 6, VALUE_OPT_SETTOD, + /* equiv idx, value */ 6, VALUE_OPT_SETTOD, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ SETTIMEOFDAY_FLAGS, 0, + /* opt state flags */ SETTOD_FLAGS, 0, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, aSettimeofdayCantList, + /* must/cannot opts */ NULL, aSettodCantList, /* option proc */ NULL, - /* desc, NAME, name */ zSettimeofdayText, zSettimeofday_NAME, zSettimeofday_Name, + /* desc, NAME, name */ zSettodText, zSettod_NAME, zSettod_Name, /* disablement strs */ NULL, NULL }, { /* entry idx, value */ 7, VALUE_OPT_ADJTIME, @@ -434,18 +348,59 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* desc, NAME, name */ zAdjtimeText, zAdjtime_NAME, zAdjtime_Name, /* disablement strs */ NULL, NULL }, -#ifdef NO_OPTIONAL_OPT_ARGS -# define VERSION_OPT_FLAGS OPTST_IMM | OPTST_NO_INIT -#else -# define VERSION_OPT_FLAGS OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \ - OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT -#endif + { /* entry idx, value */ 8, VALUE_OPT_BROADCAST, + /* equiv idx, value */ 8, VALUE_OPT_BROADCAST, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ BROADCAST_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ NULL, + /* desc, NAME, name */ zBroadcastText, zBroadcast_NAME, zBroadcast_Name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ 9, VALUE_OPT_TIMEOUT, + /* equiv idx, value */ 9, VALUE_OPT_TIMEOUT, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ TIMEOUT_FLAGS, 0, + /* last opt argumnt */ { zTimeoutDefaultArg }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ optionNumericVal, + /* desc, NAME, name */ zTimeoutText, zTimeout_NAME, zTimeout_Name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ 10, VALUE_OPT_AUTHENTICATION, + /* equiv idx, value */ 10, VALUE_OPT_AUTHENTICATION, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ AUTHENTICATION_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ optionNumericVal, + /* desc, NAME, name */ zAuthenticationText, zAuthentication_NAME, zAuthentication_Name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ 11, VALUE_OPT_KEYFILE, + /* equiv idx, value */ 11, VALUE_OPT_KEYFILE, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ KEYFILE_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ NULL, + /* desc, NAME, name */ zKeyfileText, zKeyfile_NAME, zKeyfile_Name, + /* disablement strs */ NULL, NULL }, { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION, /* equiv idx value */ NO_EQUIVALENT, 0, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ VERSION_OPT_FLAGS, 0, + /* opt state flags */ OPTST_VERSION_FLAGS, 0, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, @@ -453,7 +408,6 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* desc, NAME, name */ zVersionText, NULL, zVersion_Name, /* disablement strs */ NULL, NULL }, -#undef VERSION_OPT_FLAGS { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP, @@ -472,7 +426,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equiv idx value */ NO_EQUIVALENT, 0, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0, + /* opt state flags */ OPTST_MORE_HELP_FLAGS, 0, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, @@ -497,7 +451,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equiv idx value */ NO_EQUIVALENT, 0, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, NOLIMIT, 0, - /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) \ + /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | OPTST_DISABLE_IMM, 0, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, @@ -511,29 +465,28 @@ static tOptDesc optDesc[ OPTION_CT ] = { * * Define the Sntp Option Environment */ -tSCC zPROGNAME[] = "SNTP"; -tSCC zUsageTitle[] = -"sntp - standard SNTP program - Ver. 4.2.4p8\n\ -USAGE: %s [ -<flag> | --<name> ]...\n"; -tSCC zRcName[] = ".ntprc"; -tSCC* apzHomeList[] = { - "$HOME", - ".", - NULL }; - -tSCC zBugsAddr[] = "http://bugs.ntp.org, bugs@ntp.org"; -#define zExplain NULL -tSCC zDetail[] = "\n\ -.I sntp\n\ -can be used as a SNTP client to query a NTP or SNTP server and either display\n\ -the time or set the local system's time (given suitable privilege). It can be\n\ -run as an interactive command or in a\n\ -.I cron\n\ -job.\n\ -NTP is the Network Time Protocol (RFC 1305) and SNTP is the\n\ -Simple Network Time Protocol (RFC 2030, which supersedes RFC 1769).\n"; -tSCC zFullVersion[] = SNTP_FULL_VERSION; -/* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/optcode.tpl near line 408 */ +static char const zPROGNAME[5] = "SNTP"; +static char const zUsageTitle[152] = +"sntp - standard Simple Network Time Protocol program - Ver. 4.2.6p5\n\ +USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n\ +\t\t[ hostname-or-IP ...]\n"; +static char const zRcName[7] = ".ntprc"; +static char const * const apzHomeList[3] = { + "$HOME", + ".", + NULL }; + +static char const zBugsAddr[34] = "http://bugs.ntp.org, bugs@ntp.org"; +static char const zExplain[] = "\n\n"; +static char const zDetail[352] = "\n\ +sntp implements the Simple Network Time Protocol, and is used to query an\n\ +NTP or SNTP server and either display the time or set the local system's\n\ +time (given suitable privilege).\n\n\ +It can be run interactively from the command line or as a cron job.\n\n\ +NTP and SNTP are defined by RFC 5905, which obsoletes RFC 4330 and RFC\n\ +1305.\n"; +static char const zFullVersion[] = SNTP_FULL_VERSION; +/* extracted from optcode.tlib near line 515 */ #if defined(ENABLE_NLS) # define OPTPROC_BASE OPTPROC_TRANSLATE @@ -543,6 +496,29 @@ tSCC zFullVersion[] = SNTP_FULL_VERSION; # define translate_option_strings NULL #endif /* ENABLE_NLS */ + +#define sntp_full_usage NULL +#define sntp_short_usage NULL +#ifndef PKGDATADIR +# define PKGDATADIR "" +#endif + +#ifndef WITH_PACKAGER +# define sntp_packager_info NULL +#else +static char const sntp_packager_info[] = + "Packaged by " WITH_PACKAGER + +# ifdef WITH_PACKAGER_VERSION + " ("WITH_PACKAGER_VERSION")" +# endif + +# ifdef WITH_PACKAGER_BUG_REPORTS + "\nReport sntp bugs to " WITH_PACKAGER_BUG_REPORTS +# endif + "\n"; +#endif + tOptions sntpOptions = { OPTIONS_STRUCT_VERSION, 0, NULL, /* original argc + argv */ @@ -552,55 +528,58 @@ tOptions sntpOptions = { + OPTPROC_LONGOPT + OPTPROC_NO_REQ_OPT + OPTPROC_ENVIRON - + OPTPROC_NO_ARGS - + OPTPROC_HAS_IMMED ), + + OPTPROC_MISUSE ), 0, NULL, /* current option index, current option */ NULL, NULL, zPROGNAME, - zRcName, zCopyright, zCopyrightNotice, + zRcName, zCopyright, zLicenseDescrip, zFullVersion, apzHomeList, zUsageTitle, zExplain, zDetail, optDesc, zBugsAddr, /* address to send bugs to */ NULL, NULL, /* extensions/saved state */ - optionUsage, /* usage procedure */ + optionUsage, /* usage procedure */ translate_option_strings, /* translation procedure */ /* * Indexes to special options */ - { INDEX_OPT_MORE_HELP, - INDEX_OPT_SAVE_OPTS, - NO_EQUIVALENT /* index of '-#' option */, + { INDEX_OPT_MORE_HELP, /* more-help option index */ + INDEX_OPT_SAVE_OPTS, /* save option index */ + NO_EQUIVALENT, /* '-#' option index */ NO_EQUIVALENT /* index of default opt */ }, - 13 /* full option count */, 8 /* user option count */ + 17 /* full option count */, 12 /* user option count */, + sntp_full_usage, sntp_short_usage, + NULL, NULL, + PKGDATADIR, sntp_packager_info }; /* * Create the static procedure(s) declared above. */ static void -doUsageOpt( - tOptions* pOptions, - tOptDesc* pOptDesc ) +doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc) { - USAGE( EXIT_SUCCESS ); + (void)pOptions; + USAGE(SNTP_EXIT_SUCCESS); } -/* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/optmain.tpl near line 92 */ +/* extracted from optmain.tlib near line 128 */ #if defined(TEST_SNTP_OPTS) /* TEST MAIN PROCEDURE: */ +extern void optionPutShell(tOptions*); + int -main( int argc, char** argv ) +main(int argc, char ** argv) { - int res = EXIT_SUCCESS; - (void)optionProcess( &sntpOptions, argc, argv ); - { - void optionPutShell( tOptions* ); - optionPutShell( &sntpOptions ); - } + int res = SNTP_EXIT_SUCCESS; + (void)optionProcess(&sntpOptions, argc, argv); + optionPutShell(&sntpOptions); + res = ferror(stdout); + if (res != 0) + fputs("output error writing to stdout\n", stderr); return res; } #endif /* defined TEST_SNTP_OPTS */ -/* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/optcode.tpl near line 514 */ +/* extracted from optcode.tlib near line 666 */ #if ENABLE_NLS #include <stdio.h> @@ -609,11 +588,11 @@ main( int argc, char** argv ) #include <unistd.h> #include <autoopts/usage-txt.h> -static char* AO_gettext( char const* pz ); +static char* AO_gettext(char const* pz); static void coerce_it(void** s); static char* -AO_gettext( char const* pz ) +AO_gettext(char const* pz) { char* pzRes; if (pz == NULL) @@ -621,66 +600,68 @@ AO_gettext( char const* pz ) pzRes = _(pz); if (pzRes == pz) return pzRes; - pzRes = strdup( pzRes ); + pzRes = strdup(pzRes); if (pzRes == NULL) { - fputs( _("No memory for duping translated strings\n"), stderr ); - exit( EXIT_FAILURE ); + fputs(_("No memory for duping translated strings\n"), stderr); + exit(SNTP_EXIT_FAILURE); } return pzRes; } -static void coerce_it(void** s) { *s = AO_gettext(*s); } -#define COERSION(_f) \ - coerce_it((void*)&(sntpOptions._f)) +static void coerce_it(void** s) { *s = AO_gettext(*s); +} /* * This invokes the translation code (e.g. gettext(3)). */ static void -translate_option_strings( void ) +translate_option_strings(void) { + tOptions * const pOpt = &sntpOptions; + /* * Guard against re-translation. It won't work. The strings will have * been changed by the first pass through this code. One shot only. */ - if (option_usage_text.field_ct == 0) - return; - /* - * Do the translations. The first pointer follows the field count field. - * The field count field is the size of a pointer. - */ - { - char** ppz = (char**)(void*)&(option_usage_text); - int ix = option_usage_text.field_ct; + if (option_usage_text.field_ct != 0) { + /* + * Do the translations. The first pointer follows the field count + * field. The field count field is the size of a pointer. + */ + tOptDesc * pOD = pOpt->pOptDesc; + char ** ppz = (char**)(void*)&(option_usage_text); + int ix = option_usage_text.field_ct; do { ppz++; *ppz = AO_gettext(*ppz); } while (--ix > 0); + + coerce_it((void*)&(pOpt->pzCopyright)); + coerce_it((void*)&(pOpt->pzCopyNotice)); + coerce_it((void*)&(pOpt->pzFullVersion)); + coerce_it((void*)&(pOpt->pzUsageTitle)); + coerce_it((void*)&(pOpt->pzExplain)); + coerce_it((void*)&(pOpt->pzDetail)); + coerce_it((void*)&(pOpt->pzPackager)); + option_usage_text.field_ct = 0; + + for (ix = pOpt->optCt; ix > 0; ix--, pOD++) + coerce_it((void*)&(pOD->pzText)); } - option_usage_text.field_ct = 0; - - { - tOptDesc* pOD = sntpOptions.pOptDesc; - int ix = sntpOptions.optCt; - - for (;;) { - pOD->pzText = AO_gettext(pOD->pzText); - pOD->pz_NAME = AO_gettext(pOD->pz_NAME); - pOD->pz_Name = AO_gettext(pOD->pz_Name); - pOD->pz_DisableName = AO_gettext(pOD->pz_DisableName); - pOD->pz_DisablePfx = AO_gettext(pOD->pz_DisablePfx); - if (--ix <= 0) - break; - pOD++; + + if ((pOpt->fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) { + tOptDesc * pOD = pOpt->pOptDesc; + int ix; + + for (ix = pOpt->optCt; ix > 0; ix--, pOD++) { + coerce_it((void*)&(pOD->pz_Name)); + coerce_it((void*)&(pOD->pz_DisableName)); + coerce_it((void*)&(pOD->pz_DisablePfx)); } + /* prevent re-translation */ + sntpOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT; } - COERSION(pzCopyright); - COERSION(pzCopyNotice); - COERSION(pzFullVersion); - COERSION(pzUsageTitle); - COERSION(pzExplain); - COERSION(pzDetail); } #endif /* ENABLE_NLS */ diff --git a/sntp/sntp-opts.def b/sntp/sntp-opts.def index b4c7f6b..4a62541 100644 --- a/sntp/sntp-opts.def +++ b/sntp/sntp-opts.def @@ -3,29 +3,18 @@ autogen definitions options; #include autogen-version.def +#include copyright.def -copyright = { - date = "1970-2006"; - owner = "ntp.org"; - eaddr = "http://bugs.ntp.org, bugs@ntp.org"; - type = note; - text = `cat COPYRIGHT`; -}; +prog-name = "sntp"; +prog-title = "standard Simple Network Time Protocol program"; +argument = '[ hostname-or-IP ...]'; +#include homerc.def -prog-name = "sntp"; -prog-title = "standard SNTP program"; -homerc = $HOME, "."; long-opts; config-header = "config.h"; -#ifndef __windows__ -rcfile = ".ntprc"; -#else -rcfile = "ntp.ini"; -#endif - environrc; #include version.def @@ -35,10 +24,10 @@ test-main; flag = { name = ipv4; value = 4; - equivalence = ipv4; + flags-cant = ipv6; descrip = "Force IPv4 DNS name resolution"; doc = <<- _EndOfDoc_ - Force DNS resolution of following host names on the command line + Force DNS resolution of the following host names on the command line to the IPv4 namespace. _EndOfDoc_; }; @@ -46,28 +35,19 @@ flag = { flag = { name = ipv6; value = 6; - equivalence = ipv4; + flags-cant = ipv4; descrip = "Force IPv6 DNS name resolution"; doc = <<- _EndOfDoc_ - Force DNS resolution of following host names on the command line + Force DNS resolution of the following host names on the command line to the IPv6 namespace. _EndOfDoc_; }; -flag = { - name = unprivport; - value = u; - descrip = "Use an unprivileged port"; - doc = <<- _EndOfDoc_ - Use an unprivilegded UDP port for our queries. - _EndOfDoc_; -}; flag = { name = normalverbose; - value = v; - flags-cant = extraverbose, megaverbose; - descrip = "Slightly verbose"; + value = d; + descrip = "Normal verbose"; doc = <<- _EndOfDoc_ Diagnostic messages for non-fatal errors and a limited amount of tracing should be written to standard error. Fatal ones always @@ -77,35 +57,45 @@ flag = { }; flag = { - name = extraverbose; - value = V; - flags-cant = normalverbose, megaverbose; - descrip = "Extra verbose"; + name = kod; + value = K; + arg-type = string; + arg-name = "file-name"; + descrip = "KoD history filename"; doc = <<- _EndOfDoc_ - Produce more and less comprehensible output, mainly for investigating - problems with apparently inconsistent timestamps. This option should - be set when the program fails with a message indicating that is the - trouble. + Specifies the filename to be used to persist the history of KoD + responses received from servers. The default is + /var/db/ntp-kod. + _EndOfDoc_; +}; + + +flag = { + name = syslog; + value = p; + flags-cant = logfile; + descrip = "Logging with syslog"; + doc = <<- _EndOfDoc_ + When this option is set all logging will be done using syslog. _EndOfDoc_; }; flag = { - name = megaverbose; - value = W; - flags-cant = normalverbose, extraverbose; - descrip = "Mega verbose"; - doc = <<- _EndOfDoc_ - Very verbose debugging output that will interfere with the timing - when writing to the terminal (because of line buffered output from C). - Note that the times produced by this are the corrections needed, and - not the error in the local clock. This option should be set only when - debugging the source. + name = logfile; + value = l; + arg-type = string; + arg-name = "file-name"; + flags-cant = syslog; + descrip = "Log to specified logfile"; + doc = <<- _EndOfDoc_ + This option causes the client to write log messages to the specified + logfile. _EndOfDoc_; }; flag = { - name = settimeofday; - value = r; + name = settod; + value = s; flags-cant = adjtime; descrip = "Set (step) the time with settimeofday()"; doc = <<- _EndOfDoc_ @@ -114,157 +104,153 @@ flag = { flag = { name = adjtime; - value = a; - flags-cant = settimeofday; + value = j; + flags-cant = settod; descrip = "Set (slew) the time with adjtime()"; doc = <<- _EndOfDoc_ _EndOfDoc_; }; +flag = { + name = broadcast; + value = b; + descrip = "Use broadcasts to the address specified for synchronisation"; + arg-type = string; + arg-name = "broadcast-address"; + doc = <<- _EndOfDoc_ + If specified SNTP will listen to the specified broadcast address + for NTP broadcasts. The default maximum wait time, + 68 seconds, can be modified with -t. + _EndOfDoc_; +}; + +flag = { + name = timeout; + value = t; + descrip = "Specify the number of seconds to wait for broadcasts"; + arg-type = number; + arg-name = "seconds"; + arg-default = 68; + doc = <<- _EndOfDoc_ + When waiting for a broadcast packet SNTP will wait the number + of seconds specified before giving up. Default 68 seconds. + _EndOfDoc_; +}; + +flag = { + name = authentication; + value = a; + descrip = "Enable authentication with the key auth-keynumber"; + arg-type = number; + arg-name = "auth-keynumber"; + doc = <<- _EndOfDoc_ + This option enables authentication using the key specified in this option's argument. + The argument of this option is the keyid, a number specified in the keyfile as this + key's identifier. See the keyfile option (-k) for more details. + _EndOfDoc_; +}; + +flag = { + name = keyfile; + value = k; + descrip = "Specify a keyfile. SNTP will look in this file for the key specified with -a"; + arg-type = string; + arg-name = "file-name"; + doc = <<- _EndOfDoc_ + This option specifies the keyfile. SNTP will search for the key specified with -a keyno in this + file. Key files follow the following format: + + keyid keytype key + + Where keyid is a number identifying this key + keytype is one of the follow: + S Key in 64 Bit hexadecimal number as specified in in the DES specification. + N Key in 64 Bit hexadecimal number as specified in the NTP standard. + A Key in a 1-to-8 character ASCII string. + M Key in a 1-to-8 character ASCII string using the MD5 authentication scheme. + + For more information see ntp.keys(5). + _EndOfDoc_; +}; + + +/* explain: Additional information whenever the usage routine is invoked */ +explain = <<- _END_EXPLAIN + _END_EXPLAIN; + detail = <<- _END_DETAIL +sntp implements the Simple Network Time Protocol, and is used to query +an NTP or SNTP server and either display the time or set the local +system's time (given suitable privilege). + +It can be run interactively from the command line or as a cron job. + +NTP and SNTP are defined by RFC 5905, which obsoletes RFC 4330 and RFC +1305. + _END_DETAIL; + +prog-man-descrip = <<- _END_PROG_MAN_DESCRIP .I sntp can be used as a SNTP client to query a NTP or SNTP server and either display the time or set the local system's time (given suitable privilege). It can be run as an interactive command or in a .I cron job. -NTP is the Network Time Protocol (RFC 1305) and SNTP is the -Simple Network Time Protocol (RFC 2030, which supersedes RFC 1769). - _END_DETAIL; -prog-man-descrip = <<- _END_PROG_MAN_DESCRIP -.I sntp +NTP (the Network Time Protocol) and SNTP (the Simple Network Time Protocol) +are defined and described by RFC 5905. + +.PP +The default is to write the estimated correct local date and time (i.e. not +UTC) to the standard output in a format like +.BR "'1996-10-15 20:17:25.123 (+0800) +4.567 +/- 0.089 secs'" , +where the +.B "'(+0800)'" +means that to get to UTC from the reported local time one must +add 8 hours and 0 minutes, +and the +.B "'+4.567 +/- 0.089 secs'" +indicates the local clock is 4.567 seconds behind the correct time +(so 4.567 seconds must be added to the local clock to get it to be correct), +and the time of +'1996-10-15 20:17:25.123' +is believed to be correct to within ++/- 0.089 +seconds. + _END_PROG_MAN_DESCRIP; + +prog-info-descrip = <<- _END_PROG_INFO_DESCRIP +@code{sntp} can be used as a SNTP client to query a NTP or SNTP server and either display the time or set the local system's time (given suitable privilege). It can be run as an interactive command or in a -.I cron +@code{cron} job. -NTP is the Network Time Protocol (RFC 1305) and SNTP is the -Simple Network Time Protocol (RFC 2030, which supersedes RFC 1769). -.SS Options -.PP -.I sntp -recognizes the following options: -.TP -.B \-v -indicates that diagnostic messages for non-fatal errors and a limited amount of -tracing should be written to standard error. Fatal ones always produce a -diagnostic. This option should be set when there is a suspected problem with -the server, network or the source. -.TP -.B \-V -requests more and less comprehensible output, mainly for investigating problems -with apparently inconsistent timestamps. This option should be set when the -program fails with a message indicating that is the trouble. -.TP -.B \-W -requests very verbose debugging output, and will interfere with the timing -when writing to the terminal (because of line buffered output from C). Note -that the times produced by this are the corrections needed, and not the error -in the local clock. This option should be set only when debugging the source. -.TP -.B \-q -indicates that it should query a daemon save file being maintained by it. -This needs no privilege and will change neither the save file nor the clock. -.PP -The default is that it should behave as a client, and the following options -are then relevant: -.TP -.B \-r -indicates that the system clock should be reset by -.IR settimeofday . -Naturally, this will work only if the user has enough privilege. -.TP -.B \-a -indicates that the system clock should be reset by -.IR adjtime . -Naturally, this will work only if the user has enough privilege. -.PP + +NTP (the Network Time Protocol) and SNTP (the Simple Network Time Protocol) +are defined and described by RFC 5905. + +@indent The default is to write the estimated correct local date and time (i.e. not UTC) to the standard output in a format like -.BR "'1996 Oct 15 20:17:25.123 + 4.567 +/- 0.089 secs'" , +@example +1996-10-15 20:17:25.123 (+0800) +4.567 +/- 0.089 secs +@end example where the -.B "'+ 4.567 +/- 0.089 secs'" -indicates the estimated error in the time on the local system. -.TP -.BI \-l " lockfile" -sets the name of the lock file to ensure that there is only -one copy of -.I sntp -running at once. The default is installation-dependent, but will usually be -.IR /etc/sntp.pid . -.TP -.BI \-e " minerr" -sets the maximum ignorable variation between the clocks to -.IR minerr . -Acceptable values are from 0.001 to 1, and the default is 0.1 if a NTP host is -is specified and 0.5 otherwise. -.TP -.BI \-E " maxerr" -sets the maximum value of various delays that are deemed acceptable to -.IR maxerr . -Acceptable values are from 1 to 60, and the default is 5. It should sometimes -be increased if there are problems with the network, NTP server or system -clock, but take care. -.TP -.BI \-P " prompt" -sets the maximum clock change that will be made automatically to -.IR maxerr . -Acceptable values are from 1 to 3600 or -.IR no , -and the default is 30. If the program is being run interactively in ordinary -client mode, and the system clock is to be changed, larger corrections will -prompt the user for confirmation. Specifying -.I no -will disable this and the correction will be made regardless. -.TP -.BI \-c " count" -sets the maximum number of NTP packets required to -.IR count . -Acceptable values are from 1 to 25 if a NTP host is specified and from 5 to 25 -otherwise, and the default is 5. If the maximum isn't enough, the system needs -a better consistency algorithm than this program uses. -.TP -.BI \-d " delay" -sets a rough limit on the total running time to -.I delay -seconds. Acceptable values are from 1 to 3600, and the default is 15 if a NTP -host is specified and 300 otherwise. -.TP -.B -4 -force IPv4 DNS resolution. -.TP -.B -6 -force IPv6 DNS resolution. -.PP -.B address(es) -are the DNS names or IP numbers of hosts to use for the challenge and response -protocol; if no names are given, the program waits for broadcasts. Polling a -server is vastly more reliable than listening to broadcasts. Note that a -single component numeric address is not allowed, to avoid ambiguities. If -more than one name is give, they will be used in a round-robin fashion. -.PP -Constraints: -.IP -.B minerr -must be less than -.B maxerr -which must be less than -.B delay -(or, if a NTP host is not specified -.BR delay / count ")," -and -.B count -must be less than half of -.BR delay . -.IP -In update mode, -.B maxerr -must be less than -.BR prompt. -.PP -Note that none of the above values are closely linked to the limits described -in the NTP protocol (RFC 1305). +@example ++4.567 +/- 0.089 secs +@end example +indicates the local clock is 4.567 seconds behind the correct time +(so 4.567 seconds must be added to the local clock to get it to be correct), +and the (local) time of +@code{1996-10-15 20:17:25.123} +can be converted to UTC time by adding 8 hours and 0 minutes, and +is believed to be correct to within +@code{+/- 0.089} +seconds. + _END_PROG_INFO_DESCRIP; + +man-doc = <<- _END_MAN_DOC .SH USAGE The simplest use of this program is as an unprivileged command to check the current time and error in the local clock. For example: @@ -280,48 +266,9 @@ and commands. For example: .IP .B sntp -a ntpserver.somewhere -.PP -More information on how to use this utility is given in the -.I README -file in the distribution. In particular, this -.I man -page does not describe how to set it up as a server, which needs special care -to avoid propagating misinformation. .SH RETURN VALUE -When used as a client in non-daemon mode, the program returns a zero exit -status for success, and a non-zero one otherwise. When used as a daemon -(either client or server), it does not return except after a serious error. +The program returns a zero exit +status for success, and a non-zero one otherwise. .SH BUGS -The program implements the SNTP protocol, and does not provide all NTP -facilities. In particular, it contains no checks against any form of spoofing. -If this is a serious concern, some network security mechanism (like a firewall -or even just -.IR tcpwrappers ) -should be installed. -.PP -There are some errors, ambiguities and inconsistencies in the RFCs, and this -code may not interwork with all other NTP implementations. Any unreasonable -restrictions should be reported as bugs to whoever is responsible. It may -be difficult to find out who that is. -.PP -The program will stop as soon as it feels that things have got out of control. -In client daemon mode, it will usually fail during an extended period of -network or server inaccessibility or excessively slow performance, or when the -local clock is reset by another process. It will then need restarting -manually. Experienced system administrators can write a shell script, a -.I cron -job or put it in -.IR inittab , -to do this automatically. -.PP -The error cannot be estimated reliably with broadcast packets or for the drift -in daemon mode (even with client-server packets), and the guess made by the -program may be wrong (possibly even very wrong). If this is a problem, then -setting the -.B \-c -option to a larger value may help. Or it may not. -.SH AUTHOR -.I sntp -was developed by N.M. Maclaren of the University of Cambridge Computing -Service. - _END_PROG_MAN_DESCRIP; +Please report bugs to http://bugs.ntp.org . + _END_MAN_DOC; diff --git a/sntp/sntp-opts.h b/sntp/sntp-opts.h index e73737a..926789b 100644 --- a/sntp/sntp-opts.h +++ b/sntp/sntp-opts.h @@ -1,106 +1,24 @@ /* * EDIT THIS FILE WITH CAUTION (sntp-opts.h) * - * It has been AutoGen-ed Tuesday December 8, 2009 at 08:14:49 AM EST + * It has been AutoGen-ed December 24, 2011 at 06:33:53 PM by AutoGen 5.12 * From the definitions sntp-opts.def * and the template file options * - * Generated from AutoOpts 29:0:4 templates. - */ - -/* - * This file was produced by an AutoOpts template. AutoOpts is a - * copyrighted work. This header file is not encumbered by AutoOpts - * licensing, but is provided under the licensing terms chosen by the - * sntp author or copyright holder. AutoOpts is licensed under - * the terms of the LGPL. The redistributable library (``libopts'') is - * licensed under the terms of either the LGPL or, at the users discretion, - * the BSD license. See the AutoOpts and/or libopts sources for details. + * Generated from AutoOpts 35:0:10 templates. * - * This source file is copyrighted and licensed under the following terms: + * AutoOpts is a copyrighted work. This header file is not encumbered + * by AutoOpts licensing, but is provided under the licensing terms chosen + * by the sntp author or copyright holder. AutoOpts is + * licensed under the terms of the LGPL. The redistributable library + * (``libopts'') is licensed under the terms of either the LGPL or, at the + * users discretion, the BSD license. See the AutoOpts and/or libopts sources + * for details. * - * sntp copyright 1970-2006 ntp.org - all rights reserved + * This source file is copyrighted and licensed under the following terms: * - * General Public Licence for the software known as MSNTP - * ------------------------------------------------------ - * - * (c) Copyright, N.M. Maclaren, 1996, 1997, 2000 - * (c) Copyright, University of Cambridge, 1996, 1997, 2000 - * - * - * - * Free use of MSNTP in source and binary forms is permitted, provided that this - * entire licence is duplicated in all copies, and that any documentation, - * announcements, and other materials related to use acknowledge that the software - * was developed by N.M. Maclaren (hereafter refered to as the Author) at the - * University of Cambridge. Neither the name of the Author nor the University of - * Cambridge may be used to endorse or promote products derived from this material - * without specific prior written permission. - * - * The Author and the University of Cambridge retain the copyright and all other - * legal rights to the software and make it available non-exclusively. All users - * must ensure that the software in all its derivations carries a copyright notice - * in the form: - * (c) Copyright N.M. Maclaren, - * (c) Copyright University of Cambridge. - * - * - * - * NO WARRANTY - * - * Because the MSNTP software is licensed free of charge, the Author and the - * University of Cambridge provide absolutely no warranty, either expressed or - * implied, including, but not limited to, the implied warranties of - * merchantability and fitness for a particular purpose. The entire risk as to - * the quality and performance of the MSNTP software is with you. Should MSNTP - * prove defective, you assume the cost of all necessary servicing or repair. - * - * In no event, unless required by law, will the Author or the University of - * Cambridge, or any other party who may modify and redistribute this software as - * permitted in accordance with the provisions below, be liable for damages for - * any losses whatsoever, including but not limited to lost profits, lost monies, - * lost or corrupted data, or other special, incidental or consequential losses - * that may arise out of the use or inability to use the MSNTP software. - * - * - * - * COPYING POLICY - * - * Permission is hereby granted for copying and distribution of copies of the - * MSNTP source and binary files, and of any part thereof, subject to the - * following licence conditions: - * - * 1. You may distribute MSNTP or components of MSNTP, with or without additions - * developed by you or by others. No charge, other than an "at-cost" distribution - * fee, may be charged for copies, derivations, or distributions of this material - * without the express written consent of the copyright holders. - * - * 2. You may also distribute MSNTP along with any other product for sale, - * provided that the cost of the bundled package is the same regardless of whether - * MSNTP is included or not, and provided that those interested only in MSNTP must - * be notified that it is a product freely available from the University of - * Cambridge. - * - * 3. If you distribute MSNTP software or parts of MSNTP, with or without - * additions developed by you or others, then you must either make available the - * source to all portions of the MSNTP system (exclusive of any additions made by - * you or by others) upon request, or instead you may notify anyone requesting - * source that it is freely available from the University of Cambridge. - * - * 4. You may not omit any of the copyright notices on either the source files, - * the executable files, or the documentation. - * - * 5. You may not omit transmission of this License agreement with whatever - * portions of MSNTP that are distributed. - * - * 6. Any users of this software must be notified that it is without warranty or - * guarantee of any nature, express or implied, nor is there any fitness for use - * represented. - * - * - * October 1996 - * April 1997 - * October 2000 + * see html/copyright.html + * */ /* * This file contains the programmatic interface to the Automated @@ -109,7 +27,7 @@ * "AutoOpts" chapter. Please refer to that doc for usage help. */ #ifndef AUTOOPTS_SNTP_OPTS_H_GUARD -#define AUTOOPTS_SNTP_OPTS_H_GUARD +#define AUTOOPTS_SNTP_OPTS_H_GUARD 1 #include "config.h" #include <autoopts/options.h> @@ -120,7 +38,7 @@ * tolerable version is at least as old as what was current when the header * template was released. */ -#define AO_TEMPLATE_VERSION 118784 +#define AO_TEMPLATE_VERSION 143360 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) # error option template version mismatches autoopts/options.h header @@ -131,29 +49,33 @@ * Enumeration of each option: */ typedef enum { - INDEX_OPT_IPV4 = 0, - INDEX_OPT_IPV6 = 1, - INDEX_OPT_UNPRIVPORT = 2, - INDEX_OPT_NORMALVERBOSE = 3, - INDEX_OPT_EXTRAVERBOSE = 4, - INDEX_OPT_MEGAVERBOSE = 5, - INDEX_OPT_SETTIMEOFDAY = 6, - INDEX_OPT_ADJTIME = 7, - INDEX_OPT_VERSION = 8, - INDEX_OPT_HELP = 9, - INDEX_OPT_MORE_HELP = 10, - INDEX_OPT_SAVE_OPTS = 11, - INDEX_OPT_LOAD_OPTS = 12 + INDEX_OPT_IPV4 = 0, + INDEX_OPT_IPV6 = 1, + INDEX_OPT_NORMALVERBOSE = 2, + INDEX_OPT_KOD = 3, + INDEX_OPT_SYSLOG = 4, + INDEX_OPT_LOGFILE = 5, + INDEX_OPT_SETTOD = 6, + INDEX_OPT_ADJTIME = 7, + INDEX_OPT_BROADCAST = 8, + INDEX_OPT_TIMEOUT = 9, + INDEX_OPT_AUTHENTICATION = 10, + INDEX_OPT_KEYFILE = 11, + INDEX_OPT_VERSION = 12, + INDEX_OPT_HELP = 13, + INDEX_OPT_MORE_HELP = 14, + INDEX_OPT_SAVE_OPTS = 15, + INDEX_OPT_LOAD_OPTS = 16 } teOptIndex; -#define OPTION_CT 13 -#define SNTP_VERSION "4.2.4p8" -#define SNTP_FULL_VERSION "sntp - standard SNTP program - Ver. 4.2.4p8" +#define OPTION_CT 17 +#define SNTP_VERSION "4.2.6p5" +#define SNTP_FULL_VERSION "sntp 4.2.6p5" /* * Interface defines for all options. Replace "n" with the UPPER_CASED * option name (as in the teOptIndex enumeration above). - * e.g. HAVE_OPT( IPV4 ) + * e.g. HAVE_OPT(IPV4) */ #define DESC(n) (sntpOptions.pOptDesc[INDEX_OPT_## n]) #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) @@ -167,10 +89,18 @@ typedef enum { #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) #define CLEAR_OPT(n) STMTS( \ DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ - if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \ + if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \ DESC(n).fOptState |= OPTST_DISABLED; \ DESC(n).optCookie = NULL ) +/* * * * * * + * + * Enumeration of sntp exit codes + */ +typedef enum { + SNTP_EXIT_SUCCESS = 0, + SNTP_EXIT_FAILURE = 1 +} sntp_exit_code_t; /* * Make sure there are no #define name conflicts with the option names */ @@ -183,58 +113,84 @@ typedef enum { # warning undefining IPV6 due to option name conflict # undef IPV6 # endif -# ifdef UNPRIVPORT -# warning undefining UNPRIVPORT due to option name conflict -# undef UNPRIVPORT -# endif # ifdef NORMALVERBOSE # warning undefining NORMALVERBOSE due to option name conflict # undef NORMALVERBOSE # endif -# ifdef EXTRAVERBOSE -# warning undefining EXTRAVERBOSE due to option name conflict -# undef EXTRAVERBOSE +# ifdef KOD +# warning undefining KOD due to option name conflict +# undef KOD # endif -# ifdef MEGAVERBOSE -# warning undefining MEGAVERBOSE due to option name conflict -# undef MEGAVERBOSE +# ifdef SYSLOG +# warning undefining SYSLOG due to option name conflict +# undef SYSLOG # endif -# ifdef SETTIMEOFDAY -# warning undefining SETTIMEOFDAY due to option name conflict -# undef SETTIMEOFDAY +# ifdef LOGFILE +# warning undefining LOGFILE due to option name conflict +# undef LOGFILE +# endif +# ifdef SETTOD +# warning undefining SETTOD due to option name conflict +# undef SETTOD # endif # ifdef ADJTIME # warning undefining ADJTIME due to option name conflict # undef ADJTIME # endif +# ifdef BROADCAST +# warning undefining BROADCAST due to option name conflict +# undef BROADCAST +# endif +# ifdef TIMEOUT +# warning undefining TIMEOUT due to option name conflict +# undef TIMEOUT +# endif +# ifdef AUTHENTICATION +# warning undefining AUTHENTICATION due to option name conflict +# undef AUTHENTICATION +# endif +# ifdef KEYFILE +# warning undefining KEYFILE due to option name conflict +# undef KEYFILE +# endif #else /* NO_OPTION_NAME_WARNINGS */ # undef IPV4 # undef IPV6 -# undef UNPRIVPORT # undef NORMALVERBOSE -# undef EXTRAVERBOSE -# undef MEGAVERBOSE -# undef SETTIMEOFDAY +# undef KOD +# undef SYSLOG +# undef LOGFILE +# undef SETTOD # undef ADJTIME +# undef BROADCAST +# undef TIMEOUT +# undef AUTHENTICATION +# undef KEYFILE #endif /* NO_OPTION_NAME_WARNINGS */ -/* +/* * * * * * + * * Interface defines for specific options. */ #define VALUE_OPT_IPV4 '4' -#define WHICH_OPT_IPV4 (DESC(IPV4).optActualValue) -#define WHICH_IDX_IPV4 (DESC(IPV4).optActualIndex) #define VALUE_OPT_IPV6 '6' -#define VALUE_OPT_UNPRIVPORT 'u' -#define VALUE_OPT_NORMALVERBOSE 'v' -#define VALUE_OPT_EXTRAVERBOSE 'V' -#define VALUE_OPT_MEGAVERBOSE 'W' -#define VALUE_OPT_SETTIMEOFDAY 'r' -#define VALUE_OPT_ADJTIME 'a' +#define VALUE_OPT_NORMALVERBOSE 'd' +#define VALUE_OPT_KOD 'K' +#define VALUE_OPT_SYSLOG 'p' +#define VALUE_OPT_LOGFILE 'l' +#define VALUE_OPT_SETTOD 's' +#define VALUE_OPT_ADJTIME 'j' +#define VALUE_OPT_BROADCAST 'b' +#define VALUE_OPT_TIMEOUT 't' + +#define OPT_VALUE_TIMEOUT (DESC(TIMEOUT).optArg.argInt) +#define VALUE_OPT_AUTHENTICATION 'a' -#define VALUE_OPT_VERSION 'v' +#define OPT_VALUE_AUTHENTICATION (DESC(AUTHENTICATION).optArg.argInt) +#define VALUE_OPT_KEYFILE 'k' #define VALUE_OPT_HELP '?' #define VALUE_OPT_MORE_HELP '!' +#define VALUE_OPT_VERSION INDEX_OPT_VERSION #define VALUE_OPT_SAVE_OPTS '>' #define VALUE_OPT_LOAD_OPTS '<' #define SET_OPT_SAVE_OPTS(a) STMTS( \ @@ -244,37 +200,56 @@ typedef enum { /* * Interface defines not associated with particular options */ -#define ERRSKIP_OPTERR STMTS( sntpOptions.fOptSet &= ~OPTPROC_ERRSTOP ) -#define ERRSTOP_OPTERR STMTS( sntpOptions.fOptSet |= OPTPROC_ERRSTOP ) +#define ERRSKIP_OPTERR STMTS(sntpOptions.fOptSet &= ~OPTPROC_ERRSTOP) +#define ERRSTOP_OPTERR STMTS(sntpOptions.fOptSet |= OPTPROC_ERRSTOP) #define RESTART_OPT(n) STMTS( \ sntpOptions.curOptIdx = (n); \ - sntpOptions.pzCurOpt = NULL ) + sntpOptions.pzCurOpt = NULL) #define START_OPT RESTART_OPT(1) -#define USAGE(c) (*sntpOptions.pUsageProc)( &sntpOptions, c ) -/* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/opthead.tpl near line 360 */ +#define USAGE(c) (*sntpOptions.pUsageProc)(&sntpOptions, c) +/* extracted from opthead.tlib near line 451 */ + +#ifdef __cplusplus +extern "C" { +#endif /* * * * * * * * Declare the sntp option descriptor. */ -#ifdef __cplusplus -extern "C" { -#endif +extern tOptions sntpOptions; + +#if defined(ENABLE_NLS) +# ifndef _ +# include <stdio.h> +static inline char* aoGetsText(char const* pz) { + if (pz == NULL) return NULL; + return (char*)gettext(pz); +} +# define _(s) aoGetsText(s) +# endif /* _() */ -extern tOptions sntpOptions; +# define OPT_NO_XLAT_CFG_NAMES STMTS(sntpOptions.fOptSet |= \ + OPTPROC_NXLAT_OPT_CFG;) +# define OPT_NO_XLAT_OPT_NAMES STMTS(sntpOptions.fOptSet |= \ + OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;) -#ifndef _ -# if ENABLE_NLS -# include <stdio.h> - static inline char* aoGetsText( char const* pz ) { - if (pz == NULL) return NULL; - return (char*)gettext( pz ); - } -# define _(s) aoGetsText(s) -# else /* ENABLE_NLS */ -# define _(s) s -# endif /* ENABLE_NLS */ -#endif +# define OPT_XLAT_CFG_NAMES STMTS(sntpOptions.fOptSet &= \ + ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);) +# define OPT_XLAT_OPT_NAMES STMTS(sntpOptions.fOptSet &= \ + ~OPTPROC_NXLAT_OPT;) + +#else /* ENABLE_NLS */ +# define OPT_NO_XLAT_CFG_NAMES +# define OPT_NO_XLAT_OPT_NAMES + +# define OPT_XLAT_CFG_NAMES +# define OPT_XLAT_OPT_NAMES + +# ifndef _ +# define _(_s) _s +# endif +#endif /* ENABLE_NLS */ #ifdef __cplusplus } diff --git a/sntp/sntp-opts.texi b/sntp/sntp-opts.texi index 7ba2e21..6d6fc43 100644 --- a/sntp/sntp-opts.texi +++ b/sntp/sntp-opts.texi @@ -1,41 +1,64 @@ @node sntp Invocation @section Invoking sntp @pindex sntp -@cindex standard SNTP program +@cindex standard Simple Network Time Protocol program @ignore # # EDIT THIS FILE WITH CAUTION (sntp-opts.texi) # -# It has been AutoGen-ed Tuesday December 8, 2009 at 08:14:51 AM EST +# It has been AutoGen-ed December 24, 2011 at 06:34:00 PM by AutoGen 5.12 # From the definitions sntp-opts.def # and the template file aginfo.tpl @end ignore -This program has no explanation. -.I sntp +@code{sntp} can be used as a SNTP client to query a NTP or SNTP server and either display the time or set the local system's time (given suitable privilege). It can be run as an interactive command or in a -.I cron +@code{cron} job. -NTP is the Network Time Protocol (RFC 1305) and SNTP is the -Simple Network Time Protocol (RFC 2030, which supersedes RFC 1769). + +NTP (the Network Time Protocol) and SNTP (the Simple Network Time Protocol) +are defined and described by RFC 5905. + +@indent +The default is to write the estimated correct local date and time (i.e. not +UTC) to the standard output in a format like +@example +1996-10-15 20:17:25.123 (+0800) +4.567 +/- 0.089 secs +@end example +where the +@example ++4.567 +/- 0.089 secs +@end example +indicates the local clock is 4.567 seconds behind the correct time +(so 4.567 seconds must be added to the local clock to get it to be correct), +and the (local) time of +@code{1996-10-15 20:17:25.123} +can be converted to UTC time by adding 8 hours and 0 minutes, and +is believed to be correct to within +@code{+/- 0.089} +seconds. This section was generated by @strong{AutoGen}, -the aginfo template and the option descriptions for the @command{sntp} program. It documents the sntp usage text and option meanings. +the aginfo template and the option descriptions for the @command{sntp} program. It documents the @command{sntp} usage text and option meanings. This software is released under a specialized copyright license. @menu * sntp usage:: sntp usage help (-?) -* sntp adjtime:: adjtime option (-a) -* sntp extraverbose:: extraverbose option (-V) -* sntp ipv4:: ipv4 option (-4) -* sntp ipv6:: ipv6 option (-6) -* sntp megaverbose:: megaverbose option (-W) -* sntp normalverbose:: normalverbose option (-v) -* sntp settimeofday:: settimeofday option (-r) -* sntp unprivport:: unprivport option (-u) +* sntp adjtime:: adjtime option (-j) +* sntp authentication:: authentication option (-a) +* sntp broadcast:: broadcast option (-b) +* sntp ipv4:: ipv4 option (-4) +* sntp ipv6:: ipv6 option (-6) +* sntp keyfile:: keyfile option (-k) +* sntp kod:: kod option (-K) +* sntp logfile:: logfile option (-l) +* sntp normalverbose:: normalverbose option (-d) +* sntp settod:: settod option (-s) +* sntp syslog:: syslog option (-p) +* sntp timeout:: timeout option (-t) @end menu @node sntp usage @@ -46,8 +69,9 @@ This is the automatically generated usage text for sntp: @exampleindent 0 @example -sntp - standard SNTP program - Ver. 4.2.5p247-RC -USAGE: sntp [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... ... +sntp - standard Simple Network Time Protocol program - Ver. 4.2.6p5 +USAGE: sntp [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... \ + [ hostname-or-IP ...] Flg Arg Option-Name Description -4 no ipv4 Force IPv4 DNS name resolution - prohibits these options: @@ -59,8 +83,8 @@ USAGE: sntp [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... ... -K Str kod KoD history filename -p no syslog Logging with syslog - prohibits these options: - filelog - -l Str filelog Logging to specified logfile + logfile + -l Str logfile Log to specified logfile - prohibits these options: syslog -s no settod Set (step) the time with settimeofday() @@ -71,7 +95,7 @@ USAGE: sntp [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... ... settod -b Str broadcast Use broadcasts to the address specified for synchronisation -t Num timeout Specify the number of seconds to wait for broadcasts - -a Num authentication Enable authentication with the key keyno. This option is used as -a keyno + -a Num authentication Enable authentication with the key auth-keynumber -k Str keyfile Specify a keyfile. SNTP will look in this file for the key specified with -a opt version Output version information and exit -? no help Display extended usage information and exit @@ -81,27 +105,62 @@ USAGE: sntp [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... ... - disabled as --no-load-opts - may appear multiple times -Options are specified by doubled hyphens and their name -or by a single hyphen and the flag character. +Options are specified by doubled hyphens and their name or by a single +hyphen and the flag character. + + The following option preset mechanisms are supported: - - reading file /users/stenn/.ntprc - - reading file /deacon/backroom/snaps/ntp-stable/sntp/.ntprc + - reading file $HOME/.ntprc + - reading file ./.ntprc - examining environment variables named SNTP_* -.I sntp -can be used as a SNTP client to query a NTP or SNTP server and either display -the time or set the local system's time (given suitable privilege). It can be -run as an interactive command or in a -.I cron -job. -NTP is the Network Time Protocol (RFC 1305) and SNTP is the -Simple Network Time Protocol (RFC 2030, which supersedes RFC 1769). +sntp implements the Simple Network Time Protocol, and is used to query an +NTP or SNTP server and either display the time or set the local system's +time (given suitable privilege). + +It can be run interactively from the command line or as a cron job. + +NTP and SNTP are defined by RFC 5905, which obsoletes RFC 4330 and RFC +1305. please send bug reports to: http://bugs.ntp.org, bugs@@ntp.org @end example @exampleindent 4 +@node sntp adjtime +@subsection adjtime option (-j) +@cindex sntp-adjtime + +This is the ``set (slew) the time with adjtime()'' option. + +This option has some usage constraints. It: +@itemize @bullet +@item +must not appear in combination with any of the following options: +settod. +@end itemize + + + +@node sntp authentication +@subsection authentication option (-a) +@cindex sntp-authentication + +This is the ``enable authentication with the key auth-keynumber'' option. +This option enables authentication using the key specified in this option's argument. +The argument of this option is the keyid, a number specified in the keyfile as this +key's identifier. See the keyfile option (-k) for more details. + +@node sntp broadcast +@subsection broadcast option (-b) +@cindex sntp-broadcast + +This is the ``use broadcasts to the address specified for synchronisation'' option. +If specified SNTP will listen to the specified broadcast address +for NTP broadcasts. The default maximum wait time, +68 seconds, can be modified with -t. + @node sntp ipv4 @subsection ipv4 option (-4) @cindex sntp-ipv4 @@ -111,10 +170,11 @@ This is the ``force ipv4 dns name resolution'' option. This option has some usage constraints. It: @itemize @bullet @item -is a member of the ipv4 class of options. +must not appear in combination with any of the following options: +ipv6. @end itemize -Force DNS resolution of following host names on the command line +Force DNS resolution of the following host names on the command line to the IPv4 namespace. @node sntp ipv6 @@ -126,77 +186,70 @@ This is the ``force ipv6 dns name resolution'' option. This option has some usage constraints. It: @itemize @bullet @item -is a member of the ipv4 class of options. +must not appear in combination with any of the following options: +ipv4. @end itemize -Force DNS resolution of following host names on the command line +Force DNS resolution of the following host names on the command line to the IPv6 namespace. -@node sntp unprivport -@subsection unprivport option (-u) -@cindex sntp-unprivport +@node sntp keyfile +@subsection keyfile option (-k) +@cindex sntp-keyfile -This is the ``use an unprivileged port'' option. -Use an unprivilegded UDP port for our queries. +This is the ``specify a keyfile. sntp will look in this file for the key specified with -a'' option. +This option specifies the keyfile. SNTP will search for the key specified with -a keyno in this +file. Key files follow the following format: -@node sntp normalverbose -@subsection normalverbose option (-v) -@cindex sntp-normalverbose +keyid keytype key -This is the ``slightly verbose'' option. +Where keyid is a number identifying this key +keytype is one of the follow: +S Key in 64 Bit hexadecimal number as specified in in the DES specification. +N Key in 64 Bit hexadecimal number as specified in the NTP standard. +A Key in a 1-to-8 character ASCII string. +M Key in a 1-to-8 character ASCII string using the MD5 authentication scheme. -This option has some usage constraints. It: -@itemize @bullet -@item -must not appear in combination with any of the following options: -extraverbose, megaverbose. -@end itemize +For more information see ntp.keys(5). -Diagnostic messages for non-fatal errors and a limited amount of -tracing should be written to standard error. Fatal ones always -produce a diagnostic. This option should be set when there is a -suspected problem with the server, network or the source. +@node sntp kod +@subsection kod option (-K) +@cindex sntp-kod + +This is the ``kod history filename'' option. +Specifies the filename to be used to persist the history of KoD +responses received from servers. The default is +/var/db/ntp-kod. -@node sntp extraverbose -@subsection extraverbose option (-V) -@cindex sntp-extraverbose +@node sntp logfile +@subsection logfile option (-l) +@cindex sntp-logfile -This is the ``extra verbose'' option. +This is the ``log to specified logfile'' option. This option has some usage constraints. It: @itemize @bullet @item must not appear in combination with any of the following options: -normalverbose, megaverbose. +syslog. @end itemize -Produce more and less comprehensible output, mainly for investigating -problems with apparently inconsistent timestamps. This option should -be set when the program fails with a message indicating that is the -trouble. - -@node sntp megaverbose -@subsection megaverbose option (-W) -@cindex sntp-megaverbose - -This is the ``mega verbose'' option. +This option causes the client to write log messages to the specified +logfile. -This option has some usage constraints. It: -@itemize @bullet -@item -must not appear in combination with any of the following options: -normalverbose, extraverbose. -@end itemize +@node sntp normalverbose +@subsection normalverbose option (-d) +@cindex sntp-normalverbose -Very verbose debugging output that will interfere with the timing -when writing to the terminal (because of line buffered output from C). -Note that the times produced by this are the corrections needed, and -not the error in the local clock. This option should be set only when -debugging the source. +This is the ``normal verbose'' option. +Diagnostic messages for non-fatal errors and a limited amount of +tracing should be written to standard error. Fatal ones always +produce a diagnostic. This option should be set when there is a +suspected problem with the server, network or the source. -@node sntp settimeofday -@subsection settimeofday option (-r) -@cindex sntp-settimeofday +@node sntp settod +@subsection settod option (-s) +@cindex sntp-settod This is the ``set (step) the time with settimeofday()'' option. @@ -209,17 +262,25 @@ adjtime. -@node sntp adjtime -@subsection adjtime option (-a) -@cindex sntp-adjtime +@node sntp syslog +@subsection syslog option (-p) +@cindex sntp-syslog -This is the ``set (slew) the time with adjtime()'' option. +This is the ``logging with syslog'' option. This option has some usage constraints. It: @itemize @bullet @item must not appear in combination with any of the following options: -settimeofday. +logfile. @end itemize +When this option is set all logging will be done using syslog. + +@node sntp timeout +@subsection timeout option (-t) +@cindex sntp-timeout +This is the ``specify the number of seconds to wait for broadcasts'' option. +When waiting for a broadcast packet SNTP will wait the number +of seconds specified before giving up. Default 68 seconds. diff --git a/sntp/sntp.1 b/sntp/sntp.1 index 20c7d80..46fa639 100644 --- a/sntp/sntp.1 +++ b/sntp/sntp.1 @@ -1,279 +1,156 @@ -.TH SNTP 1 2009-12-08 "( 4.2.4p8)" "Programmer's Manual" +.TH SNTP 1 2011-12-24 "( 4.2.6p5)" "Programmer's Manual" .\" EDIT THIS FILE WITH CAUTION (sntp.1) .\" -.\" It has been AutoGen-ed Tuesday December 8, 2009 at 08:14:50 AM EST +.\" It has been AutoGen-ed December 24, 2011 at 06:33:59 PM by AutoGen 5.12 .\" From the definitions sntp-opts.def .\" and the template file agman1.tpl .\" .SH NAME -sntp \- standard SNTP program +sntp \- standard Simple Network Time Protocol program .SH SYNOPSIS .B sntp .\" Mixture of short (flag) options and long options .RB [ \-\fIflag\fP " [\fIvalue\fP]]... [" \--\fIopt-name\fP " [[=| ]\fIvalue\fP]]..." +.br +.in +8 +[ hostname-or-IP ...] .PP -All arguments must be options. + .SH "DESCRIPTION" -This manual page documents, briefly, the \fBsntp\fP command. +This manual page briefly documents the \fBsntp\fP command. .I sntp can be used as a SNTP client to query a NTP or SNTP server and either display the time or set the local system's time (given suitable privilege). It can be run as an interactive command or in a .I cron job. -NTP is the Network Time Protocol (RFC 1305) and SNTP is the -Simple Network Time Protocol (RFC 2030, which supersedes RFC 1769). -.SS Options -.PP -.I sntp -recognizes the following options: -.TP -.B \-v -indicates that diagnostic messages for non-fatal errors and a limited amount of -tracing should be written to standard error. Fatal ones always produce a -diagnostic. This option should be set when there is a suspected problem with -the server, network or the source. -.TP -.B \-V -requests more and less comprehensible output, mainly for investigating problems -with apparently inconsistent timestamps. This option should be set when the -program fails with a message indicating that is the trouble. -.TP -.B \-W -requests very verbose debugging output, and will interfere with the timing -when writing to the terminal (because of line buffered output from C). Note -that the times produced by this are the corrections needed, and not the error -in the local clock. This option should be set only when debugging the source. -.TP -.B \-q -indicates that it should query a daemon save file being maintained by it. -This needs no privilege and will change neither the save file nor the clock. -.PP -The default is that it should behave as a client, and the following options -are then relevant: -.TP -.B \-r -indicates that the system clock should be reset by -.IR settimeofday . -Naturally, this will work only if the user has enough privilege. -.TP -.B \-a -indicates that the system clock should be reset by -.IR adjtime . -Naturally, this will work only if the user has enough privilege. + +NTP (the Network Time Protocol) and SNTP (the Simple Network Time Protocol) +are defined and described by RFC 5905. + .PP The default is to write the estimated correct local date and time (i.e. not UTC) to the standard output in a format like -.BR "'1996 Oct 15 20:17:25.123 + 4.567 +/- 0.089 secs'" , +.BR "'1996-10-15 20:17:25.123 (+0800) +4.567 +/- 0.089 secs'" , where the -.B "'+ 4.567 +/- 0.089 secs'" -indicates the estimated error in the time on the local system. -.TP -.BI \-l " lockfile" -sets the name of the lock file to ensure that there is only -one copy of -.I sntp -running at once. The default is installation-dependent, but will usually be -.IR /etc/sntp.pid . -.TP -.BI \-e " minerr" -sets the maximum ignorable variation between the clocks to -.IR minerr . -Acceptable values are from 0.001 to 1, and the default is 0.1 if a NTP host is -is specified and 0.5 otherwise. -.TP -.BI \-E " maxerr" -sets the maximum value of various delays that are deemed acceptable to -.IR maxerr . -Acceptable values are from 1 to 60, and the default is 5. It should sometimes -be increased if there are problems with the network, NTP server or system -clock, but take care. -.TP -.BI \-P " prompt" -sets the maximum clock change that will be made automatically to -.IR maxerr . -Acceptable values are from 1 to 3600 or -.IR no , -and the default is 30. If the program is being run interactively in ordinary -client mode, and the system clock is to be changed, larger corrections will -prompt the user for confirmation. Specifying -.I no -will disable this and the correction will be made regardless. -.TP -.BI \-c " count" -sets the maximum number of NTP packets required to -.IR count . -Acceptable values are from 1 to 25 if a NTP host is specified and from 5 to 25 -otherwise, and the default is 5. If the maximum isn't enough, the system needs -a better consistency algorithm than this program uses. -.TP -.BI \-d " delay" -sets a rough limit on the total running time to -.I delay -seconds. Acceptable values are from 1 to 3600, and the default is 15 if a NTP -host is specified and 300 otherwise. -.TP -.B \-4 -force IPv4 DNS resolution. -.TP -.B \-6 -force IPv6 DNS resolution. -.PP -.B address(es) -are the DNS names or IP numbers of hosts to use for the challenge and response -protocol; if no names are given, the program waits for broadcasts. Polling a -server is vastly more reliable than listening to broadcasts. Note that a -single component numeric address is not allowed, to avoid ambiguities. If -more than one name is give, they will be used in a round-robin fashion. -.PP -Constraints: -.IP -.B minerr -must be less than -.B maxerr -which must be less than -.B delay -(or, if a NTP host is not specified -.BR delay / count ")," -and -.B count -must be less than half of -.BR delay . -.IP -In update mode, -.B maxerr -must be less than -.BR prompt. -.PP -Note that none of the above values are closely linked to the limits described -in the NTP protocol (RFC 1305). -.SH USAGE -The simplest use of this program is as an unprivileged command to check the -current time and error in the local clock. For example: -.IP -.B sntp ntpserver.somewhere -.PP -With suitable privilege, it can be run as a command or in a -.I cron -job to reset the local clock from a reliable server, like the -.I ntpdate -and -.I rdate -commands. For example: -.IP -.B sntp \-a ntpserver.somewhere -.PP -More information on how to use this utility is given in the -.I README -file in the distribution. In particular, this -.I man -page does not describe how to set it up as a server, which needs special care -to avoid propagating misinformation. -.SH RETURN VALUE -When used as a client in non-daemon mode, the program returns a zero exit -status for success, and a non-zero one otherwise. When used as a daemon -(either client or server), it does not return except after a serious error. -.SH BUGS -The program implements the SNTP protocol, and does not provide all NTP -facilities. In particular, it contains no checks against any form of spoofing. -If this is a serious concern, some network security mechanism (like a firewall -or even just -.IR tcpwrappers ) -should be installed. -.PP -There are some errors, ambiguities and inconsistencies in the RFCs, and this -code may not interwork with all other NTP implementations. Any unreasonable -restrictions should be reported as bugs to whoever is responsible. It may -be difficult to find out who that is. -.PP -The program will stop as soon as it feels that things have got out of control. -In client daemon mode, it will usually fail during an extended period of -network or server inaccessibility or excessively slow performance, or when the -local clock is reset by another process. It will then need restarting -manually. Experienced system administrators can write a shell script, a -.I cron -job or put it in -.IR inittab , -to do this automatically. -.PP -The error cannot be estimated reliably with broadcast packets or for the drift -in daemon mode (even with client-server packets), and the guess made by the -program may be wrong (possibly even very wrong). If this is a problem, then -setting the -.B \-c -option to a larger value may help. Or it may not. -.SH AUTHOR -.I sntp -was developed by N.M. Maclaren of the University of Cambridge Computing -Service. +.B "'(+0800)'" +means that to get to UTC from the reported local time one must +add 8 hours and 0 minutes, +and the +.B "'+4.567 +/- 0.089 secs'" +indicates the local clock is 4.567 seconds behind the correct time +(so 4.567 seconds must be added to the local clock to get it to be correct), +and the time of +'1996-10-15 20:17:25.123' +is believed to be correct to within ++/- 0.089 +seconds. .SH OPTIONS .TP .BR \-4 ", " \--ipv4 Force IPv4 DNS name resolution. -This option is a member of the ipv4 class of options. +This option must not appear in combination with any of the following options: +ipv6. .sp -Force DNS resolution of following host names on the command line +Force DNS resolution of the following host names on the command line to the IPv4 namespace. .TP .BR \-6 ", " \--ipv6 Force IPv6 DNS name resolution. -This option is a member of the ipv4 class of options. +This option must not appear in combination with any of the following options: +ipv4. .sp -Force DNS resolution of following host names on the command line +Force DNS resolution of the following host names on the command line to the IPv6 namespace. .TP -.BR \-u ", " \--unprivport -Use an unprivileged port. -.sp -Use an unprivilegded UDP port for our queries. -.TP -.BR \-v ", " \--normalverbose -Slightly verbose. -This option must not appear in combination with any of the following options: -extraverbose, megaverbose. +.BR \-d ", " \--normalverbose +Normal verbose. .sp Diagnostic messages for non-fatal errors and a limited amount of tracing should be written to standard error. Fatal ones always produce a diagnostic. This option should be set when there is a suspected problem with the server, network or the source. .TP -.BR \-V ", " \--extraverbose -Extra verbose. +.BR \-K " \fIfile-name\fP, " \--kod "=" \fIfile-name\fP +KoD history filename. +.sp +Specifies the filename to be used to persist the history of KoD +responses received from servers. The default is +/var/db/ntp-kod. +.TP +.BR \-p ", " \--syslog +Logging with syslog. This option must not appear in combination with any of the following options: -normalverbose, megaverbose. +logfile. .sp -Produce more and less comprehensible output, mainly for investigating -problems with apparently inconsistent timestamps. This option should -be set when the program fails with a message indicating that is the -trouble. +When this option is set all logging will be done using syslog. .TP -.BR \-W ", " \--megaverbose -Mega verbose. +.BR \-l " \fIfile-name\fP, " \--logfile "=" \fIfile-name\fP +Log to specified logfile. This option must not appear in combination with any of the following options: -normalverbose, extraverbose. +syslog. .sp -Very verbose debugging output that will interfere with the timing -when writing to the terminal (because of line buffered output from C). -Note that the times produced by this are the corrections needed, and -not the error in the local clock. This option should be set only when -debugging the source. +This option causes the client to write log messages to the specified +logfile. .TP -.BR \-r ", " \--settimeofday +.BR \-s ", " \--settod Set (step) the time with settimeofday(). This option must not appear in combination with any of the following options: adjtime. .sp .TP -.BR \-a ", " \--adjtime +.BR \-j ", " \--adjtime Set (slew) the time with adjtime(). This option must not appear in combination with any of the following options: -settimeofday. +settod. .sp .TP +.BR \-b " \fIbroadcast-address\fP, " \--broadcast "=" \fIbroadcast-address\fP +Use broadcasts to the address specified for synchronisation. +.sp +If specified SNTP will listen to the specified broadcast address +for NTP broadcasts. The default maximum wait time, +68 seconds, can be modified with \-t. +.TP +.BR \-t " \fIseconds\fP, " \--timeout "=" \fIseconds\fP +Specify the number of seconds to wait for broadcasts. +This option takes an integer number as its argument. +The default \fIseconds\fP for this option is: +.ti +4 + 68 +.sp +When waiting for a broadcast packet SNTP will wait the number +of seconds specified before giving up. Default 68 seconds. +.TP +.BR \-a " \fIauth-keynumber\fP, " \--authentication "=" \fIauth-keynumber\fP +Enable authentication with the key auth-keynumber. +This option takes an integer number as its argument. +.sp +This option enables authentication using the key specified in this option's argument. +The argument of this option is the keyid, a number specified in the keyfile as this +key's identifier. See the keyfile option (-k) for more details. +.TP +.BR \-k " \fIfile-name\fP, " \--keyfile "=" \fIfile-name\fP +Specify a keyfile. SNTP will look in this file for the key specified with \-a. +.sp +This option specifies the keyfile. SNTP will search for the key specified with \-a keyno in this +file. Key files follow the following format: + +keyid keytype key + +Where keyid is a number identifying this key +keytype is one of the follow: +S Key in 64 Bit hexadecimal number as specified in in the DES specification. +N Key in 64 Bit hexadecimal number as specified in the NTP standard. +A Key in a 1-to-8 character ASCII string. +M Key in a 1-to-8 character ASCII string using the MD5 authentication scheme. + +For more information see ntp.keys(5). +.TP .BR \-? , " \--help" -Display usage information and exit. +Display extended usage information and exit. .TP .BR \-! , " \--more-help" Extended usage information passed thru pager. @@ -288,7 +165,7 @@ The \fIno-load-opts\fP form will disable the loading of earlier RC/INI files. \fI--no-load-opts\fP is handled early, out of order. .TP -.BR \-v " [{\fIv|c|n\fP}]," " \--version" "[=\fI{v|c|n}\fP]" +.BR \- " [{\fIv|c|n\fP}]," " \--version" "[=\fI{v|c|n}\fP]" Output version of program and exit. The default mode is `v', a simple version. The `c' mode will print copyright information and `n' will print the full copyright notice. @@ -299,100 +176,42 @@ environment variables named: .nf \fBSNTP_<option-name>\fP or \fBSNTP\fP .fi -.aj +.ad The environmental presets take precedence (are processed later than) the configuration files. The \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP". If any of these are directories, then the file \fI.ntprc\fP is searched for within those directories. +.SH USAGE +The simplest use of this program is as an unprivileged command to check the +current time and error in the local clock. For example: +.IP +.B sntp ntpserver.somewhere +.PP +With suitable privilege, it can be run as a command or in a +.I cron +job to reset the local clock from a reliable server, like the +.I ntpdate +and +.I rdate +commands. For example: +.IP +.B sntp \-a ntpserver.somewhere +.SH RETURN VALUE +The program returns a zero exit +status for success, and a non-zero one otherwise. +.SH BUGS +Please report bugs to http://bugs.ntp.org . .SH AUTHOR -ntp.org +David L. Mills and/or others .br Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org .PP .nf .na - General Public Licence for the software known as MSNTP - \------------------------------------------------------ - - (c) Copyright, N.M. Maclaren, 1996, 1997, 2000 - (c) Copyright, University of Cambridge, 1996, 1997, 2000 - - - -Free use of MSNTP in source and binary forms is permitted, provided that this -entire licence is duplicated in all copies, and that any documentation, -announcements, and other materials related to use acknowledge that the software -was developed by N.M. Maclaren (hereafter refered to as the Author) at the -University of Cambridge. Neither the name of the Author nor the University of -Cambridge may be used to endorse or promote products derived from this material -without specific prior written permission. - -The Author and the University of Cambridge retain the copyright and all other -legal rights to the software and make it available non-exclusively. All users -must ensure that the software in all its derivations carries a copyright notice -in the form: - (c) Copyright N.M. Maclaren, - (c) Copyright University of Cambridge. - - - - NO WARRANTY - -Because the MSNTP software is licensed free of charge, the Author and the -University of Cambridge provide absolutely no warranty, either expressed or -implied, including, but not limited to, the implied warranties of -merchantability and fitness for a particular purpose. The entire risk as to -the quality and performance of the MSNTP software is with you. Should MSNTP -prove defective, you assume the cost of all necessary servicing or repair. - -In no event, unless required by law, will the Author or the University of -Cambridge, or any other party who may modify and redistribute this software as -permitted in accordance with the provisions below, be liable for damages for -any losses whatsoever, including but not limited to lost profits, lost monies, -lost or corrupted data, or other special, incidental or consequential losses -that may arise out of the use or inability to use the MSNTP software. - - - - COPYING POLICY - -Permission is hereby granted for copying and distribution of copies of the -MSNTP source and binary files, and of any part thereof, subject to the -following licence conditions: - -1. You may distribute MSNTP or components of MSNTP, with or without additions -developed by you or by others. No charge, other than an "at-cost" distribution -fee, may be charged for copies, derivations, or distributions of this material -without the express written consent of the copyright holders. - -2. You may also distribute MSNTP along with any other product for sale, -provided that the cost of the bundled package is the same regardless of whether -MSNTP is included or not, and provided that those interested only in MSNTP must -be notified that it is a product freely available from the University of -Cambridge. - -3. If you distribute MSNTP software or parts of MSNTP, with or without -additions developed by you or others, then you must either make available the -source to all portions of the MSNTP system (exclusive of any additions made by -you or by others) upon request, or instead you may notify anyone requesting -source that it is freely available from the University of Cambridge. - -4. You may not omit any of the copyright notices on either the source files, -the executable files, or the documentation. - -5. You may not omit transmission of this License agreement with whatever -portions of MSNTP that are distributed. - -6. Any users of this software must be notified that it is without warranty or -guarantee of any nature, express or implied, nor is there any fitness for use -represented. - +see html/copyright.html -October 1996 -April 1997 -October 2000 .fi .ad .PP diff --git a/sntp/sntp.c b/sntp/sntp.c new file mode 100644 index 0000000..bdc8e4e --- /dev/null +++ b/sntp/sntp.c @@ -0,0 +1,14 @@ +#include <config.h> + +#include "main.h" + +volatile int debug; + +int +main ( + int argc, + char **argv + ) +{ + return sntp_main(argc, argv); +} diff --git a/sntp/sntp.html b/sntp/sntp.html new file mode 100644 index 0000000..b043f40 --- /dev/null +++ b/sntp/sntp.html @@ -0,0 +1,452 @@ +<html lang="en"> +<head> +<title>Sntp User's Manual</title> +<meta http-equiv="Content-Type" content="text/html"> +<meta name="description" content="Sntp User's Manual"> +<meta name="generator" content="makeinfo 4.7"> +<link title="Top" rel="top" href="#Top"> +<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> +<meta http-equiv="Content-Style-Type" content="text/css"> +<style type="text/css"><!-- + pre.display { font-family:inherit } + pre.format { font-family:inherit } + pre.smalldisplay { font-family:inherit; font-size:smaller } + pre.smallformat { font-family:inherit; font-size:smaller } + pre.smallexample { font-size:smaller } + pre.smalllisp { font-size:smaller } + span.sc { font-variant:small-caps } + span.roman { font-family: serif; font-weight: normal; } +--></style> +</head> +<body> +<h1 class="settitle">Sntp User's Manual</h1> +<div class="node"> +<p><hr> +<a name="Top"></a>Next: <a rel="next" accesskey="n" href="#sntp-Description">sntp Description</a>, +Previous: <a rel="previous" accesskey="p" href="#dir">(dir)</a>, +Up: <a rel="up" accesskey="u" href="#dir">(dir)</a> +<br> +</div> + +<h2 class="unnumbered">Simple Network Time Protocol User Manual</h2> + +<p>This document describes the use of the NTP Project's <code>sntp</code> program, +that can be used to query a Network Time Protocol (NTP) server and +display the time offset of the system clock relative to the server +clock. Run as root, it can correct the system clock to this offset as +well. It can be run as an interactive command or from a cron job. + + <p>This document applies to version 4.2.6p5 of <code>sntp</code>. + + <p>The program implements the SNTP protocol as defined by RFC 5905, the NTPv4 +IETF specification. + + <div class="shortcontents"> +<h2>Short Contents</h2> +<ul> +<a href="#Top">Simple Network Time Protocol User Manual</a> +</ul> +</div> + +<ul class="menu"> +<li><a accesskey="1" href="#sntp-Description">sntp Description</a>: Description +<li><a accesskey="2" href="#sntp-Invocation">sntp Invocation</a>: Invoking sntp +<li><a accesskey="3" href="#Usage">Usage</a>: Usage +</ul> + +<div class="node"> +<p><hr> +<a name="sntp-Description"></a> +<br> +</div> + +<!-- node-name, next, previous, up --> +<h3 class="section">Description</h3> + +<p>By default, <code>sntp</code> writes the local data and time (i.e., not UTC) to the +standard output in the format: + +<pre class="example"> 1996 Oct 15 20:17:25.123 +4.567 +/- 0.089 secs +</pre> + <p>where the +4.567 +/- 0.089 secs indicates the time offset and +error bound of the system clock relative to the server clock. + +<div class="node"> +<p><hr> +<a name="sntp-Invocation"></a> +<br> +</div> + +<h3 class="section">Invoking sntp</h3> + +<p><a name="index-sntp-1"></a><a name="index-standard-Simple-Network-Time-Protocol-program-2"></a> +<code>sntp</code> +can be used as a SNTP client to query a NTP or SNTP server and either display +the time or set the local system's time (given suitable privilege). It can be +run as an interactive command or in a +<code>cron</code> +job. + + <p>NTP (the Network Time Protocol) and SNTP (the Simple Network Time Protocol) +are defined and described by RFC 5905. + + <p class="indent">The default is to write the estimated correct local date and time (i.e. not +UTC) to the standard output in a format like +<pre class="example"> 1996-10-15 20:17:25.123 (+0800) +4.567 +/- 0.089 secs +</pre> + <p>where the +<pre class="example"> +4.567 +/- 0.089 secs +</pre> + <p>indicates the local clock is 4.567 seconds behind the correct time +(so 4.567 seconds must be added to the local clock to get it to be correct), +and the (local) time of +<code>1996-10-15 20:17:25.123</code> +can be converted to UTC time by adding 8 hours and 0 minutes, and +is believed to be correct to within +<code>+/- 0.089</code> +seconds. + + <p>This section was generated by <strong>AutoGen</strong>, +the aginfo template and the option descriptions for the <span class="command">sntp</span> program. It documents the <span class="command">sntp</span> usage text and option meanings. + + <p>This software is released under a specialized copyright license. + +<ul class="menu"> +<li><a accesskey="1" href="#sntp-usage">sntp usage</a>: sntp usage help (-?) +<li><a accesskey="2" href="#sntp-adjtime">sntp adjtime</a>: adjtime option (-j) +<li><a accesskey="3" href="#sntp-authentication">sntp authentication</a>: authentication option (-a) +<li><a accesskey="4" href="#sntp-broadcast">sntp broadcast</a>: broadcast option (-b) +<li><a accesskey="5" href="#sntp-ipv4">sntp ipv4</a>: ipv4 option (-4) +<li><a accesskey="6" href="#sntp-ipv6">sntp ipv6</a>: ipv6 option (-6) +<li><a accesskey="7" href="#sntp-keyfile">sntp keyfile</a>: keyfile option (-k) +<li><a accesskey="8" href="#sntp-kod">sntp kod</a>: kod option (-K) +<li><a accesskey="9" href="#sntp-logfile">sntp logfile</a>: logfile option (-l) +<li><a href="#sntp-normalverbose">sntp normalverbose</a>: normalverbose option (-d) +<li><a href="#sntp-settod">sntp settod</a>: settod option (-s) +<li><a href="#sntp-syslog">sntp syslog</a>: syslog option (-p) +<li><a href="#sntp-timeout">sntp timeout</a>: timeout option (-t) +</ul> + +<div class="node"> +<p><hr> +<a name="sntp-usage"></a>Next: <a rel="next" accesskey="n" href="#sntp-adjtime">sntp adjtime</a>, +Up: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> +<br> +</div> + +<h4 class="subsection">sntp usage help (-?)</h4> + +<p><a name="index-sntp-usage-3"></a> +This is the automatically generated usage text for sntp: + +<pre class="example">sntp - standard Simple Network Time Protocol program - Ver. 4.2.6p5 +USAGE: sntp [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \ + [ hostname-or-IP ...] + Flg Arg Option-Name Description + -4 no ipv4 Force IPv4 DNS name resolution + - prohibits these options: + ipv6 + -6 no ipv6 Force IPv6 DNS name resolution + - prohibits these options: + ipv4 + -d no normalverbose Normal verbose + -K Str kod KoD history filename + -p no syslog Logging with syslog + - prohibits these options: + logfile + -l Str logfile Log to specified logfile + - prohibits these options: + syslog + -s no settod Set (step) the time with settimeofday() + - prohibits these options: + adjtime + -j no adjtime Set (slew) the time with adjtime() + - prohibits these options: + settod + -b Str broadcast Use broadcasts to the address specified for synchronisation + -t Num timeout Specify the number of seconds to wait for broadcasts + -a Num authentication Enable authentication with the key auth-keynumber + -k Str keyfile Specify a keyfile. SNTP will look in this file for the key specified with -a + opt version Output version information and exit + -? no help Display extended usage information and exit + -! no more-help Extended usage information passed thru pager + -> opt save-opts Save the option state to a config file + -< Str load-opts Load options from a config file + - disabled as --no-load-opts + - may appear multiple times + +Options are specified by doubled hyphens and their name or by a single +hyphen and the flag character. + + + +The following option preset mechanisms are supported: + - reading file $HOME/.ntprc + - reading file ./.ntprc + - examining environment variables named SNTP_* + +sntp implements the Simple Network Time Protocol, and is used to query an +NTP or SNTP server and either display the time or set the local system's +time (given suitable privilege). + +It can be run interactively from the command line or as a cron job. + +NTP and SNTP are defined by RFC 5905, which obsoletes RFC 4330 and RFC +1305. + +please send bug reports to: http://bugs.ntp.org, bugs@ntp.org +</pre> + <div class="node"> +<p><hr> +<a name="sntp-adjtime"></a>Next: <a rel="next" accesskey="n" href="#sntp-authentication">sntp authentication</a>, +Previous: <a rel="previous" accesskey="p" href="#sntp-usage">sntp usage</a>, +Up: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> +<br> +</div> + +<h4 class="subsection">adjtime option (-j)</h4> + +<p><a name="index-sntp_002dadjtime-4"></a> +This is the “set (slew) the time with adjtime()” option. + + <p>This option has some usage constraints. It: + <ul> +<li>must not appear in combination with any of the following options: +settod. +</ul> + +<div class="node"> +<p><hr> +<a name="sntp-authentication"></a>Next: <a rel="next" accesskey="n" href="#sntp-broadcast">sntp broadcast</a>, +Previous: <a rel="previous" accesskey="p" href="#sntp-adjtime">sntp adjtime</a>, +Up: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> +<br> +</div> + +<h4 class="subsection">authentication option (-a)</h4> + +<p><a name="index-sntp_002dauthentication-5"></a> +This is the “enable authentication with the key auth-keynumber” option. +This option enables authentication using the key specified in this option's argument. +The argument of this option is the keyid, a number specified in the keyfile as this +key's identifier. See the keyfile option (-k) for more details. + +<div class="node"> +<p><hr> +<a name="sntp-broadcast"></a>Next: <a rel="next" accesskey="n" href="#sntp-ipv4">sntp ipv4</a>, +Previous: <a rel="previous" accesskey="p" href="#sntp-authentication">sntp authentication</a>, +Up: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> +<br> +</div> + +<h4 class="subsection">broadcast option (-b)</h4> + +<p><a name="index-sntp_002dbroadcast-6"></a> +This is the “use broadcasts to the address specified for synchronisation” option. +If specified SNTP will listen to the specified broadcast address +for NTP broadcasts. The default maximum wait time, +68 seconds, can be modified with -t. + +<div class="node"> +<p><hr> +<a name="sntp-ipv4"></a>Next: <a rel="next" accesskey="n" href="#sntp-ipv6">sntp ipv6</a>, +Previous: <a rel="previous" accesskey="p" href="#sntp-broadcast">sntp broadcast</a>, +Up: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> +<br> +</div> + +<h4 class="subsection">ipv4 option (-4)</h4> + +<p><a name="index-sntp_002dipv4-7"></a> +This is the “force ipv4 dns name resolution” option. + + <p>This option has some usage constraints. It: + <ul> +<li>must not appear in combination with any of the following options: +ipv6. +</ul> + + <p>Force DNS resolution of the following host names on the command line +to the IPv4 namespace. + +<div class="node"> +<p><hr> +<a name="sntp-ipv6"></a>Next: <a rel="next" accesskey="n" href="#sntp-keyfile">sntp keyfile</a>, +Previous: <a rel="previous" accesskey="p" href="#sntp-ipv4">sntp ipv4</a>, +Up: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> +<br> +</div> + +<h4 class="subsection">ipv6 option (-6)</h4> + +<p><a name="index-sntp_002dipv6-8"></a> +This is the “force ipv6 dns name resolution” option. + + <p>This option has some usage constraints. It: + <ul> +<li>must not appear in combination with any of the following options: +ipv4. +</ul> + + <p>Force DNS resolution of the following host names on the command line +to the IPv6 namespace. + +<div class="node"> +<p><hr> +<a name="sntp-keyfile"></a>Next: <a rel="next" accesskey="n" href="#sntp-kod">sntp kod</a>, +Previous: <a rel="previous" accesskey="p" href="#sntp-ipv6">sntp ipv6</a>, +Up: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> +<br> +</div> + +<h4 class="subsection">keyfile option (-k)</h4> + +<p><a name="index-sntp_002dkeyfile-9"></a> +This is the “specify a keyfile. sntp will look in this file for the key specified with -a” option. +This option specifies the keyfile. SNTP will search for the key specified with -a keyno in this +file. Key files follow the following format: + + <p>keyid keytype key + + <p>Where keyid is a number identifying this key +keytype is one of the follow: +S Key in 64 Bit hexadecimal number as specified in in the DES specification. +N Key in 64 Bit hexadecimal number as specified in the NTP standard. +A Key in a 1-to-8 character ASCII string. +M Key in a 1-to-8 character ASCII string using the MD5 authentication scheme. + + <p>For more information see ntp.keys(5). + +<div class="node"> +<p><hr> +<a name="sntp-kod"></a>Next: <a rel="next" accesskey="n" href="#sntp-logfile">sntp logfile</a>, +Previous: <a rel="previous" accesskey="p" href="#sntp-keyfile">sntp keyfile</a>, +Up: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> +<br> +</div> + +<h4 class="subsection">kod option (-K)</h4> + +<p><a name="index-sntp_002dkod-10"></a> +This is the “kod history filename” option. +Specifies the filename to be used to persist the history of KoD +responses received from servers. The default is +/var/db/ntp-kod. + +<div class="node"> +<p><hr> +<a name="sntp-logfile"></a>Next: <a rel="next" accesskey="n" href="#sntp-normalverbose">sntp normalverbose</a>, +Previous: <a rel="previous" accesskey="p" href="#sntp-kod">sntp kod</a>, +Up: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> +<br> +</div> + +<h4 class="subsection">logfile option (-l)</h4> + +<p><a name="index-sntp_002dlogfile-11"></a> +This is the “log to specified logfile” option. + + <p>This option has some usage constraints. It: + <ul> +<li>must not appear in combination with any of the following options: +syslog. +</ul> + + <p>This option causes the client to write log messages to the specified +logfile. + +<div class="node"> +<p><hr> +<a name="sntp-normalverbose"></a>Next: <a rel="next" accesskey="n" href="#sntp-settod">sntp settod</a>, +Previous: <a rel="previous" accesskey="p" href="#sntp-logfile">sntp logfile</a>, +Up: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> +<br> +</div> + +<h4 class="subsection">normalverbose option (-d)</h4> + +<p><a name="index-sntp_002dnormalverbose-12"></a> +This is the “normal verbose” option. +Diagnostic messages for non-fatal errors and a limited amount of +tracing should be written to standard error. Fatal ones always +produce a diagnostic. This option should be set when there is a +suspected problem with the server, network or the source. + +<div class="node"> +<p><hr> +<a name="sntp-settod"></a>Next: <a rel="next" accesskey="n" href="#sntp-syslog">sntp syslog</a>, +Previous: <a rel="previous" accesskey="p" href="#sntp-normalverbose">sntp normalverbose</a>, +Up: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> +<br> +</div> + +<h4 class="subsection">settod option (-s)</h4> + +<p><a name="index-sntp_002dsettod-13"></a> +This is the “set (step) the time with settimeofday()” option. + + <p>This option has some usage constraints. It: + <ul> +<li>must not appear in combination with any of the following options: +adjtime. +</ul> + +<div class="node"> +<p><hr> +<a name="sntp-syslog"></a>Next: <a rel="next" accesskey="n" href="#sntp-timeout">sntp timeout</a>, +Previous: <a rel="previous" accesskey="p" href="#sntp-settod">sntp settod</a>, +Up: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> +<br> +</div> + +<h4 class="subsection">syslog option (-p)</h4> + +<p><a name="index-sntp_002dsyslog-14"></a> +This is the “logging with syslog” option. + + <p>This option has some usage constraints. It: + <ul> +<li>must not appear in combination with any of the following options: +logfile. +</ul> + + <p>When this option is set all logging will be done using syslog. + +<div class="node"> +<p><hr> +<a name="sntp-timeout"></a>Previous: <a rel="previous" accesskey="p" href="#sntp-syslog">sntp syslog</a>, +Up: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> +<br> +</div> + +<h4 class="subsection">timeout option (-t)</h4> + +<p><a name="index-sntp_002dtimeout-15"></a> +This is the “specify the number of seconds to wait for broadcasts” option. +When waiting for a broadcast packet SNTP will wait the number +of seconds specified before giving up. Default 68 seconds. + +<div class="node"> +<p><hr> +<a name="Usage"></a> +<br> +</div> + +<!-- node-name, next, previous, up --> +<h3 class="section">Usage</h3> + +<p>The simplest use of this program is as an unprivileged command to +check the current time, offset, and error in the local clock. +For example: + +<pre class="example"> sntp ntpserver.somewhere +</pre> + <p>With suitable privilege, it can be run as a command or in a +<code>crom</code> job to reset the local clock from a reliable server, like +the <code>ntpdate</code> and <code>rdate</code> commands. +For example: + +<pre class="example"> sntp -a ntpserver.somewhere +</pre> + </body></html> + diff --git a/sntp/sntp.texi b/sntp/sntp.texi new file mode 100644 index 0000000..482cf1e --- /dev/null +++ b/sntp/sntp.texi @@ -0,0 +1,84 @@ +\input texinfo @c -*-texinfo-*- +@c %**start of header +@setfilename sntp.info +@settitle Sntp User's Manual +@include version.texi +@paragraphindent 2 +@c %**end of header + +@ifinfo +This file documents the use of the NTP Project's SNTP, a program for +querying and setting the time. +@end ifinfo + +@direntry +* sntp: (sntp). Simple Network Time Protocol +@end direntry + +@titlepage +@title Simple Network Time Protocol User's Manual +@subtitle sntp, version @value{VERSION}, @value{UPDATED} +@c @author Max @email{foo@ntp.org} +@end titlepage + +@c @page +@c @vskip 0pt plus 1filll + +@node Top, sntp Description, (dir), (dir) +@top Simple Network Time Protocol User Manual + +This document describes the use of the NTP Project's @code{sntp} program, +that can be used to query a Network Time Protocol (NTP) server and +display the time offset of the system clock relative to the server +clock. Run as root, it can correct the system clock to this offset as +well. It can be run as an interactive command or from a cron job. + +This document applies to version @value{VERSION} of @code{sntp}. + +The program implements the SNTP protocol as defined by RFC 5905, the NTPv4 +IETF specification. + +@shortcontents + +@menu +* sntp Description:: Description +* sntp Invocation:: Invoking sntp +* Usage:: Usage +@end menu + +@node sntp Description +@comment node-name, next, previous, up +@section Description + +By default, @code{sntp} writes the local data and time (i.e., not UTC) to the +standard output in the format: + +@example +1996 Oct 15 20:17:25.123 +4.567 +/- 0.089 secs +@end example + +where the +4.567 +/- 0.089 secs indicates the time offset and +error bound of the system clock relative to the server clock. + +@include sntp-opts.texi + +@node Usage +@comment node-name, next, previous, up +@section Usage + +The simplest use of this program is as an unprivileged command to +check the current time, offset, and error in the local clock. +For example: + +@example +sntp ntpserver.somewhere +@end example + +With suitable privilege, it can be run as a command or in a +@code{crom} job to reset the local clock from a reliable server, like +the @code{ntpdate} and @code{rdate} commands. +For example: + +@example +sntp -a ntpserver.somewhere +@end example diff --git a/sntp/socket.c b/sntp/socket.c deleted file mode 100644 index 02fabb8..0000000 --- a/sntp/socket.c +++ /dev/null @@ -1,385 +0,0 @@ -/* Copyright (C) 1996, 2000 N.M. Maclaren - Copyright (C) 1996, 2000 The University of Cambridge - -This includes all of the code needed to handle Berkeley sockets. It is way -outside current POSIX, unfortunately. It should be easy to convert to a system -that uses another mechanism. It does not currently use socklen_t, because -the only system that the author uses that has it is Linux. */ - - - -#include "config.h" - -#include "header.h" -#include "internet.h" -#include <fcntl.h> - -#define SOCKET -#include "kludges.h" -#undef SOCKET - - - -/* The code needs to set some variables during the open, for use by later -functions. */ - -static int initial = 1, - descriptors[MAX_SOCKETS]; - -#ifdef HAVE_IPV6 -static struct sockaddr_storage here[MAX_SOCKETS], there[MAX_SOCKETS]; -#else -static struct sockaddr_in here[MAX_SOCKETS], there[MAX_SOCKETS]; -#endif - -void display_in_hex(const void *, int); -#ifdef HAVE_IPV6 -void display_sock_in_hex(struct sockaddr_storage *); -#else -void display_sock_in_hex (struct sockaddr_in *); -#endif - -/* There needs to be some disgusting grobble for handling timeouts, that is -identical to the grobble in internet.c. */ - -static jmp_buf jump_buffer; - -static void jump_handler (int sig) { - longjmp(jump_buffer,1); -} - -static void clear_alarm (void) { - int k; - - k = errno; - alarm(0); - errno = 0; - if (signal(SIGALRM,SIG_DFL) == SIG_ERR) - fatal(1,"unable to reset signal handler",NULL); - errno = k; -} - - - -void display_in_hex (const void *data, int length) { - int i; - - for (i = 0; i < length; ++i) - fprintf(stderr,"%.2x",((const unsigned char *)data)[i]); -} - -#ifdef HAVE_IPV6 - -void display_sock_in_hex (struct sockaddr_storage *sock) { - int family; - struct sockaddr_in *sin; - struct sockaddr_in6 *sin6; - - family = sock->ss_family; - switch(family) { - case AF_INET: - sin = (struct sockaddr_in *)sock; - display_in_hex(&sin->sin_addr, sizeof(struct in_addr)); - fprintf(stderr,"/"); - display_in_hex(&sin->sin_port, 2); - break; - case AF_INET6: - sin6 = (struct sockaddr_in6 *)sock; - display_in_hex(&sin6->sin6_addr, sizeof(struct in6_addr)); - fprintf(stderr,"/"); - display_in_hex(&sin6->sin6_port, 2); - break; - } -} - -#else - -void display_sock_in_hex (struct sockaddr_in *sock) { - int family, len; - struct sockaddr_in *sin; - - family = sock->sin_family; - switch(family) { - case AF_INET: - sin = (struct sockaddr_in *)sock; - display_in_hex(&sin->sin_addr, sizeof(struct in_addr)); - fprintf(stderr,"/"); - display_in_hex(&sin->sin_port, 2); - break; - } -} -#endif - -extern int unprivport; - -#ifdef HAVE_IPV6 - -void open_socket (int which, char *hostname, int timespan) { - -/* Locate the specified NTP server, set up a couple of addresses and open a -socket. */ - - int port, k, sl; - struct sockaddr_storage address, anywhere; - -/* Initialise and find out the server and port number. Note that the port -number is in network format. */ - - if (initial) - for (k = 0; k < MAX_SOCKETS; ++k) - descriptors[k] = -1; - initial = 0; - if (which < 0 || which >= MAX_SOCKETS || descriptors[which] >= 0) - fatal(0,"socket index out of range or already open",NULL); - if (verbose > 2) - fprintf(stderr,"Looking for the socket addresses\n"); - find_address(&address,&anywhere,&port,hostname,timespan); - if (verbose > 2) { - fprintf(stderr,"Internet address: address="); - display_sock_in_hex(&address); - fprintf(stderr," anywhere="); - display_sock_in_hex(&anywhere); - fputc('\n',stderr); - } - -/* Set up our own and the target addresses. Note that the target address will -be reset before use in server mode. */ - - memset(&here[which], 0, sizeof(struct sockaddr_storage)); - here[which] = anywhere; - if (operation != op_listen || unprivport) - ((struct sockaddr_in6 *)&here[which])->sin6_port = 0; - memset(&there[which], 0, sizeof(struct sockaddr_storage)); - there[which] = address; - if (verbose > 2) { - fprintf(stderr,"Initial sockets: here="); - display_sock_in_hex(&here[which]); - fprintf(stderr," there="); - display_sock_in_hex(&there[which]); - fputc('\n',stderr); - } - -/* Allocate a local UDP socket and configure it. */ - - switch(((struct sockaddr_in *)&there[which])->sin_family) { - case AF_INET: - sl = sizeof(struct sockaddr_in); - break; -#ifdef HAVE_IPV6 - case AF_INET6: - sl = sizeof(struct sockaddr_in6); - break; -#endif - default: - sl = 0; - break; - } - errno = 0; - if ((descriptors[which] = socket(here[which].ss_family,SOCK_DGRAM,0)) < 0 - || bind(descriptors[which],(struct sockaddr *)&here[which], sl) < 0) - fatal(1,"unable to allocate socket for NTP",NULL); -} - -#else - -void open_socket (int which, char *hostname, int timespan) { - -/* Locate the specified NTP server, set up a couple of addresses and open a -socket. */ - - int port, k; - struct in_addr address, anywhere; - -/* Initialise and find out the server and port number. Note that the port -number is in network format. */ - - if (initial) for (k = 0; k < MAX_SOCKETS; ++k) descriptors[k] = -1; - initial = 0; - if (which < 0 || which >= MAX_SOCKETS || descriptors[which] >= 0) - fatal(0,"socket index out of range or already open",NULL); - if (verbose > 2) fprintf(stderr,"Looking for the socket addresses\n"); - find_address(&address,&anywhere,&port,hostname,timespan); - if (verbose > 2) { - fprintf(stderr,"Internet address: address="); - display_in_hex(&address,sizeof(struct in_addr)); - fprintf(stderr," anywhere="); - display_in_hex(&anywhere,sizeof(struct in_addr)); - fputc('\n',stderr); - } - -/* Set up our own and the target addresses. */ - - memset(&here[which],0,sizeof(struct sockaddr_in)); - here[which].sin_family = AF_INET; - here[which].sin_port = - (operation == op_listen || !unprivport ? port : 0); - here[which].sin_addr = anywhere; - memset(&there[which],0,sizeof(struct sockaddr_in)); - there[which].sin_family = AF_INET; - there[which].sin_port = port; - there[which].sin_addr = address; - if (verbose > 2) { - fprintf(stderr,"Initial sockets: here="); - display_in_hex(&here[which].sin_addr,sizeof(struct in_addr)); - fputc('/',stderr); - display_in_hex(&here[which].sin_port,sizeof(here[which].sin_port)); - fprintf(stderr," there="); - display_in_hex(&there[which].sin_addr,sizeof(struct in_addr)); - fputc('/',stderr); - display_in_hex(&there[which].sin_port,sizeof(there[which].sin_port)); - fputc('\n',stderr); - } - -/* Allocate a local UDP socket and configure it. */ - - errno = 0; - if ((descriptors[which] = socket(AF_INET,SOCK_DGRAM,0)) < 0 || - bind(descriptors[which],(struct sockaddr *)&here[which], - sizeof(here[which])) < 0) - fatal(1,"unable to allocate socket for NTP",NULL); -} - -#endif - -extern void write_socket (int which, void *packet, int length) { - -/* Any errors in doing this are fatal - including blocking. Yes, this leaves a -server vulnerable to a denial of service attack. */ - - int k, sl; - - switch(((struct sockaddr_in *)&there[which])->sin_family) { - case AF_INET: - sl = sizeof(struct sockaddr_in); - break; -#ifdef HAVE_IPV6 - case AF_INET6: - sl = sizeof(struct sockaddr_in6); - break; -#endif - default: - sl = 0; - break; - } - if (which < 0 || which >= MAX_SOCKETS || descriptors[which] < 0) - fatal(0,"socket index out of range or not open",NULL); - errno = 0; - k = sendto(descriptors[which],packet,(size_t)length,0, - (struct sockaddr *)&there[which],sl); - if (k != length) fatal(1,"unable to send NTP packet",NULL); -} - - - -extern int read_socket (int which, void *packet, int length, int waiting) { - -/* Read a packet and return its length or -1 for failure. Only incorrect -length and timeout are not fatal. */ - -#ifdef HAVE_IPV6 - struct sockaddr_storage scratch, *ptr; -#else - struct sockaddr_in scratch, *ptr; -#endif - int n; - int k; - -/* Under normal circumstances, set up a timeout. */ - - if (which < 0 || which >= MAX_SOCKETS || descriptors[which] < 0) - fatal(0,"socket index out of range or not open",NULL); - if (waiting > 0) { - if (setjmp(jump_buffer)) { - if (verbose > 2) - fprintf(stderr,"Receive timed out\n"); - else if (verbose > 1) - fprintf(stderr,"%s: receive timed out after %d seconds\n", - argv0,waiting); - return -1; - } - errno = 0; - if (signal(SIGALRM,jump_handler) == SIG_ERR) - fatal(1,"unable to set up signal handler",NULL); - alarm((unsigned int)waiting); - } - -/* Get the packet and clear the timeout, if any. */ - - memcpy(ptr = &scratch,&there[which],sizeof(scratch)); - n = sizeof(scratch); - errno = 0; - k = recvfrom(descriptors[which],packet,(size_t)length,0, - (struct sockaddr *)ptr,&n); - if (waiting > 0) clear_alarm(); - -/* Now issue some low-level diagnostics. */ - - if (k <= 0) fatal(1,"unable to receive NTP packet from server",NULL); - if (verbose > 2) { - fprintf(stderr,"Packet of length %d received from ",k); - display_sock_in_hex(ptr); - fputc('\n',stderr); - } - return k; -} - - - -extern int flush_socket (int which) { - -/* Get rid of any outstanding input, because it may have been hanging around -for a while. Ignore packet length oddities and return the number of packets -skipped. */ - -#ifdef HAVE_IPV6 - struct sockaddr_storage scratch; -#else - struct sockaddr_in scratch; -#endif - int n; - char buffer[256]; - int flags, count = 0, total = 0, k; - -/* The code is the obvious. */ - - if (which < 0 || which >= MAX_SOCKETS || descriptors[which] < 0) - fatal(0,"socket index out of range or not open",NULL); - if (verbose > 2) fprintf(stderr,"Flushing outstanding packets\n"); - errno = 0; - if ((flags = fcntl(descriptors[which],F_GETFL,0)) < 0 || - fcntl(descriptors[which],F_SETFL,flags|O_NONBLOCK) == -1) - fatal(1,"unable to set non-blocking mode",NULL); - while (1) { - n = sizeof(scratch); - errno = 0; - k = recvfrom(descriptors[which],buffer,256,0, - (struct sockaddr *)&scratch,&n); - if (k < 0) { - if (errno == EAGAIN || errno == EWOULDBLOCK) break; - fatal(1,"unable to flush socket",NULL); - } - ++count; - total += k; - } - errno = 0; - if (fcntl(descriptors[which],F_SETFL,flags) == -1) - fatal(1,"unable to restore blocking mode",NULL); - if (verbose > 2) - fprintf(stderr,"Flushed %d packets totalling %d bytes\n",count,total); - return count; -} - - - -extern void close_socket (int which) { - -/* There is little point in shielding this with a timeout, because any hangs -are unlikely to be interruptible. It can get called when the sockets haven't -been opened, so ignore that case. */ - - if (which < 0 || which >= MAX_SOCKETS) - fatal(0,"socket index out of range",NULL); - if (descriptors[which] < 0) return; - errno = 0; - if (close(descriptors[which])) fatal(1,"unable to close NTP socket",NULL); -} diff --git a/sntp/timing.c b/sntp/timing.c deleted file mode 100644 index f69cd2b..0000000 --- a/sntp/timing.c +++ /dev/null @@ -1,112 +0,0 @@ -/* Copyright (C) 1996 N.M. Maclaren - Copyright (C) 1996 The University of Cambridge - -This includes all of the code needed to handle the time. It assumes rather -more than is defined by POSIX, unfortunately. Systems that do not have the -'X/Open' extensions may need changes. */ - - - -#include "header.h" - -#include <sys/types.h> -#include <sys/time.h> - -#define TIMING -#include "kludges.h" -#undef TIMING - - - -#define MILLION_L 1000000l /* For conversion to/from timeval */ -#define MILLION_D 1.0e6 /* Must be equal to MILLION_L */ - - - -double current_time (double offset) { - -/* Get the current UTC time in seconds since the Epoch plus an offset (usually -the time from the beginning of the century to the Epoch!) */ - - struct timeval current; - - errno = 0; - if (gettimeofday(¤t,NULL)) - fatal(1,"unable to read current machine/system time",NULL); - return offset+current.tv_sec+1.0e-6*current.tv_usec; -} - - - -time_t convert_time (double value, int *millisecs) { - -/* Convert the time to the ANSI C form. */ - - time_t result = (time_t)value; - - if ((*millisecs = (int)(1000.0*(value-result))) >= 1000) { - *millisecs = 0; - ++result; - } - return result; -} - - - -void adjust_time (double difference, int immediate, double ignore) { - -/* Adjust the current UTC time. This is portable, even if struct timeval uses -an unsigned long for tv_sec. */ - - struct timeval old, new, adjust, previous; - char text[40]; - long n; - -/* Start by converting to timeval format. Note that we have to cater for -negative, unsigned values. */ - - if ((n = (long)difference) > difference) --n; - adjust.tv_sec = n; - adjust.tv_usec = (long)(MILLION_D*(difference-n)); - errno = 0; - if (gettimeofday(&old,NULL)) - fatal(1,"unable to read machine/system time",NULL); - new.tv_sec = old.tv_sec+adjust.tv_sec; - new.tv_usec = (n = (long)old.tv_usec+(long)adjust.tv_usec); - if (n < 0) { - new.tv_usec += MILLION_L; - --new.tv_sec; - } else if (n >= MILLION_L) { - new.tv_usec -= MILLION_L; - ++new.tv_sec; - } - -/* Now diagnose the situation if necessary, and perform the dirty deed. */ - - if (verbose > 2) - fprintf(stderr, - "Times: old=(%ld,%.6ld) new=(%ld,%.6ld) adjust=(%ld,%.6ld)\n", - (long)old.tv_sec,(long)old.tv_usec, - (long)new.tv_sec,(long)new.tv_usec, - (long)adjust.tv_sec,(long)adjust.tv_usec); - if (immediate) { - errno = 0; - if (settimeofday(&new,NULL)) - fatal(1,"unable to reset current system time",NULL); - } else { - previous.tv_sec = 0; - previous.tv_usec = 0; - errno = 0; - if (adjtime(&adjust,&previous)) - fatal(1,"unable to adjust current system time",NULL); - if (previous.tv_sec != 0 || previous.tv_usec != 0) { - sprintf(text,"(%ld,%.6ld)", - (long)previous.tv_sec,(long)previous.tv_usec); - if (previous.tv_sec+1.0e-6*previous.tv_usec > ignore) - fatal(0,"outstanding time adjustment %s",text); - else if (verbose) - fprintf(stderr,"%s: outstanding time adjustment %s\n", - argv0,text); - } - } -} diff --git a/sntp/unix.c b/sntp/unix.c deleted file mode 100644 index c9d5d74..0000000 --- a/sntp/unix.c +++ /dev/null @@ -1,92 +0,0 @@ -/* Copyright (C) 1996 N.M. Maclaren - Copyright (C) 1996 The University of Cambridge - -This includes code that really should have been part of ANSI/ISO C, but was -left out for historical reasons (despite requests to define ftty), plus -the get_lock() and log_message() functions. -*/ - -#include "header.h" - -#include <sys/types.h> -#include <unistd.h> -#include <syslog.h> -#include <signal.h> - -#define UNIX -#include "kludges.h" -#undef UNIX - - -void do_nothing (int seconds) { - -/* Wait for a fixed period, possibly uninterruptibly. This should not wait -for less than the specified period, if that can be avoided. */ - - sleep((unsigned int)(seconds+2)); /* +2 is enough for POSIX */ -} - - - -int ftty (FILE *file) { - -/* Return whether the file is attached to an interactive device. */ - - return isatty(fileno(file)); -} - - - -void set_lock (int lock) { - -/* Check that we have enough privileges to reset the time and that no other -updating msntp process is running, but don't bother with fancy interlocking. -This function is really only to permit the daemon mode to be restarted in a -cron job and improve the diagnostics; it can be replaced by a 'return' -statement if it causes implementation difficulties. Note that there is little -point in clearing the lock under Unix, but do so anyway. */ - - FILE *file; - long pid; - - if (lockname == NULL || lockname[0] == '\0') return; - if (lock) { - errno = 0; - if ((file = fopen(lockname,"r")) != NULL && - fscanf(file,"%ld",&pid) == 1 && kill(pid,0) == 0) { - if (verbose || isatty(STDIN_FILENO) || isatty(STDOUT_FILENO)) - fatal(0,"another msntp process is currently running",NULL); - else - fatal(0,NULL,NULL); - } - if (file != NULL) fclose(file); - errno = 0; - if ((file = fopen(lockname,"w")) == NULL || - fprintf(file,"%ld\n",(long)getpid()) <= 0 || - ferror(file) || fclose(file) != 0) - fatal(1,"unable to write PID to %s",lockname); - adjust_time(0.0,1,0.0); - } else { - errno = 0; - if (remove(lockname) != 0) - fatal(1,"unable to remove the msntp lockname %s",lockname); - } -} - - - -/* - * Log a message, crudely. - * This is used in only one place, but could be used more widely. - */ - -void -log_message (const char *message) -{ - - syslog( -#ifdef LOG_DAEMON - LOG_DAEMON | -#endif - LOG_WARNING, "%s", message); -} diff --git a/sntp/utilities.c b/sntp/utilities.c new file mode 100644 index 0000000..e19ee1c --- /dev/null +++ b/sntp/utilities.c @@ -0,0 +1,190 @@ +#include <config.h> +#include "utilities.h" +#include <assert.h> + +/* Display a NTP packet in hex with leading address offset + * e.g. offset: value, 0: ff 1: fe ... 255: 00 + */ +void +pkt_output ( + struct pkt *dpkg, + int pkt_length, + FILE *output + ) +{ + register int a; + u_char *pkt; + + pkt = (u_char *)dpkg; + + fprintf(output, HLINE); + + for (a = 0; a < pkt_length; a++) { + if (a > 0 && a % 8 == 0) + fprintf(output, "\n"); + + fprintf(output, "%d: %x \t", a, pkt[a]); + } + + fprintf(output, "\n"); + fprintf(output, HLINE); +} + +/* Output a long floating point value in hex in the style described above + */ +void +l_fp_output ( + l_fp *ts, + FILE *output + ) +{ + register int a; + + fprintf(output, HLINE); + + for(a=0; a<8; a++) + fprintf(output, "%i: %x \t", a, ((unsigned char *) ts)[a]); + + fprintf(output, "\n"); + fprintf(output, HLINE); + +} + +/* Output a long floating point value in binary in the style described above + */ +void +l_fp_output_bin ( + l_fp *ts, + FILE *output + ) +{ + register int a, b; + + fprintf(output, HLINE); + + for(a=0; a<8; a++) { + short tmp = ((unsigned char *) ts)[a]; + tmp++; + + fprintf(output, "%i: ", a); + + for(b=7; b>=0; b--) { + int texp = (int) pow(2, b); + + if(tmp - texp > 0) { + fprintf(output, "1"); + tmp -= texp; + } + else { + fprintf(output, "0"); + } + } + + fprintf(output, " "); + } + + fprintf(output, "\n"); + fprintf(output, HLINE); +} + +/* Output a long floating point value in decimal in the style described above + */ +void +l_fp_output_dec ( + l_fp *ts, + FILE *output + ) +{ + register int a; + + fprintf(output, HLINE); + + for(a=0; a<8; a++) + fprintf(output, "%i: %i \t", a, ((unsigned char *) ts)[a]); + + fprintf(output, "\n"); + fprintf(output, HLINE); + +} + +/* Convert a struct addrinfo to a string containing the address in style + * of inet_ntoa + */ +char * +addrinfo_to_str ( + struct addrinfo *addr + ) +{ + sockaddr_u s; + + memset(&s, 0, sizeof(s)); + memcpy(&s, addr->ai_addr, min(sizeof(s), addr->ai_addrlen)); + + return ss_to_str(&s); +} + +/* Convert a sockaddr_u to a string containing the address in + * style of inet_ntoa + * Why not switch callers to use stoa from libntp? No free() needed + * in that case. + */ +char * +ss_to_str ( + sockaddr_u *saddr + ) +{ + char * buf; + + buf = emalloc(INET6_ADDRSTRLEN); + strncpy(buf, stoa(saddr), INET6_ADDRSTRLEN); + + return buf; +} +/* + * Converts a struct tv to a date string + */ +char * +tv_to_str( + const struct timeval *tv + ) +{ + const size_t bufsize = 48; + char *buf; + time_t gmt_time, local_time; + struct tm *p_tm_local; + int hh, mm, lto; + + /* + * convert to struct tm in UTC, then intentionally feed + * that tm to mktime() which expects local time input, to + * derive the offset from UTC to local time. + */ + gmt_time = tv->tv_sec; + local_time = mktime(gmtime(&gmt_time)); + p_tm_local = localtime(&gmt_time); + + /* Local timezone offsets should never cause an overflow. Yeah. */ + lto = difftime(local_time, gmt_time); + lto /= 60; + hh = lto / 60; + mm = abs(lto % 60); + + buf = emalloc(bufsize); + snprintf(buf, bufsize, + "%d-%.2d-%.2d %.2d:%.2d:%.2d.%.6d (%+03d%02d)", + p_tm_local->tm_year + 1900, + p_tm_local->tm_mon + 1, + p_tm_local->tm_mday, + p_tm_local->tm_hour, + p_tm_local->tm_min, + p_tm_local->tm_sec, + (int)tv->tv_usec, + hh, + mm); + + return buf; +} + + + + diff --git a/sntp/utilities.h b/sntp/utilities.h new file mode 100644 index 0000000..a122f86 --- /dev/null +++ b/sntp/utilities.h @@ -0,0 +1,25 @@ +#ifndef UTILITIES_H +#define UTILITIES_H + +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <ntp_stdlib.h> +#include <ntp_fp.h> +#include <ntp.h> + +#define HLINE "--------------------------------------------------------------------------------\n" +#define PHLINE fprintf(output, HLINE); +#define STDLINE printf(HLINE); + + +void pkt_output (struct pkt *dpkg, int pkt_length, FILE *output); +void l_fp_output (l_fp *ts, FILE *output); +void l_fp_output_bin (l_fp *ts, FILE *output); +void l_fp_output_dec (l_fp *ts, FILE *output); + +char *addrinfo_to_str (struct addrinfo *addr); +char *ss_to_str (sockaddr_u *saddr); +char *tv_to_str (const struct timeval *tv); + +#endif diff --git a/sntp/version.def b/sntp/version.def index f0dc444..706bf96 100644 --- a/sntp/version.def +++ b/sntp/version.def @@ -1 +1 @@ -version = '4.2.4p8'; +version = '4.2.6p5'; diff --git a/sntp/version.m4 b/sntp/version.m4 new file mode 100644 index 0000000..3b68829 --- /dev/null +++ b/sntp/version.m4 @@ -0,0 +1 @@ +m4_define([VERSION_NUMBER],[4.2.6p5]) diff --git a/sntp/version.texi b/sntp/version.texi new file mode 100644 index 0000000..1d54957 --- /dev/null +++ b/sntp/version.texi @@ -0,0 +1,3 @@ +@set UPDATED 24 December 2011 +@set EDITION 4.2.6p5 +@set VERSION 4.2.6p5 |