Import Upstream version 0.41
Samuel Henrique
5 years ago
9 | 9 | Thanks to everyone who has provided feedback on mtr. |
10 | 10 | |
11 | 11 | Thanks especially to those of you who have sent code: |
12 | (Reverse alphabetical order) | |
12 | 13 | |
13 | Brian Casey, Mircea Damian, Christophe Kalt, Simon Kirby, | |
14 | Anand Kumria, Bertrand Leconte, Charles Levert, Alexander | |
15 | V. Lukyanov, Russell Nelson, Aaron Scarisbrick, Andrew | |
16 | Stesin, Juha Takala. | |
14 | Juha Takala, | |
15 | David Sward (sward@clark.net), | |
16 | Andrew Stesin, | |
17 | Aaron Scarisbrick, | |
18 | Craig Milo Rogers (Rogers@ISI.EDU), | |
19 | Russell Nelson (rn-mtr@crynwr.com), | |
20 | Davin Milun (milun@acm.org), | |
21 | Alexander V. Lukyanov (lav@yars.free.net), | |
22 | Charles Levert (charles@comm.polymtl.ca), | |
23 | Bertrand Leconte (B.Leconte@mail.dotcom.fr), | |
24 | Anand Kumria, | |
25 | Olav Kvittem (Olav.Kvittem@uninett.no), | |
26 | Adam Kramer (l3zqc@qcunix1.acc.qc.edu), | |
27 | Philip Kizer (pckizer@nostrum.com), | |
28 | Simon Kirby, | |
29 | Christophe Kalt, | |
30 | Steve Kann (stevek@spheara.horizonlive.com), | |
31 | Mircea Damian, | |
32 | Brian Casey, | |
33 | Bill Bogstad (bogstad@pobox.com), | |
34 | Moritz Barsnick (barsnick@gmx.net) | |
35 | Robert Sparks (rjsparks@nostrum.com) | |
36 | ||
17 | 37 | and anyone who has slipped through the cracks of my mail file. |
38 | ||
39 | Authors: If you want your Email mentioned here, send it to me. | |
40 | If you don't want your Email mentioned here, tell me. | |
41 | ||
42 | -- REW |
0 | ||
1 | # | |
2 | # This is an attempt on simplifying the compilation of mtr to a simple "make". | |
3 | # | |
4 | ||
5 | firstrule: | |
6 | ./configure | |
7 | $(MAKE) | |
8 | ||
9 | clean: | |
10 | rm -f *.o *~ core | |
11 | ||
12 | distclean: clean | |
13 | rm -f mtr config.cache config.status config.log \ | |
14 | stamp-h stamp-h[0-9]* TAGS ID | |
15 |
20 | 20 | mtr_DEPENDENCIES = $(GTK_OBJ) $(CURSES_OBJ) |
21 | 21 | mtr_LDFLAGS = $(GTK_OBJ) $(CURSES_OBJ) |
22 | 22 | |
23 | EXTRA_DIST = SECURITY mtr.8 | |
23 | EXTRA_DIST = SECURITY mtr.8 Makefile Makefile.dist | |
24 | distclean-local: | |
25 | cp Makefile.dist Makefile | |
26 | rm -f *.orig | |
24 | 27 | |
25 | 28 | DISTCLEANFILES = *~ |
26 | 29 |
0 | ||
1 | # | |
2 | # This is an attempt on simplifying the compilation of mtr to a simple "make". | |
3 | # | |
4 | ||
5 | firstrule: | |
6 | ./configure | |
7 | $(MAKE) | |
8 | ||
9 | clean: | |
10 | rm -f *.o *~ core | |
11 | ||
12 | distclean: clean | |
13 | rm -f mtr config.cache config.status config.log \ | |
14 | stamp-h stamp-h[0-9]* TAGS ID | |
15 |
0 | # Makefile.in generated automatically by automake 1.2 from Makefile.am | |
1 | ||
2 | # Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. | |
0 | # Makefile.in generated automatically by automake 1.3 from Makefile.am | |
1 | ||
2 | # Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. | |
3 | 3 | # This Makefile.in is free software; the Free Software Foundation |
4 | # gives unlimited permission to copy, distribute and modify it. | |
4 | # gives unlimited permission to copy and/or distribute it, | |
5 | # with or without modifications, as long as this notice is preserved. | |
6 | ||
7 | # This program is distributed in the hope that it will be useful, | |
8 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without | |
9 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A | |
10 | # PARTICULAR PURPOSE. | |
5 | 11 | |
6 | 12 | |
7 | 13 | SHELL = /bin/sh |
25 | 31 | includedir = @includedir@ |
26 | 32 | oldincludedir = /usr/include |
27 | 33 | |
34 | DISTDIR = | |
35 | ||
28 | 36 | pkgdatadir = $(datadir)/@PACKAGE@ |
29 | 37 | pkglibdir = $(libdir)/@PACKAGE@ |
30 | 38 | pkgincludedir = $(includedir)/@PACKAGE@ |
42 | 50 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ |
43 | 51 | transform = @program_transform_name@ |
44 | 52 | |
45 | NORMAL_INSTALL = true | |
46 | PRE_INSTALL = true | |
47 | POST_INSTALL = true | |
48 | NORMAL_UNINSTALL = true | |
49 | PRE_UNINSTALL = true | |
50 | POST_UNINSTALL = true | |
53 | NORMAL_INSTALL = : | |
54 | PRE_INSTALL = : | |
55 | POST_INSTALL = : | |
56 | NORMAL_UNINSTALL = : | |
57 | PRE_UNINSTALL = : | |
58 | POST_UNINSTALL = : | |
51 | 59 | CC = @CC@ |
52 | 60 | CURSES_OBJ = @CURSES_OBJ@ |
53 | 61 | GTK_CFLAGS = @GTK_CFLAGS@ |
79 | 87 | mtr_DEPENDENCIES = $(GTK_OBJ) $(CURSES_OBJ) |
80 | 88 | mtr_LDFLAGS = $(GTK_OBJ) $(CURSES_OBJ) |
81 | 89 | |
82 | EXTRA_DIST = SECURITY mtr.8 | |
90 | EXTRA_DIST = SECURITY mtr.8 Makefile Makefile.dist | |
83 | 91 | |
84 | 92 | DISTCLEANFILES = *~ |
85 | 93 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
99 | 107 | CFLAGS = @CFLAGS@ |
100 | 108 | COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) |
101 | 109 | LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ |
102 | MANS = mtr.8 | |
110 | man8dir = $(mandir)/man8 | |
111 | MANS = $(man_MANS) | |
103 | 112 | |
104 | 113 | NROFF = nroff |
105 | 114 | DIST_COMMON = README AUTHORS COPYING INSTALL Makefile.am Makefile.in \ |
114 | 123 | SOURCES = $(mtr_SOURCES) $(EXTRA_mtr_SOURCES) |
115 | 124 | OBJECTS = $(mtr_OBJECTS) |
116 | 125 | |
117 | default: all | |
126 | all: all-recursive-am all-am | |
118 | 127 | |
119 | 128 | .SUFFIXES: |
120 | .SUFFIXES: .c .o | |
121 | $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) | |
129 | .SUFFIXES: .S .c .o .s | |
130 | $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) | |
122 | 131 | cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps Makefile |
123 | 132 | |
124 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status | |
133 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status | |
125 | 134 | cd $(top_builddir) \ |
126 | 135 | && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status |
127 | 136 | |
134 | 143 | cd $(srcdir) && $(AUTOCONF) |
135 | 144 | |
136 | 145 | config.h: stamp-h |
146 | @: | |
137 | 147 | stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status |
138 | 148 | cd $(top_builddir) \ |
139 | 149 | && CONFIG_FILES= CONFIG_HEADERS=config.h \ |
149 | 159 | clean-hdr: |
150 | 160 | |
151 | 161 | distclean-hdr: |
152 | rm -f config.h | |
162 | -rm -f config.h | |
153 | 163 | |
154 | 164 | maintainer-clean-hdr: |
155 | 165 | |
156 | 166 | mostlyclean-sbinPROGRAMS: |
157 | 167 | |
158 | 168 | clean-sbinPROGRAMS: |
159 | test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) | |
169 | -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) | |
160 | 170 | |
161 | 171 | distclean-sbinPROGRAMS: |
162 | 172 | |
164 | 174 | |
165 | 175 | install-sbinPROGRAMS: $(sbin_PROGRAMS) |
166 | 176 | @$(NORMAL_INSTALL) |
167 | $(mkinstalldirs) $(sbindir) | |
177 | $(mkinstalldirs) $(DESTDIR)$(sbindir) | |
168 | 178 | @list='$(sbin_PROGRAMS)'; for p in $$list; do \ |
169 | 179 | if test -f $$p; then \ |
170 | echo " $(INSTALL_PROGRAM) $$p $(sbindir)/`echo $$p|sed '$(transform)'`"; \ | |
171 | $(INSTALL_PROGRAM) $$p $(sbindir)/`echo $$p|sed '$(transform)'`; \ | |
180 | echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed '$(transform)'`"; \ | |
181 | $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed '$(transform)'`; \ | |
172 | 182 | else :; fi; \ |
173 | 183 | done |
174 | 184 | |
175 | 185 | uninstall-sbinPROGRAMS: |
176 | $(NORMAL_UNINSTALL) | |
186 | @$(NORMAL_UNINSTALL) | |
177 | 187 | list='$(sbin_PROGRAMS)'; for p in $$list; do \ |
178 | rm -f $(sbindir)/`echo $$p|sed '$(transform)'`; \ | |
188 | rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed '$(transform)'`; \ | |
179 | 189 | done |
180 | 190 | |
181 | 191 | .c.o: |
182 | 192 | $(COMPILE) -c $< |
183 | 193 | |
194 | .s.o: | |
195 | $(COMPILE) -c $< | |
196 | ||
197 | .S.o: | |
198 | $(COMPILE) -c $< | |
199 | ||
184 | 200 | mostlyclean-compile: |
185 | rm -f *.o core | |
201 | -rm -f *.o core *.core | |
186 | 202 | |
187 | 203 | clean-compile: |
188 | 204 | |
189 | 205 | distclean-compile: |
190 | rm -f *.tab.c | |
206 | -rm -f *.tab.c | |
191 | 207 | |
192 | 208 | maintainer-clean-compile: |
193 | 209 | |
194 | 210 | mtr: $(mtr_OBJECTS) $(mtr_DEPENDENCIES) |
195 | 211 | @rm -f mtr |
196 | 212 | $(LINK) $(mtr_LDFLAGS) $(mtr_OBJECTS) $(mtr_LDADD) $(LIBS) |
213 | ||
214 | install-man8: | |
215 | $(mkinstalldirs) $(DESTDIR)$(man8dir) | |
216 | @list='$(man8_MANS)'; \ | |
217 | l2='$(man_MANS)'; for i in $$l2; do \ | |
218 | case "$$i" in \ | |
219 | *.8*) list="$$list $$i" ;; \ | |
220 | esac; \ | |
221 | done; \ | |
222 | for i in $$list; do \ | |
223 | if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ | |
224 | else file=$$i; fi; \ | |
225 | ext=`echo $$i | sed -e 's/^.*\\.//'`; \ | |
226 | inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ | |
227 | inst=`echo $$inst | sed '$(transform)'`.$$ext; \ | |
228 | echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \ | |
229 | $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \ | |
230 | done | |
231 | ||
232 | uninstall-man8: | |
233 | @list='$(man8_MANS)'; \ | |
234 | l2='$(man_MANS)'; for i in $$l2; do \ | |
235 | case "$$i" in \ | |
236 | *.8*) list="$$list $$i" ;; \ | |
237 | esac; \ | |
238 | done; \ | |
239 | for i in $$list; do \ | |
240 | ext=`echo $$i | sed -e 's/^.*\\.//'`; \ | |
241 | inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ | |
242 | inst=`echo $$inst | sed '$(transform)'`.$$ext; \ | |
243 | echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \ | |
244 | rm -f $(DESTDIR)$(man8dir)/$$inst; \ | |
245 | done | |
197 | 246 | install-man: $(MANS) |
198 | $(NORMAL_INSTALL) | |
199 | $(mkinstalldirs) $(mandir)/man8 | |
200 | @sect=8; \ | |
201 | inst=`echo "mtr" | sed '$(transform)'`.8; \ | |
202 | if test -f $(srcdir)/mtr.8; then file=$(srcdir)/mtr.8; \ | |
203 | else file=mtr.8; fi; \ | |
204 | echo " $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst"; \ | |
205 | $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst | |
206 | ||
247 | @$(NORMAL_INSTALL) | |
248 | $(MAKE) install-man8 | |
207 | 249 | uninstall-man: |
208 | $(NORMAL_UNINSTALL) | |
209 | inst=`echo "mtr" | sed '$(transform)'`.8; \ | |
210 | rm -f $(mandir)/man8/$$inst | |
211 | ||
250 | @$(NORMAL_UNINSTALL) | |
251 | $(MAKE) uninstall-man8 | |
212 | 252 | |
213 | 253 | # This directory's subdirectories are mostly independent; you can cd |
214 | 254 | # into them and run `make' without going through this Makefile. |
223 | 263 | installdirs-recursive install-recursive uninstall-recursive \ |
224 | 264 | check-recursive installcheck-recursive info-recursive dvi-recursive: |
225 | 265 | @set fnord $(MAKEFLAGS); amf=$$2; \ |
226 | for subdir in $(SUBDIRS); do \ | |
266 | list='$(SUBDIRS)'; for subdir in $$list; do \ | |
227 | 267 | target=`echo $@ | sed s/-recursive//`; \ |
228 | 268 | echo "Making $$target in $$subdir"; \ |
229 | 269 | (cd $$subdir && $(MAKE) $$target) \ |
233 | 273 | mostlyclean-recursive clean-recursive distclean-recursive \ |
234 | 274 | maintainer-clean-recursive: |
235 | 275 | @set fnord $(MAKEFLAGS); amf=$$2; \ |
236 | rev=''; for subdir in $(SUBDIRS); do rev="$$rev $$subdir"; done; \ | |
276 | rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ | |
277 | rev="$$subdir $$rev"; \ | |
278 | done; \ | |
237 | 279 | for subdir in $$rev; do \ |
238 | 280 | target=`echo $@ | sed s/-recursive//`; \ |
239 | 281 | echo "Making $$target in $$subdir"; \ |
247 | 289 | |
248 | 290 | tags: TAGS |
249 | 291 | |
250 | ID: $(HEADERS) $(SOURCES) | |
251 | here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS) | |
252 | ||
253 | TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) | |
292 | ID: $(HEADERS) $(SOURCES) $(LISP) | |
293 | here=`pwd` && cd $(srcdir) \ | |
294 | && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) | |
295 | ||
296 | TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP) | |
254 | 297 | tags=; \ |
255 | 298 | here=`pwd`; \ |
256 | 299 | list='$(SUBDIRS)'; for subdir in $$list; do \ |
257 | 300 | test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ |
258 | 301 | done; \ |
259 | test -z "$(ETAGS_ARGS)config.h.in$(SOURCES)$(HEADERS)$$tags" \ | |
260 | || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $(SOURCES) $(HEADERS) -o $$here/TAGS) | |
302 | list='$(SOURCES) $(HEADERS)'; \ | |
303 | unique=`for i in $$list; do echo $$i; done | \ | |
304 | awk ' { files[$$0] = 1; } \ | |
305 | END { for (i in files) print i; }'`; \ | |
306 | test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \ | |
307 | || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS) | |
261 | 308 | |
262 | 309 | mostlyclean-tags: |
263 | 310 | |
264 | 311 | clean-tags: |
265 | 312 | |
266 | 313 | distclean-tags: |
267 | rm -f TAGS ID | |
314 | -rm -f TAGS ID | |
268 | 315 | |
269 | 316 | maintainer-clean-tags: |
270 | 317 | |
275 | 322 | # it guarantees that the distribution is self-contained by making another |
276 | 323 | # tarfile. |
277 | 324 | distcheck: dist |
278 | rm -rf $(distdir) | |
325 | -rm -rf $(distdir) | |
279 | 326 | GZIP=$(GZIP) $(TAR) zxf $(distdir).tar.gz |
280 | 327 | mkdir $(distdir)/=build |
281 | 328 | mkdir $(distdir)/=inst |
288 | 335 | && $(MAKE) install \ |
289 | 336 | && $(MAKE) installcheck \ |
290 | 337 | && $(MAKE) dist |
291 | rm -rf $(distdir) | |
338 | -rm -rf $(distdir) | |
292 | 339 | @echo "========================"; \ |
293 | 340 | echo "$(distdir).tar.gz is ready for distribution"; \ |
294 | 341 | echo "========================" |
295 | 342 | dist: distdir |
296 | 343 | -chmod -R a+r $(distdir) |
297 | 344 | GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir) |
298 | rm -rf $(distdir) | |
345 | -rm -rf $(distdir) | |
299 | 346 | dist-all: distdir |
300 | 347 | -chmod -R a+r $(distdir) |
301 | 348 | GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir) |
302 | rm -rf $(distdir) | |
349 | -rm -rf $(distdir) | |
303 | 350 | distdir: $(DISTFILES) |
304 | rm -rf $(distdir) | |
351 | -rm -rf $(distdir) | |
305 | 352 | mkdir $(distdir) |
306 | 353 | -chmod 777 $(distdir) |
307 | 354 | @for file in $(DISTFILES); do \ |
310 | 357 | || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ |
311 | 358 | || cp -p $$d/$$file $(distdir)/$$file; \ |
312 | 359 | done |
313 | for subdir in $(SUBDIRS); do \ | |
314 | test -d $(distdir)/$$subdir \ | |
315 | || mkdir $(distdir)/$$subdir \ | |
316 | || exit 1; \ | |
317 | chmod 777 $(distdir)/$$subdir; \ | |
318 | (cd $$subdir && $(MAKE) top_distdir=../$(top_distdir) distdir=../$(distdir)/$$subdir distdir) \ | |
360 | for subdir in $(SUBDIRS); do \ | |
361 | test -d $(distdir)/$$subdir \ | |
362 | || mkdir $(distdir)/$$subdir \ | |
363 | || exit 1; \ | |
364 | chmod 777 $(distdir)/$$subdir; \ | |
365 | (cd $$subdir && $(MAKE) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ | |
319 | 366 | || exit 1; \ |
320 | 367 | done |
321 | 368 | info: info-recursive |
345 | 392 | |
346 | 393 | uninstall: uninstall-recursive uninstall-am |
347 | 394 | |
348 | all: all-recursive-am all-am | |
349 | ||
350 | 395 | install-strip: |
351 | 396 | $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install |
352 | 397 | installdirs: installdirs-recursive |
353 | $(mkinstalldirs) $(sbindir) $(mandir)/man8 | |
398 | $(mkinstalldirs) $(DATADIR)$(sbindir) $(DESTDIR)$(mandir)/man8 | |
354 | 399 | |
355 | 400 | |
356 | 401 | mostlyclean-generic: |
357 | test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) | |
402 | -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) | |
358 | 403 | |
359 | 404 | clean-generic: |
360 | test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) | |
405 | -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) | |
361 | 406 | |
362 | 407 | distclean-generic: |
363 | rm -f Makefile $(DISTCLEANFILES) | |
364 | rm -f config.cache config.log stamp-h stamp-h[0-9]* | |
365 | test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) | |
408 | -rm -f Makefile $(DISTCLEANFILES) | |
409 | -rm -f config.cache config.log stamp-h stamp-h[0-9]* | |
410 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) | |
366 | 411 | |
367 | 412 | maintainer-clean-generic: |
368 | test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) | |
369 | test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) | |
413 | -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) | |
414 | -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) | |
370 | 415 | mostlyclean-am: mostlyclean-hdr mostlyclean-sbinPROGRAMS \ |
371 | 416 | mostlyclean-compile mostlyclean-tags \ |
372 | 417 | mostlyclean-generic |
385 | 430 | |
386 | 431 | clean: clean-recursive clean-am |
387 | 432 | |
388 | distclean: distclean-recursive distclean-am | |
389 | rm -f config.status | |
433 | distclean: distclean-recursive distclean-am distclean-local | |
434 | -rm -f config.status | |
390 | 435 | |
391 | 436 | maintainer-clean: maintainer-clean-recursive maintainer-clean-am |
392 | 437 | @echo "This command is intended for maintainers to use;" |
393 | 438 | @echo "it deletes files that may require special tools to rebuild." |
394 | rm -f config.status | |
395 | ||
396 | .PHONY: default mostlyclean-hdr distclean-hdr clean-hdr \ | |
397 | maintainer-clean-hdr mostlyclean-sbinPROGRAMS distclean-sbinPROGRAMS \ | |
398 | clean-sbinPROGRAMS maintainer-clean-sbinPROGRAMS uninstall-sbinPROGRAMS \ | |
439 | -rm -f config.status | |
440 | ||
441 | .PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ | |
442 | mostlyclean-sbinPROGRAMS distclean-sbinPROGRAMS clean-sbinPROGRAMS \ | |
443 | maintainer-clean-sbinPROGRAMS uninstall-sbinPROGRAMS \ | |
399 | 444 | install-sbinPROGRAMS mostlyclean-compile distclean-compile \ |
400 | clean-compile maintainer-clean-compile install-man uninstall-man \ | |
401 | install-data-recursive uninstall-data-recursive install-exec-recursive \ | |
445 | clean-compile maintainer-clean-compile install-man8 uninstall-man8 \ | |
446 | install-man uninstall-man install-data-recursive \ | |
447 | uninstall-data-recursive install-exec-recursive \ | |
402 | 448 | uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ |
403 | 449 | all-recursive check-recursive installcheck-recursive info-recursive \ |
404 | 450 | dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ |
411 | 457 | |
412 | 458 | install-exec-am: |
413 | 459 | chmod u+s $(sbindir)/mtr |
460 | distclean-local: | |
461 | cp Makefile.dist Makefile | |
462 | rm -f *.orig | |
414 | 463 | |
415 | 464 | # Tell versions [3.59,3.63) of GNU make to not export all variables. |
416 | 465 | # Otherwise a system limit (for SysV at least) may be exceeded. |
0 | 0 | WHAT'S NEW? |
1 | ||
2 | v0.41 Added afr's patch to allow disabeling of gtk without Robn's hack. | |
3 | Made report mode report the newly added extra resolution. | |
4 | ||
5 | v0.40 Fixed some problems with HPUX and SunOS. | |
6 | Included Olav Kvittem's patch to do packetsize option. | |
7 | Made the timekeeping in micro seconds. | |
8 | ||
9 | v0.39 Forgot the parentheses around the previous fix... :-( | |
10 | ||
11 | v0.38 fixed some dubious code in dns.c (noted by someone's lint) | |
12 | ||
13 | v0.37 Added Bill Bogstad's "show the local host & time" patch. | |
14 | Added R. Sparks' show-last-ping patch, submitted by Philip Kizer. | |
15 | ||
16 | v0.36 Added Craigs change-the-interval-on-the-fly patch. | |
17 | Added Moritz Barsnick's "do something sensible if host not found" | |
18 | patch. | |
19 | Some cleanup of both Craigs and Moritz' patches. | |
20 | ||
21 | v0.35 Added Craig Milo Rogers pause/resume for GTK patch. | |
22 | Added Craig Milo Rogers cleanup of "reset". (restart at the beginning) | |
23 | Net_open used to send a first packet. After that the display-driver | |
24 | got a chance to distort the timing by taking its time to | |
25 | initialize. | |
26 | ||
27 | v0.34 Added Matt's nifty "use the icmp unreachables to do the timing" patch. | |
28 | Added Steve Kann's pause/resume patch. | |
29 | ||
30 | v0.33 Fixed the Linux glibc resolver problems. | |
31 | Fixed the off-by-one problem with -c option. | |
32 | ||
33 | v0.32 Fixed the FreeBSD bug detection stuff. | |
34 | ||
35 | v0.31 Fixed a few documentation issues. -- Matt | |
36 | Changed the autoconf stuff to find the resolver library on | |
37 | Solaris. -- REW | |
38 | Cleaned up the autoconf.in file a bit. -- Matt. | |
39 | ||
40 | v0.30 Fixed a typo in the changelog (NEWS) entry for 0.27. :-) | |
41 | added use of "MTR_OPTIONS" environment variable for defaults. | |
42 | ||
43 | v0.29 Lots of stuff. | |
44 | Neato overview display by David Sward. | |
45 | FreeBSD does wrong in the kernel the same that Solaris/x86 (see | |
46 | note for 0.27 does right. It forces mtr to send bad packets.... | |
47 | Adjusted "not too much at once" algorithm. Now probing | |
48 | continues as long as not more than 5 hosts are unknown. | |
49 | Returning packets usually allow us to do the first sweep | |
50 | in one go. | |
51 | ||
52 | ||
53 | v0.28 DNS lookups are now suppressed if you don't want them. | |
1 | 54 | |
2 | 55 | v0.27 |
3 | 56 | Fixed bug that showed up on Solaris/x86. |
4 | Gimp mainloop now runs as it's supposed to. | |
57 | GTK mainloop now runs as it's supposed to. | |
5 | 58 | |
6 | 59 | v0.26 |
7 | 60 | Added "-n" flag for numeric output. |
0 | 0 | WHAT IS MTR? |
1 | 1 | |
2 | mtr combines the functionaly of the 'traceroute' and 'ping' programs | |
2 | mtr combines the functionality of the 'traceroute' and 'ping' programs | |
3 | 3 | in a single network diagnostic tool. |
4 | 4 | |
5 | 5 | As mtr starts, it investigates the network connection between the host |
14 | 14 | |
15 | 15 | INSTALLING |
16 | 16 | |
17 | To begin mtr, first use the included configure script: | |
17 | Slightly more hints are in the file INSTALL. If this doesn't work | |
18 | you could try reading that too.... | |
19 | ||
20 | To begin compiling mtr, first use the included configure script: | |
18 | 21 | |
19 | 22 | ./configure |
20 | 23 | |
29 | 32 | Note that mtr must be suid-root because it requires access to raw IP |
30 | 33 | sockets. See SECURITY for security information. |
31 | 34 | |
35 | If you want to build a version that doesn't use GTK, but if you | |
36 | DO have GTK installed, you can use | |
37 | ||
38 | ./configure --with-gtk-prefix=/we_dont_want_gtk_so_we_use_a_name_that_certainly_doesnt_exist | |
39 | ||
40 | It seems the --no_gtk (whatever) doesn't work. Feel free to submit | |
41 | a patch for this, I'm not that familiar with autoconf (it works for | |
42 | me :-). | |
43 | ||
44 | ||
45 | ||
46 | ||
32 | 47 | WHERE CAN I GET THE LATEST VERSION OR MORE INFORMATION? |
33 | 48 | |
34 | 49 | See the mtr web page at |
42 | 57 | |
43 | 58 | Bug reports and feature requests should be sent to the mtr |
44 | 59 | mailing list. |
45 |
0 | ||
1 | Hi everyone, | |
2 | ||
3 | This is the "todo" file for mtr. I just realized that some people | |
4 | might think that this is all in MY queue to implement. That is not | |
5 | true: This is the "for everybody" todo list. Feel free to pick a | |
6 | "project" and implement something off this list. | |
7 | ||
8 | Students: Feel free to take up one of these as a programming exercise | |
9 | for one of your courses. | |
10 | ||
11 | Everybody: If you want to start on something, contact me first, so | |
12 | that the effort isn't wasted by someone who finishes just a tad | |
13 | earlier. I'll happily provide "coaching" to anyone who wants to | |
14 | implement something on this list. That way we get the design of | |
15 | these things the way I like them. This should result in a better | |
16 | maintainable mtr. | |
17 | ||
18 | Oh, Feel free to provide suggestions for this list. | |
19 | ||
20 | ||
21 | -- REW | |
22 | ||
23 | ---------------------------------------------------------------------- | |
24 | ||
0 | 25 | |
1 | 26 | - Stuff to implement: |
2 | 27 | |
3 | 28 | - Allow mtr to log the return packets, for later analysis. |
4 | Done: 0.25 . Todo: allow the userinterface(s) to work while | |
5 | still logging to a file. | |
29 | Done: 0.25 . Todo: allow the user interface(s) to work while | |
30 | still logging to a file. Write a "logfile displaying" mode to | |
31 | mtr. | |
6 | 32 | |
7 | 33 | - Request timestamping at the remote site. |
8 | 34 | Andreas Fasbender has an algorithm that will allow us to |
9 | 35 | convert these measurements into one-way measurements, not just |
10 | 36 | round-trip. |
37 | ||
38 | - allow "keyboard navigation" in the GTK version. | |
39 | ||
40 | ||
41 | ||
42 | - Bugs to fix? | |
43 | ||
44 | - Do something useful if host couldn't be resolved. | |
45 | -- Done. | |
46 | ||
47 | - Revert to curses mode even if DISPLAY is set, but a problem | |
48 | prevents us from running in X11 mode. | |
49 | --> The problem is that gtk_init simply calls exit for us if | |
50 | it finds a problem. Tricky! Suggestions welcome. | |
51 | --> Call "gtk_check_init" when available. (i.e. new enough | |
52 | (1.2?) GTK version). | |
53 | ||
54 | - Nice to have: | |
55 | ||
56 | - stop sending packets when a new host is getting entered. | |
57 | ||
58 | - Show state ("looking up host") while doing the DNS lookup for a new | |
59 | host. | |
60 | ||
61 | - Read environment variable "MTR_DEFAULTS" as a commandline before | |
62 | parsing the commandline. -- DONE. (ok it's MTR_OPTIONS.) | |
63 | ||
64 | - Autoconf 2.13 has a neat function that can be used to find the | |
65 | res_init function: | |
66 | ||
67 | AC_SEARCH_LIBS(res_init, bind resolv, , | |
68 | AC_MSG_ERROR(No resolver library found)) | |
69 | ||
70 | At the moment (march 1999) autoconf 2.13 is still too new to require | |
71 | everyone to upgrade. About a year from now we can put this in.... | |
72 | ||
73 | - Allow a toggle between hostname/IP number display. (for example a | |
74 | click on the hostname could revert to ip number display in gtk version. | |
75 | curses: "n" key toggles hostnames/ipnumbers?) | |
76 | ||
77 | - Implement rfc2317 mechanism to do reverse lookups for networks that | |
78 | have DNS delegations on non-octet boundaries. -- Daniel Bergstrom | |
79 | (noa@melody.se) | |
80 | ||
81 | ||
82 | ------------------------------------------------------------------------ | |
83 | ||
84 | Things that shouldn't be on the TODO list because they're done. ;-) | |
11 | 85 | |
12 | 86 | - Allow mtr to also send larger packets. |
13 | 87 | This will enable us to get a feel for the speed of the links |
15 | 89 | was slow, mtr will rock with this feature.... :-) |
16 | 90 | (Anybody have the statistics experience to tell me how |
17 | 91 | to do the data analysis?) |
18 | ||
19 | - Allow MTR to keep on getting the icmp host unreachables, and | |
20 | work through that. Some hosts don't answer PINGs. | |
21 | - Auto-switch to that strategy if "host is known, but 10/10 | |
22 | pings got lost" | |
92 | -- DONE. Thanks to Olav Kvittem ... | |
23 | 93 | |
24 | 94 | - The "don't probe all hosts at once" strategy can be improved a bit. |
25 | 95 | It should not probe more than 10 unknown hosts, but the counter need |
26 | 96 | not be reset at the start of the "round". This way if you probe |
27 | 97 | slowly (relative to the RTT time to the end host), it can probe |
28 | 98 | all hosts in the first "round". |
29 | ||
30 | ||
31 | - Bugs to fix? | |
32 | - ? | |
33 | ||
99 | -- DONE. |
0 | dnl aclocal.m4 generated automatically by aclocal 1.2 | |
0 | dnl aclocal.m4 generated automatically by aclocal 1.3 | |
1 | ||
2 | dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. | |
3 | dnl This Makefile.in is free software; the Free Software Foundation | |
4 | dnl gives unlimited permission to copy and/or distribute it, | |
5 | dnl with or without modifications, as long as this notice is preserved. | |
6 | ||
7 | dnl This program is distributed in the hope that it will be useful, | |
8 | dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without | |
9 | dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A | |
10 | dnl PARTICULAR PURPOSE. | |
1 | 11 | |
2 | 12 | # Do all the work for Automake. This macro actually does too much -- |
3 | 13 | # some checks are only needed if your package does certain things. |
21 | 31 | ifelse([$3],, |
22 | 32 | AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") |
23 | 33 | AC_DEFINE_UNQUOTED(VERSION, "$VERSION")) |
24 | AM_SANITY_CHECK | |
25 | AC_ARG_PROGRAM | |
34 | AC_REQUIRE([AM_SANITY_CHECK]) | |
35 | AC_REQUIRE([AC_ARG_PROGRAM]) | |
26 | 36 | dnl FIXME This is truly gross. |
27 | 37 | missing_dir=`cd $ac_aux_dir && pwd` |
28 | 38 | AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) |
30 | 40 | AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) |
31 | 41 | AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) |
32 | 42 | AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) |
33 | AC_PROG_MAKE_SET]) | |
43 | AC_REQUIRE([AC_PROG_MAKE_SET])]) | |
34 | 44 | |
35 | 45 | |
36 | 46 | # serial 1 |
57 | 67 | # directory). |
58 | 68 | if ( |
59 | 69 | set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` |
60 | if test "$@" = "X"; then | |
70 | if test "[$]*" = "X"; then | |
61 | 71 | # -L didn't work. |
62 | 72 | set X `ls -t $srcdir/configure conftestfile` |
63 | 73 | fi |
74 | if test "[$]*" != "X $srcdir/configure conftestfile" \ | |
75 | && test "[$]*" != "X conftestfile $srcdir/configure"; then | |
76 | ||
77 | # If neither matched, then we have a broken ls. This can happen | |
78 | # if, for instance, CONFIG_SHELL is bash and it inherits a | |
79 | # broken ls alias from the environment. This has actually | |
80 | # happened. Such a system could not be considered "sane". | |
81 | AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken | |
82 | alias in your environment]) | |
83 | fi | |
84 | ||
64 | 85 | test "[$]2" = conftestfile |
65 | 86 | ) |
66 | 87 | then |
105 | 126 | gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="") |
106 | 127 | AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program], |
107 | 128 | , enable_gtktest=yes) |
108 | ||
129 | AC_ARG_ENABLE(gtk, [ --disable-gtk Do not use GTK], | |
130 | , enable_gtk=yes) | |
131 | ||
132 | if test x$enable_gtk != xyes ; then | |
133 | GTK_CFLAGS="" | |
134 | GTK_LIBS="" | |
135 | ifelse([$3], , :, [$3]) | |
136 | else # Begin wrap around GTK stuff | |
109 | 137 | if test x$gtk_config_exec_prefix != x ; then |
110 | 138 | gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" |
111 | 139 | if test x${GTK_CONFIG+set} != xset ; then |
261 | 289 | AC_SUBST(GTK_CFLAGS) |
262 | 290 | AC_SUBST(GTK_LIBS) |
263 | 291 | rm -f conf.gtktest |
292 | # End wrap around GTK stuff | |
293 | fi | |
264 | 294 | ]) |
265 | 295 | |
266 | 296 | # Like AC_CONFIG_HEADER, but automatically create stamp file. |
30 | 30 | /* The number of bytes in a unsigned short. */ |
31 | 31 | #undef SIZEOF_UNSIGNED_SHORT |
32 | 32 | |
33 | /* Define if you have the attron function. */ | |
34 | #undef HAVE_ATTRON | |
35 | ||
36 | /* Define if you have the seteuid function. */ | |
37 | #undef HAVE_SETEUID | |
38 | ||
33 | 39 | /* Define if you have the <curses.h> header file. */ |
34 | 40 | #undef HAVE_CURSES_H |
41 | ||
42 | /* Define if you have the <cursesX.h> header file. */ | |
43 | #undef HAVE_CURSESX_H | |
35 | 44 | |
36 | 45 | /* Define if you have the <ncurses.h> header file. */ |
37 | 46 | #undef HAVE_NCURSES_H |
39 | 48 | /* Define if you have the <ncurses/curses.h> header file. */ |
40 | 49 | #undef HAVE_NCURSES_CURSES_H |
41 | 50 | |
51 | /* Define if you have the <sys/types.h> header file. */ | |
52 | #undef HAVE_SYS_TYPES_H | |
53 | ||
42 | 54 | /* Define if you have the <sys/xti.h> header file. */ |
43 | 55 | #undef HAVE_SYS_XTI_H |
56 | ||
57 | /* Define if you have the bind library (-lbind). */ | |
58 | #undef HAVE_LIBBIND | |
44 | 59 | |
45 | 60 | /* Define if you have the m library (-lm). */ |
46 | 61 | #undef HAVE_LIBM |
51 | 66 | /* Define if you have the nsl library (-lnsl). */ |
52 | 67 | #undef HAVE_LIBNSL |
53 | 68 | |
54 | /* Define if you have the resolv library (-lresolv). */ | |
55 | #undef HAVE_LIBRESOLV | |
56 | ||
57 | 69 | /* Define if you have the socket library (-lsocket). */ |
58 | 70 | #undef HAVE_LIBSOCKET |
71 | ||
72 | /* Define if you have the termcap library (-ltermcap). */ | |
73 | #undef HAVE_LIBTERMCAP | |
59 | 74 | |
60 | 75 | /* Find the proper type for 8 bits */ |
61 | 76 | #if SIZEOF_UNSIGNED_CHAR == 1 |
0 | 0 | #! /bin/sh |
1 | 1 | |
2 | 2 | # Guess values for system-dependent variables and create Makefiles. |
3 | # Generated automatically using autoconf version 2.12 | |
3 | # Generated automatically using autoconf version 2.13 | |
4 | 4 | # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. |
5 | 5 | # |
6 | 6 | # This configure script is free software; the Free Software Foundation |
16 | 16 | --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)" |
17 | 17 | ac_help="$ac_help |
18 | 18 | --disable-gtktest Do not try to compile and run a test GTK program" |
19 | ac_help="$ac_help | |
20 | --disable-gtk Do not use GTK" | |
19 | 21 | |
20 | 22 | # Initialize some variables set by options. |
21 | 23 | # The variables have the same names as the options, with |
54 | 56 | # Initialize some other variables. |
55 | 57 | subdirs= |
56 | 58 | MFLAGS= MAKEFLAGS= |
59 | SHELL=${CONFIG_SHELL-/bin/sh} | |
57 | 60 | # Maximum number of lines to put in a shell here document. |
58 | 61 | ac_max_here_lines=12 |
59 | 62 | |
337 | 340 | verbose=yes ;; |
338 | 341 | |
339 | 342 | -version | --version | --versio | --versi | --vers) |
340 | echo "configure generated by autoconf version 2.12" | |
343 | echo "configure generated by autoconf version 2.13" | |
341 | 344 | exit 0 ;; |
342 | 345 | |
343 | 346 | -with-* | --with-*) |
507 | 510 | # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. |
508 | 511 | ac_cpp='$CPP $CPPFLAGS' |
509 | 512 | ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' |
510 | ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' | |
513 | ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' | |
511 | 514 | cross_compiling=$ac_cv_prog_cc_cross |
512 | 515 | |
516 | ac_exeext= | |
517 | ac_objext=o | |
513 | 518 | if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then |
514 | 519 | # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. |
515 | 520 | if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then |
549 | 554 | # SunOS /usr/etc/install |
550 | 555 | # IRIX /sbin/install |
551 | 556 | # AIX /bin/install |
557 | # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag | |
552 | 558 | # AFS /usr/afsws/bin/install, which mishandles nonexistent args |
553 | 559 | # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" |
554 | 560 | # ./install, which can be erroneously created by make from ./install.sh. |
555 | 561 | echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 |
556 | echo "configure:558: checking for a BSD compatible install" >&5 | |
562 | echo "configure:564: checking for a BSD compatible install" >&5 | |
557 | 563 | if test -z "$INSTALL"; then |
558 | 564 | if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then |
559 | 565 | echo $ac_n "(cached) $ac_c" 1>&6 |
560 | 566 | else |
561 | IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" | |
567 | IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" | |
562 | 568 | for ac_dir in $PATH; do |
563 | 569 | # Account for people who put trailing slashes in PATH elements. |
564 | 570 | case "$ac_dir/" in |
565 | 571 | /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; |
566 | 572 | *) |
567 | 573 | # OSF1 and SCO ODT 3.0 have their own names for install. |
568 | for ac_prog in ginstall installbsd scoinst install; do | |
574 | # Don't use installbsd from OSF since it installs stuff as root | |
575 | # by default. | |
576 | for ac_prog in ginstall scoinst install; do | |
569 | 577 | if test -f $ac_dir/$ac_prog; then |
570 | 578 | if test $ac_prog = install && |
571 | 579 | grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then |
572 | 580 | # AIX install. It has an incompatible calling convention. |
573 | # OSF/1 installbsd also uses dspmsg, but is usable. | |
574 | 581 | : |
575 | 582 | else |
576 | 583 | ac_cv_path_install="$ac_dir/$ac_prog -c" |
600 | 607 | # It thinks the first close brace ends the variable substitution. |
601 | 608 | test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' |
602 | 609 | |
610 | test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' | |
611 | ||
603 | 612 | test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' |
604 | 613 | |
605 | 614 | |
606 | 615 | test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' |
607 | 616 | |
608 | ||
609 | PACKAGE=mtr | |
610 | ||
611 | VERSION=0.28 | |
612 | ||
613 | if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then | |
614 | { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } | |
615 | fi | |
616 | cat >> confdefs.h <<EOF | |
617 | #define PACKAGE "$PACKAGE" | |
618 | EOF | |
619 | ||
620 | cat >> confdefs.h <<EOF | |
621 | #define VERSION "$VERSION" | |
622 | EOF | |
623 | ||
624 | 617 | echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 |
625 | echo "configure:627: checking whether build environment is sane" >&5 | |
618 | echo "configure:620: checking whether build environment is sane" >&5 | |
626 | 619 | # Just in case |
627 | 620 | sleep 1 |
628 | 621 | echo timestamp > conftestfile |
633 | 626 | # directory). |
634 | 627 | if ( |
635 | 628 | set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` |
636 | if test "" = "X"; then | |
629 | if test "$*" = "X"; then | |
637 | 630 | # -L didn't work. |
638 | 631 | set X `ls -t $srcdir/configure conftestfile` |
639 | 632 | fi |
633 | if test "$*" != "X $srcdir/configure conftestfile" \ | |
634 | && test "$*" != "X conftestfile $srcdir/configure"; then | |
635 | ||
636 | # If neither matched, then we have a broken ls. This can happen | |
637 | # if, for instance, CONFIG_SHELL is bash and it inherits a | |
638 | # broken ls alias from the environment. This has actually | |
639 | # happened. Such a system could not be considered "sane". | |
640 | { echo "configure: error: ls -t appears to fail. Make sure there is not a broken | |
641 | alias in your environment" 1>&2; exit 1; } | |
642 | fi | |
643 | ||
640 | 644 | test "$2" = conftestfile |
641 | 645 | ) |
642 | 646 | then |
667 | 671 | # sed with no file args requires a program. |
668 | 672 | test "$program_transform_name" = "" && program_transform_name="s,x,x," |
669 | 673 | |
674 | echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 | |
675 | echo "configure:677: checking whether ${MAKE-make} sets \${MAKE}" >&5 | |
676 | set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` | |
677 | if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then | |
678 | echo $ac_n "(cached) $ac_c" 1>&6 | |
679 | else | |
680 | cat > conftestmake <<\EOF | |
681 | all: | |
682 | @echo 'ac_maketemp="${MAKE}"' | |
683 | EOF | |
684 | # GNU make sometimes prints "make[1]: Entering...", which would confuse us. | |
685 | eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` | |
686 | if test -n "$ac_maketemp"; then | |
687 | eval ac_cv_prog_make_${ac_make}_set=yes | |
688 | else | |
689 | eval ac_cv_prog_make_${ac_make}_set=no | |
690 | fi | |
691 | rm -f conftestmake | |
692 | fi | |
693 | if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then | |
694 | echo "$ac_t""yes" 1>&6 | |
695 | SET_MAKE= | |
696 | else | |
697 | echo "$ac_t""no" 1>&6 | |
698 | SET_MAKE="MAKE=${MAKE-make}" | |
699 | fi | |
700 | ||
701 | ||
702 | PACKAGE=mtr | |
703 | ||
704 | VERSION=0.41 | |
705 | ||
706 | if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then | |
707 | { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } | |
708 | fi | |
709 | cat >> confdefs.h <<EOF | |
710 | #define PACKAGE "$PACKAGE" | |
711 | EOF | |
712 | ||
713 | cat >> confdefs.h <<EOF | |
714 | #define VERSION "$VERSION" | |
715 | EOF | |
716 | ||
717 | ||
718 | ||
670 | 719 | missing_dir=`cd $ac_aux_dir && pwd` |
671 | 720 | echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 |
672 | echo "configure:674: checking for working aclocal" >&5 | |
721 | echo "configure:723: checking for working aclocal" >&5 | |
673 | 722 | # Run test in a subshell; some versions of sh will print an error if |
674 | 723 | # an executable is not found, even if stderr is redirected. |
675 | 724 | # Redirect stdin to placate older versions of autoconf. Sigh. |
682 | 731 | fi |
683 | 732 | |
684 | 733 | echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 |
685 | echo "configure:687: checking for working autoconf" >&5 | |
734 | echo "configure:736: checking for working autoconf" >&5 | |
686 | 735 | # Run test in a subshell; some versions of sh will print an error if |
687 | 736 | # an executable is not found, even if stderr is redirected. |
688 | 737 | # Redirect stdin to placate older versions of autoconf. Sigh. |
695 | 744 | fi |
696 | 745 | |
697 | 746 | echo $ac_n "checking for working automake""... $ac_c" 1>&6 |
698 | echo "configure:700: checking for working automake" >&5 | |
747 | echo "configure:749: checking for working automake" >&5 | |
699 | 748 | # Run test in a subshell; some versions of sh will print an error if |
700 | 749 | # an executable is not found, even if stderr is redirected. |
701 | 750 | # Redirect stdin to placate older versions of autoconf. Sigh. |
708 | 757 | fi |
709 | 758 | |
710 | 759 | echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 |
711 | echo "configure:713: checking for working autoheader" >&5 | |
760 | echo "configure:762: checking for working autoheader" >&5 | |
712 | 761 | # Run test in a subshell; some versions of sh will print an error if |
713 | 762 | # an executable is not found, even if stderr is redirected. |
714 | 763 | # Redirect stdin to placate older versions of autoconf. Sigh. |
721 | 770 | fi |
722 | 771 | |
723 | 772 | echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 |
724 | echo "configure:726: checking for working makeinfo" >&5 | |
773 | echo "configure:775: checking for working makeinfo" >&5 | |
725 | 774 | # Run test in a subshell; some versions of sh will print an error if |
726 | 775 | # an executable is not found, even if stderr is redirected. |
727 | 776 | # Redirect stdin to placate older versions of autoconf. Sigh. |
733 | 782 | echo "$ac_t""missing" 1>&6 |
734 | 783 | fi |
735 | 784 | |
736 | echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 | |
737 | echo "configure:739: checking whether ${MAKE-make} sets \${MAKE}" >&5 | |
738 | set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` | |
739 | if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then | |
740 | echo $ac_n "(cached) $ac_c" 1>&6 | |
741 | else | |
742 | cat > conftestmake <<\EOF | |
743 | all: | |
744 | @echo 'ac_maketemp="${MAKE}"' | |
745 | EOF | |
746 | # GNU make sometimes prints "make[1]: Entering...", which would confuse us. | |
747 | eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` | |
748 | if test -n "$ac_maketemp"; then | |
749 | eval ac_cv_prog_make_${ac_make}_set=yes | |
750 | else | |
751 | eval ac_cv_prog_make_${ac_make}_set=no | |
752 | fi | |
753 | rm -f conftestmake | |
754 | fi | |
755 | if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then | |
756 | echo "$ac_t""yes" 1>&6 | |
757 | SET_MAKE= | |
758 | else | |
759 | echo "$ac_t""no" 1>&6 | |
760 | SET_MAKE="MAKE=${MAKE-make}" | |
761 | fi | |
762 | 785 | |
763 | 786 | |
764 | 787 | |
770 | 793 | # Extract the first word of "gcc", so it can be a program name with args. |
771 | 794 | set dummy gcc; ac_word=$2 |
772 | 795 | echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
773 | echo "configure:775: checking for $ac_word" >&5 | |
796 | echo "configure:798: checking for $ac_word" >&5 | |
774 | 797 | if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then |
775 | 798 | echo $ac_n "(cached) $ac_c" 1>&6 |
776 | 799 | else |
777 | 800 | if test -n "$CC"; then |
778 | 801 | ac_cv_prog_CC="$CC" # Let the user override the test. |
779 | 802 | else |
780 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" | |
781 | for ac_dir in $PATH; do | |
803 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" | |
804 | ac_dummy="$PATH" | |
805 | for ac_dir in $ac_dummy; do | |
782 | 806 | test -z "$ac_dir" && ac_dir=. |
783 | 807 | if test -f $ac_dir/$ac_word; then |
784 | 808 | ac_cv_prog_CC="gcc" |
799 | 823 | # Extract the first word of "cc", so it can be a program name with args. |
800 | 824 | set dummy cc; ac_word=$2 |
801 | 825 | echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
802 | echo "configure:804: checking for $ac_word" >&5 | |
826 | echo "configure:828: checking for $ac_word" >&5 | |
803 | 827 | if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then |
804 | 828 | echo $ac_n "(cached) $ac_c" 1>&6 |
805 | 829 | else |
806 | 830 | if test -n "$CC"; then |
807 | 831 | ac_cv_prog_CC="$CC" # Let the user override the test. |
808 | 832 | else |
809 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" | |
833 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" | |
810 | 834 | ac_prog_rejected=no |
811 | for ac_dir in $PATH; do | |
835 | ac_dummy="$PATH" | |
836 | for ac_dir in $ac_dummy; do | |
812 | 837 | test -z "$ac_dir" && ac_dir=. |
813 | 838 | if test -f $ac_dir/$ac_word; then |
814 | 839 | if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then |
843 | 868 | echo "$ac_t""no" 1>&6 |
844 | 869 | fi |
845 | 870 | |
871 | if test -z "$CC"; then | |
872 | case "`uname -s`" in | |
873 | *win32* | *WIN32*) | |
874 | # Extract the first word of "cl", so it can be a program name with args. | |
875 | set dummy cl; ac_word=$2 | |
876 | echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 | |
877 | echo "configure:879: checking for $ac_word" >&5 | |
878 | if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then | |
879 | echo $ac_n "(cached) $ac_c" 1>&6 | |
880 | else | |
881 | if test -n "$CC"; then | |
882 | ac_cv_prog_CC="$CC" # Let the user override the test. | |
883 | else | |
884 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" | |
885 | ac_dummy="$PATH" | |
886 | for ac_dir in $ac_dummy; do | |
887 | test -z "$ac_dir" && ac_dir=. | |
888 | if test -f $ac_dir/$ac_word; then | |
889 | ac_cv_prog_CC="cl" | |
890 | break | |
891 | fi | |
892 | done | |
893 | IFS="$ac_save_ifs" | |
894 | fi | |
895 | fi | |
896 | CC="$ac_cv_prog_CC" | |
897 | if test -n "$CC"; then | |
898 | echo "$ac_t""$CC" 1>&6 | |
899 | else | |
900 | echo "$ac_t""no" 1>&6 | |
901 | fi | |
902 | ;; | |
903 | esac | |
904 | fi | |
846 | 905 | test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } |
847 | 906 | fi |
848 | 907 | |
849 | 908 | echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 |
850 | echo "configure:852: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 | |
909 | echo "configure:911: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 | |
851 | 910 | |
852 | 911 | ac_ext=c |
853 | 912 | # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. |
854 | 913 | ac_cpp='$CPP $CPPFLAGS' |
855 | 914 | ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' |
856 | ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' | |
915 | ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' | |
857 | 916 | cross_compiling=$ac_cv_prog_cc_cross |
858 | 917 | |
859 | cat > conftest.$ac_ext <<EOF | |
860 | #line 862 "configure" | |
861 | #include "confdefs.h" | |
918 | cat > conftest.$ac_ext << EOF | |
919 | ||
920 | #line 922 "configure" | |
921 | #include "confdefs.h" | |
922 | ||
862 | 923 | main(){return(0);} |
863 | 924 | EOF |
864 | if { (eval echo configure:866: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then | |
925 | if { (eval echo configure:927: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
865 | 926 | ac_cv_prog_cc_works=yes |
866 | 927 | # If we can't run a trivial program, we are probably using a cross compiler. |
867 | 928 | if (./conftest; exit) 2>/dev/null; then |
875 | 936 | ac_cv_prog_cc_works=no |
876 | 937 | fi |
877 | 938 | rm -fr conftest* |
939 | ac_ext=c | |
940 | # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. | |
941 | ac_cpp='$CPP $CPPFLAGS' | |
942 | ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' | |
943 | ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' | |
944 | cross_compiling=$ac_cv_prog_cc_cross | |
878 | 945 | |
879 | 946 | echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 |
880 | 947 | if test $ac_cv_prog_cc_works = no; then |
881 | 948 | { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } |
882 | 949 | fi |
883 | 950 | echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 |
884 | echo "configure:886: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 | |
951 | echo "configure:953: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 | |
885 | 952 | echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 |
886 | 953 | cross_compiling=$ac_cv_prog_cc_cross |
887 | 954 | |
888 | 955 | echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 |
889 | echo "configure:891: checking whether we are using GNU C" >&5 | |
956 | echo "configure:958: checking whether we are using GNU C" >&5 | |
890 | 957 | if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then |
891 | 958 | echo $ac_n "(cached) $ac_c" 1>&6 |
892 | 959 | else |
895 | 962 | yes; |
896 | 963 | #endif |
897 | 964 | EOF |
898 | if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:900: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then | |
965 | if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:967: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then | |
899 | 966 | ac_cv_prog_gcc=yes |
900 | 967 | else |
901 | 968 | ac_cv_prog_gcc=no |
906 | 973 | |
907 | 974 | if test $ac_cv_prog_gcc = yes; then |
908 | 975 | GCC=yes |
909 | ac_test_CFLAGS="${CFLAGS+set}" | |
910 | ac_save_CFLAGS="$CFLAGS" | |
911 | CFLAGS= | |
912 | echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 | |
913 | echo "configure:915: checking whether ${CC-cc} accepts -g" >&5 | |
976 | else | |
977 | GCC= | |
978 | fi | |
979 | ||
980 | ac_test_CFLAGS="${CFLAGS+set}" | |
981 | ac_save_CFLAGS="$CFLAGS" | |
982 | CFLAGS= | |
983 | echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 | |
984 | echo "configure:986: checking whether ${CC-cc} accepts -g" >&5 | |
914 | 985 | if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then |
915 | 986 | echo $ac_n "(cached) $ac_c" 1>&6 |
916 | 987 | else |
925 | 996 | fi |
926 | 997 | |
927 | 998 | echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 |
928 | if test "$ac_test_CFLAGS" = set; then | |
929 | CFLAGS="$ac_save_CFLAGS" | |
930 | elif test $ac_cv_prog_cc_g = yes; then | |
999 | if test "$ac_test_CFLAGS" = set; then | |
1000 | CFLAGS="$ac_save_CFLAGS" | |
1001 | elif test $ac_cv_prog_cc_g = yes; then | |
1002 | if test "$GCC" = yes; then | |
931 | 1003 | CFLAGS="-g -O2" |
932 | 1004 | else |
1005 | CFLAGS="-g" | |
1006 | fi | |
1007 | else | |
1008 | if test "$GCC" = yes; then | |
933 | 1009 | CFLAGS="-O2" |
1010 | else | |
1011 | CFLAGS= | |
934 | 1012 | fi |
935 | else | |
936 | GCC= | |
937 | test "${CFLAGS+set}" = set || CFLAGS="-g" | |
938 | 1013 | fi |
939 | 1014 | |
940 | 1015 | |
941 | 1016 | echo $ac_n "checking size of unsigned char""... $ac_c" 1>&6 |
942 | echo "configure:944: checking size of unsigned char" >&5 | |
1017 | echo "configure:1019: checking size of unsigned char" >&5 | |
943 | 1018 | if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_char'+set}'`\" = set"; then |
944 | 1019 | echo $ac_n "(cached) $ac_c" 1>&6 |
945 | 1020 | else |
947 | 1022 | ac_cv_sizeof_unsigned_char=1 |
948 | 1023 | else |
949 | 1024 | cat > conftest.$ac_ext <<EOF |
950 | #line 952 "configure" | |
1025 | #line 1027 "configure" | |
951 | 1026 | #include "confdefs.h" |
952 | 1027 | #include <stdio.h> |
953 | 1028 | main() |
958 | 1033 | exit(0); |
959 | 1034 | } |
960 | 1035 | EOF |
961 | if { (eval echo configure:963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null | |
1036 | if { (eval echo configure:1038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null | |
962 | 1037 | then |
963 | 1038 | ac_cv_sizeof_unsigned_char=`cat conftestval` |
964 | 1039 | else |
978 | 1053 | |
979 | 1054 | |
980 | 1055 | echo $ac_n "checking size of unsigned short""... $ac_c" 1>&6 |
981 | echo "configure:983: checking size of unsigned short" >&5 | |
1056 | echo "configure:1058: checking size of unsigned short" >&5 | |
982 | 1057 | if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_short'+set}'`\" = set"; then |
983 | 1058 | echo $ac_n "(cached) $ac_c" 1>&6 |
984 | 1059 | else |
986 | 1061 | ac_cv_sizeof_unsigned_short=2 |
987 | 1062 | else |
988 | 1063 | cat > conftest.$ac_ext <<EOF |
989 | #line 991 "configure" | |
1064 | #line 1066 "configure" | |
990 | 1065 | #include "confdefs.h" |
991 | 1066 | #include <stdio.h> |
992 | 1067 | main() |
997 | 1072 | exit(0); |
998 | 1073 | } |
999 | 1074 | EOF |
1000 | if { (eval echo configure:1002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null | |
1075 | if { (eval echo configure:1077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null | |
1001 | 1076 | then |
1002 | 1077 | ac_cv_sizeof_unsigned_short=`cat conftestval` |
1003 | 1078 | else |
1017 | 1092 | |
1018 | 1093 | |
1019 | 1094 | echo $ac_n "checking size of unsigned int""... $ac_c" 1>&6 |
1020 | echo "configure:1022: checking size of unsigned int" >&5 | |
1095 | echo "configure:1097: checking size of unsigned int" >&5 | |
1021 | 1096 | if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_int'+set}'`\" = set"; then |
1022 | 1097 | echo $ac_n "(cached) $ac_c" 1>&6 |
1023 | 1098 | else |
1025 | 1100 | ac_cv_sizeof_unsigned_int=4 |
1026 | 1101 | else |
1027 | 1102 | cat > conftest.$ac_ext <<EOF |
1028 | #line 1030 "configure" | |
1103 | #line 1105 "configure" | |
1029 | 1104 | #include "confdefs.h" |
1030 | 1105 | #include <stdio.h> |
1031 | 1106 | main() |
1036 | 1111 | exit(0); |
1037 | 1112 | } |
1038 | 1113 | EOF |
1039 | if { (eval echo configure:1041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null | |
1114 | if { (eval echo configure:1116: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null | |
1040 | 1115 | then |
1041 | 1116 | ac_cv_sizeof_unsigned_int=`cat conftestval` |
1042 | 1117 | else |
1056 | 1131 | |
1057 | 1132 | |
1058 | 1133 | echo $ac_n "checking size of unsigned long""... $ac_c" 1>&6 |
1059 | echo "configure:1061: checking size of unsigned long" >&5 | |
1134 | echo "configure:1136: checking size of unsigned long" >&5 | |
1060 | 1135 | if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_long'+set}'`\" = set"; then |
1061 | 1136 | echo $ac_n "(cached) $ac_c" 1>&6 |
1062 | 1137 | else |
1064 | 1139 | ac_cv_sizeof_unsigned_long=4 |
1065 | 1140 | else |
1066 | 1141 | cat > conftest.$ac_ext <<EOF |
1067 | #line 1069 "configure" | |
1142 | #line 1144 "configure" | |
1068 | 1143 | #include "confdefs.h" |
1069 | 1144 | #include <stdio.h> |
1070 | 1145 | main() |
1075 | 1150 | exit(0); |
1076 | 1151 | } |
1077 | 1152 | EOF |
1078 | if { (eval echo configure:1080: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null | |
1153 | if { (eval echo configure:1155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null | |
1079 | 1154 | then |
1080 | 1155 | ac_cv_sizeof_unsigned_long=`cat conftestval` |
1081 | 1156 | else |
1095 | 1170 | |
1096 | 1171 | |
1097 | 1172 | |
1173 | # Some doc I found somewhere. :-) -- REW | |
1174 | # - Macro: AC_CHECK_FUNC (FUNCTION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) | |
1175 | # - Macro: AC_CHECK_LIB (LIBRARY, FUNCTION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]]) | |
1176 | ||
1177 | # We don't refer to any symbols in termcap, but -lcurses on SunOS does. | |
1178 | # We have to trust the linker not to mess things up... (It should not | |
1179 | # pull in anything if we don't refer to anything in the lib). | |
1180 | echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6 | |
1181 | echo "configure:1183: checking for tgetent in -ltermcap" >&5 | |
1182 | ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'` | |
1183 | if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then | |
1184 | echo $ac_n "(cached) $ac_c" 1>&6 | |
1185 | else | |
1186 | ac_save_LIBS="$LIBS" | |
1187 | LIBS="-ltermcap $LIBS" | |
1188 | cat > conftest.$ac_ext <<EOF | |
1189 | #line 1191 "configure" | |
1190 | #include "confdefs.h" | |
1191 | /* Override any gcc2 internal prototype to avoid an error. */ | |
1192 | /* We use char because int might match the return type of a gcc2 | |
1193 | builtin and then its argument prototype would still apply. */ | |
1194 | char tgetent(); | |
1195 | ||
1196 | int main() { | |
1197 | tgetent() | |
1198 | ; return 0; } | |
1199 | EOF | |
1200 | if { (eval echo configure:1202: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
1201 | rm -rf conftest* | |
1202 | eval "ac_cv_lib_$ac_lib_var=yes" | |
1203 | else | |
1204 | echo "configure: failed program was:" >&5 | |
1205 | cat conftest.$ac_ext >&5 | |
1206 | rm -rf conftest* | |
1207 | eval "ac_cv_lib_$ac_lib_var=no" | |
1208 | fi | |
1209 | rm -f conftest* | |
1210 | LIBS="$ac_save_LIBS" | |
1211 | ||
1212 | fi | |
1213 | if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then | |
1214 | echo "$ac_t""yes" 1>&6 | |
1215 | ac_tr_lib=HAVE_LIB`echo termcap | sed -e 's/[^a-zA-Z0-9_]/_/g' \ | |
1216 | -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` | |
1217 | cat >> confdefs.h <<EOF | |
1218 | #define $ac_tr_lib 1 | |
1219 | EOF | |
1220 | ||
1221 | LIBS="-ltermcap $LIBS" | |
1222 | ||
1223 | else | |
1224 | echo "$ac_t""no" 1>&6 | |
1225 | fi | |
1226 | ||
1227 | ||
1098 | 1228 | echo $ac_n "checking for initscr""... $ac_c" 1>&6 |
1099 | echo "configure:1101: checking for initscr" >&5 | |
1229 | echo "configure:1231: checking for initscr" >&5 | |
1100 | 1230 | if eval "test \"`echo '$''{'ac_cv_func_initscr'+set}'`\" = set"; then |
1101 | 1231 | echo $ac_n "(cached) $ac_c" 1>&6 |
1102 | 1232 | else |
1103 | 1233 | cat > conftest.$ac_ext <<EOF |
1104 | #line 1106 "configure" | |
1234 | #line 1236 "configure" | |
1105 | 1235 | #include "confdefs.h" |
1106 | 1236 | /* System header to define __stub macros and hopefully few prototypes, |
1107 | 1237 | which can conflict with char initscr(); below. */ |
1124 | 1254 | |
1125 | 1255 | ; return 0; } |
1126 | 1256 | EOF |
1127 | if { (eval echo configure:1129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then | |
1257 | if { (eval echo configure:1259: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
1128 | 1258 | rm -rf conftest* |
1129 | 1259 | eval "ac_cv_func_initscr=yes" |
1130 | 1260 | else |
1142 | 1272 | else |
1143 | 1273 | echo "$ac_t""no" 1>&6 |
1144 | 1274 | echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6 |
1145 | echo "configure:1147: checking for initscr in -lncurses" >&5 | |
1275 | echo "configure:1277: checking for initscr in -lncurses" >&5 | |
1146 | 1276 | ac_lib_var=`echo ncurses'_'initscr | sed 'y%./+-%__p_%'` |
1147 | 1277 | if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then |
1148 | 1278 | echo $ac_n "(cached) $ac_c" 1>&6 |
1150 | 1280 | ac_save_LIBS="$LIBS" |
1151 | 1281 | LIBS="-lncurses $LIBS" |
1152 | 1282 | cat > conftest.$ac_ext <<EOF |
1153 | #line 1155 "configure" | |
1283 | #line 1285 "configure" | |
1154 | 1284 | #include "confdefs.h" |
1155 | 1285 | /* Override any gcc2 internal prototype to avoid an error. */ |
1156 | 1286 | /* We use char because int might match the return type of a gcc2 |
1161 | 1291 | initscr() |
1162 | 1292 | ; return 0; } |
1163 | 1293 | EOF |
1164 | if { (eval echo configure:1166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then | |
1294 | if { (eval echo configure:1296: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
1165 | 1295 | rm -rf conftest* |
1166 | 1296 | eval "ac_cv_lib_$ac_lib_var=yes" |
1167 | 1297 | else |
1187 | 1317 | else |
1188 | 1318 | echo "$ac_t""no" 1>&6 |
1189 | 1319 | echo $ac_n "checking for initscr in -lcurses""... $ac_c" 1>&6 |
1190 | echo "configure:1192: checking for initscr in -lcurses" >&5 | |
1320 | echo "configure:1322: checking for initscr in -lcurses" >&5 | |
1191 | 1321 | ac_lib_var=`echo curses'_'initscr | sed 'y%./+-%__p_%'` |
1192 | 1322 | if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then |
1193 | 1323 | echo $ac_n "(cached) $ac_c" 1>&6 |
1195 | 1325 | ac_save_LIBS="$LIBS" |
1196 | 1326 | LIBS="-lcurses $LIBS" |
1197 | 1327 | cat > conftest.$ac_ext <<EOF |
1198 | #line 1200 "configure" | |
1328 | #line 1330 "configure" | |
1199 | 1329 | #include "confdefs.h" |
1200 | 1330 | /* Override any gcc2 internal prototype to avoid an error. */ |
1201 | 1331 | /* We use char because int might match the return type of a gcc2 |
1206 | 1336 | initscr() |
1207 | 1337 | ; return 0; } |
1208 | 1338 | EOF |
1209 | if { (eval echo configure:1211: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then | |
1339 | if { (eval echo configure:1341: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
1210 | 1340 | rm -rf conftest* |
1211 | 1341 | eval "ac_cv_lib_$ac_lib_var=yes" |
1212 | 1342 | else |
1231 | 1361 | |
1232 | 1362 | else |
1233 | 1363 | echo "$ac_t""no" 1>&6 |
1364 | echo $ac_n "checking for initscr in -lcursesX""... $ac_c" 1>&6 | |
1365 | echo "configure:1367: checking for initscr in -lcursesX" >&5 | |
1366 | ac_lib_var=`echo cursesX'_'initscr | sed 'y%./+-%__p_%'` | |
1367 | if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then | |
1368 | echo $ac_n "(cached) $ac_c" 1>&6 | |
1369 | else | |
1370 | ac_save_LIBS="$LIBS" | |
1371 | LIBS="-lcursesX $LIBS" | |
1372 | cat > conftest.$ac_ext <<EOF | |
1373 | #line 1375 "configure" | |
1374 | #include "confdefs.h" | |
1375 | /* Override any gcc2 internal prototype to avoid an error. */ | |
1376 | /* We use char because int might match the return type of a gcc2 | |
1377 | builtin and then its argument prototype would still apply. */ | |
1378 | char initscr(); | |
1379 | ||
1380 | int main() { | |
1381 | initscr() | |
1382 | ; return 0; } | |
1383 | EOF | |
1384 | if { (eval echo configure:1386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
1385 | rm -rf conftest* | |
1386 | eval "ac_cv_lib_$ac_lib_var=yes" | |
1387 | else | |
1388 | echo "configure: failed program was:" >&5 | |
1389 | cat conftest.$ac_ext >&5 | |
1390 | rm -rf conftest* | |
1391 | eval "ac_cv_lib_$ac_lib_var=no" | |
1392 | fi | |
1393 | rm -f conftest* | |
1394 | LIBS="$ac_save_LIBS" | |
1395 | ||
1396 | fi | |
1397 | if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then | |
1398 | echo "$ac_t""yes" 1>&6 | |
1399 | ac_tr_lib=HAVE_LIB`echo cursesX | sed -e 's/^a-zA-Z0-9_/_/g' \ | |
1400 | -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` | |
1401 | cat >> confdefs.h <<EOF | |
1402 | #define $ac_tr_lib 1 | |
1403 | EOF | |
1404 | ||
1405 | LIBS="-lcursesX $LIBS" | |
1406 | ||
1407 | else | |
1408 | echo "$ac_t""no" 1>&6 | |
1234 | 1409 | echo "configure: warning: Building without curses display support" 1>&2 |
1235 | 1410 | cat >> confdefs.h <<\EOF |
1236 | 1411 | #define NO_CURSES 1 |
1243 | 1418 | |
1244 | 1419 | fi |
1245 | 1420 | |
1421 | fi | |
1422 | ||
1423 | ||
1424 | for ac_func in attron | |
1425 | do | |
1426 | echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 | |
1427 | echo "configure:1429: checking for $ac_func" >&5 | |
1428 | if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then | |
1429 | echo $ac_n "(cached) $ac_c" 1>&6 | |
1430 | else | |
1431 | cat > conftest.$ac_ext <<EOF | |
1432 | #line 1434 "configure" | |
1433 | #include "confdefs.h" | |
1434 | /* System header to define __stub macros and hopefully few prototypes, | |
1435 | which can conflict with char $ac_func(); below. */ | |
1436 | #include <assert.h> | |
1437 | /* Override any gcc2 internal prototype to avoid an error. */ | |
1438 | /* We use char because int might match the return type of a gcc2 | |
1439 | builtin and then its argument prototype would still apply. */ | |
1440 | char $ac_func(); | |
1441 | ||
1442 | int main() { | |
1443 | ||
1444 | /* The GNU C library defines this for functions which it implements | |
1445 | to always fail with ENOSYS. Some functions are actually named | |
1446 | something starting with __ and the normal name is an alias. */ | |
1447 | #if defined (__stub_$ac_func) || defined (__stub___$ac_func) | |
1448 | choke me | |
1449 | #else | |
1450 | $ac_func(); | |
1451 | #endif | |
1452 | ||
1453 | ; return 0; } | |
1454 | EOF | |
1455 | if { (eval echo configure:1457: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
1456 | rm -rf conftest* | |
1457 | eval "ac_cv_func_$ac_func=yes" | |
1458 | else | |
1459 | echo "configure: failed program was:" >&5 | |
1460 | cat conftest.$ac_ext >&5 | |
1461 | rm -rf conftest* | |
1462 | eval "ac_cv_func_$ac_func=no" | |
1463 | fi | |
1464 | rm -f conftest* | |
1465 | fi | |
1466 | ||
1467 | if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then | |
1468 | echo "$ac_t""yes" 1>&6 | |
1469 | ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` | |
1470 | cat >> confdefs.h <<EOF | |
1471 | #define $ac_tr_func 1 | |
1472 | EOF | |
1473 | ||
1474 | else | |
1475 | echo "$ac_t""no" 1>&6 | |
1476 | fi | |
1477 | done | |
1478 | ||
1479 | ||
1480 | ||
1246 | 1481 | echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 |
1247 | echo "configure:1249: checking how to run the C preprocessor" >&5 | |
1482 | echo "configure:1484: checking how to run the C preprocessor" >&5 | |
1248 | 1483 | # On Suns, sometimes $CPP names a directory. |
1249 | 1484 | if test -n "$CPP" && test -d "$CPP"; then |
1250 | 1485 | CPP= |
1259 | 1494 | # On the NeXT, cc -E runs the code through the compiler's parser, |
1260 | 1495 | # not just through cpp. |
1261 | 1496 | cat > conftest.$ac_ext <<EOF |
1262 | #line 1264 "configure" | |
1497 | #line 1499 "configure" | |
1263 | 1498 | #include "confdefs.h" |
1264 | 1499 | #include <assert.h> |
1265 | 1500 | Syntax Error |
1266 | 1501 | EOF |
1267 | 1502 | ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" |
1268 | { (eval echo configure:1270: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | |
1269 | ac_err=`grep -v '^ *+' conftest.out` | |
1503 | { (eval echo configure:1505: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | |
1504 | ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` | |
1270 | 1505 | if test -z "$ac_err"; then |
1271 | 1506 | : |
1272 | 1507 | else |
1276 | 1511 | rm -rf conftest* |
1277 | 1512 | CPP="${CC-cc} -E -traditional-cpp" |
1278 | 1513 | cat > conftest.$ac_ext <<EOF |
1279 | #line 1281 "configure" | |
1514 | #line 1516 "configure" | |
1280 | 1515 | #include "confdefs.h" |
1281 | 1516 | #include <assert.h> |
1282 | 1517 | Syntax Error |
1283 | 1518 | EOF |
1284 | 1519 | ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" |
1285 | { (eval echo configure:1287: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | |
1286 | ac_err=`grep -v '^ *+' conftest.out` | |
1520 | { (eval echo configure:1522: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | |
1521 | ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` | |
1287 | 1522 | if test -z "$ac_err"; then |
1288 | 1523 | : |
1289 | 1524 | else |
1291 | 1526 | echo "configure: failed program was:" >&5 |
1292 | 1527 | cat conftest.$ac_ext >&5 |
1293 | 1528 | rm -rf conftest* |
1529 | CPP="${CC-cc} -nologo -E" | |
1530 | cat > conftest.$ac_ext <<EOF | |
1531 | #line 1533 "configure" | |
1532 | #include "confdefs.h" | |
1533 | #include <assert.h> | |
1534 | Syntax Error | |
1535 | EOF | |
1536 | ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" | |
1537 | { (eval echo configure:1539: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | |
1538 | ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` | |
1539 | if test -z "$ac_err"; then | |
1540 | : | |
1541 | else | |
1542 | echo "$ac_err" >&5 | |
1543 | echo "configure: failed program was:" >&5 | |
1544 | cat conftest.$ac_ext >&5 | |
1545 | rm -rf conftest* | |
1294 | 1546 | CPP=/lib/cpp |
1547 | fi | |
1548 | rm -f conftest* | |
1295 | 1549 | fi |
1296 | 1550 | rm -f conftest* |
1297 | 1551 | fi |
1304 | 1558 | fi |
1305 | 1559 | echo "$ac_t""$CPP" 1>&6 |
1306 | 1560 | |
1307 | for ac_hdr in ncurses.h ncurses/curses.h curses.h | |
1561 | for ac_hdr in ncurses.h ncurses/curses.h curses.h cursesX.h sys/types.h | |
1308 | 1562 | do |
1309 | 1563 | ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` |
1310 | 1564 | echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 |
1311 | echo "configure:1313: checking for $ac_hdr" >&5 | |
1565 | echo "configure:1567: checking for $ac_hdr" >&5 | |
1312 | 1566 | if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then |
1313 | 1567 | echo $ac_n "(cached) $ac_c" 1>&6 |
1314 | 1568 | else |
1315 | 1569 | cat > conftest.$ac_ext <<EOF |
1316 | #line 1318 "configure" | |
1570 | #line 1572 "configure" | |
1317 | 1571 | #include "confdefs.h" |
1318 | 1572 | #include <$ac_hdr> |
1319 | 1573 | EOF |
1320 | 1574 | ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" |
1321 | { (eval echo configure:1323: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | |
1322 | ac_err=`grep -v '^ *+' conftest.out` | |
1575 | { (eval echo configure:1577: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | |
1576 | ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` | |
1323 | 1577 | if test -z "$ac_err"; then |
1324 | 1578 | rm -rf conftest* |
1325 | 1579 | eval "ac_cv_header_$ac_safe=yes" |
1348 | 1602 | do |
1349 | 1603 | ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` |
1350 | 1604 | echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 |
1351 | echo "configure:1353: checking for $ac_hdr" >&5 | |
1605 | echo "configure:1607: checking for $ac_hdr" >&5 | |
1352 | 1606 | if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then |
1353 | 1607 | echo $ac_n "(cached) $ac_c" 1>&6 |
1354 | 1608 | else |
1355 | 1609 | cat > conftest.$ac_ext <<EOF |
1356 | #line 1358 "configure" | |
1610 | #line 1612 "configure" | |
1357 | 1611 | #include "confdefs.h" |
1358 | 1612 | #include <$ac_hdr> |
1359 | 1613 | EOF |
1360 | 1614 | ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" |
1361 | { (eval echo configure:1363: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | |
1362 | ac_err=`grep -v '^ *+' conftest.out` | |
1615 | { (eval echo configure:1617: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | |
1616 | ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` | |
1363 | 1617 | if test -z "$ac_err"; then |
1364 | 1618 | rm -rf conftest* |
1365 | 1619 | eval "ac_cv_header_$ac_safe=yes" |
1386 | 1640 | |
1387 | 1641 | |
1388 | 1642 | echo $ac_n "checking for floor in -lm""... $ac_c" 1>&6 |
1389 | echo "configure:1391: checking for floor in -lm" >&5 | |
1643 | echo "configure:1645: checking for floor in -lm" >&5 | |
1390 | 1644 | ac_lib_var=`echo m'_'floor | sed 'y%./+-%__p_%'` |
1391 | 1645 | if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then |
1392 | 1646 | echo $ac_n "(cached) $ac_c" 1>&6 |
1394 | 1648 | ac_save_LIBS="$LIBS" |
1395 | 1649 | LIBS="-lm $LIBS" |
1396 | 1650 | cat > conftest.$ac_ext <<EOF |
1397 | #line 1399 "configure" | |
1651 | #line 1653 "configure" | |
1398 | 1652 | #include "confdefs.h" |
1399 | 1653 | /* Override any gcc2 internal prototype to avoid an error. */ |
1400 | 1654 | /* We use char because int might match the return type of a gcc2 |
1405 | 1659 | floor() |
1406 | 1660 | ; return 0; } |
1407 | 1661 | EOF |
1408 | if { (eval echo configure:1410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then | |
1662 | if { (eval echo configure:1664: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
1409 | 1663 | rm -rf conftest* |
1410 | 1664 | eval "ac_cv_lib_$ac_lib_var=yes" |
1411 | 1665 | else |
1458 | 1712 | enable_gtktest=yes |
1459 | 1713 | fi |
1460 | 1714 | |
1461 | ||
1715 | # Check whether --enable-gtk or --disable-gtk was given. | |
1716 | if test "${enable_gtk+set}" = set; then | |
1717 | enableval="$enable_gtk" | |
1718 | : | |
1719 | else | |
1720 | enable_gtk=yes | |
1721 | fi | |
1722 | ||
1723 | ||
1724 | if test x$enable_gtk != xyes ; then | |
1725 | GTK_CFLAGS="" | |
1726 | GTK_LIBS="" | |
1727 | echo "configure: warning: Building without GTK+ display support" 1>&2 | |
1728 | cat >> confdefs.h <<\EOF | |
1729 | #define NO_GTK 1 | |
1730 | EOF | |
1731 | ||
1732 | GTK_OBJ= | |
1733 | else # Begin wrap around GTK stuff | |
1462 | 1734 | if test x$gtk_config_exec_prefix != x ; then |
1463 | 1735 | gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" |
1464 | 1736 | if test x${GTK_CONFIG+set} != xset ; then |
1475 | 1747 | # Extract the first word of "gtk-config", so it can be a program name with args. |
1476 | 1748 | set dummy gtk-config; ac_word=$2 |
1477 | 1749 | echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
1478 | echo "configure:1480: checking for $ac_word" >&5 | |
1750 | echo "configure:1752: checking for $ac_word" >&5 | |
1479 | 1751 | if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then |
1480 | 1752 | echo $ac_n "(cached) $ac_c" 1>&6 |
1481 | 1753 | else |
1483 | 1755 | /*) |
1484 | 1756 | ac_cv_path_GTK_CONFIG="$GTK_CONFIG" # Let the user override the test with a path. |
1485 | 1757 | ;; |
1758 | ?:/*) | |
1759 | ac_cv_path_GTK_CONFIG="$GTK_CONFIG" # Let the user override the test with a dos path. | |
1760 | ;; | |
1486 | 1761 | *) |
1487 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" | |
1488 | for ac_dir in $PATH; do | |
1762 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" | |
1763 | ac_dummy="$PATH" | |
1764 | for ac_dir in $ac_dummy; do | |
1489 | 1765 | test -z "$ac_dir" && ac_dir=. |
1490 | 1766 | if test -f $ac_dir/$ac_word; then |
1491 | 1767 | ac_cv_path_GTK_CONFIG="$ac_dir/$ac_word" |
1506 | 1782 | |
1507 | 1783 | min_gtk_version=1.0.0 |
1508 | 1784 | echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6 |
1509 | echo "configure:1511: checking for GTK - version >= $min_gtk_version" >&5 | |
1785 | echo "configure:1787: checking for GTK - version >= $min_gtk_version" >&5 | |
1510 | 1786 | no_gtk="" |
1511 | 1787 | if test "$GTK_CONFIG" = "no" ; then |
1512 | 1788 | no_gtk=yes |
1529 | 1805 | echo $ac_n "cross compiling; assumed OK... $ac_c" |
1530 | 1806 | else |
1531 | 1807 | cat > conftest.$ac_ext <<EOF |
1532 | #line 1534 "configure" | |
1808 | #line 1810 "configure" | |
1533 | 1809 | #include "confdefs.h" |
1534 | 1810 | |
1535 | 1811 | #include <gtk/gtk.h> |
1595 | 1871 | } |
1596 | 1872 | |
1597 | 1873 | EOF |
1598 | if { (eval echo configure:1600: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null | |
1874 | if { (eval echo configure:1876: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null | |
1599 | 1875 | then |
1600 | 1876 | : |
1601 | 1877 | else |
1630 | 1906 | CFLAGS="$CFLAGS $GTK_CFLAGS" |
1631 | 1907 | LIBS="$LIBS $GTK_LIBS" |
1632 | 1908 | cat > conftest.$ac_ext <<EOF |
1633 | #line 1635 "configure" | |
1909 | #line 1911 "configure" | |
1634 | 1910 | #include "confdefs.h" |
1635 | 1911 | |
1636 | 1912 | #include <gtk/gtk.h> |
1640 | 1916 | return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); |
1641 | 1917 | ; return 0; } |
1642 | 1918 | EOF |
1643 | if { (eval echo configure:1645: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then | |
1919 | if { (eval echo configure:1921: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
1644 | 1920 | rm -rf conftest* |
1645 | 1921 | echo "*** The test program compiled, but did not run. This usually means" |
1646 | 1922 | echo "*** that the run-time linker is not finding GTK or finding the wrong" |
1682 | 1958 | |
1683 | 1959 | |
1684 | 1960 | rm -f conf.gtktest |
1961 | # End wrap around GTK stuff | |
1962 | fi | |
1685 | 1963 | |
1686 | 1964 | |
1687 | 1965 | echo $ac_n "checking for socket""... $ac_c" 1>&6 |
1688 | echo "configure:1690: checking for socket" >&5 | |
1966 | echo "configure:1968: checking for socket" >&5 | |
1689 | 1967 | if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then |
1690 | 1968 | echo $ac_n "(cached) $ac_c" 1>&6 |
1691 | 1969 | else |
1692 | 1970 | cat > conftest.$ac_ext <<EOF |
1693 | #line 1695 "configure" | |
1971 | #line 1973 "configure" | |
1694 | 1972 | #include "confdefs.h" |
1695 | 1973 | /* System header to define __stub macros and hopefully few prototypes, |
1696 | 1974 | which can conflict with char socket(); below. */ |
1713 | 1991 | |
1714 | 1992 | ; return 0; } |
1715 | 1993 | EOF |
1716 | if { (eval echo configure:1718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then | |
1994 | if { (eval echo configure:1996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
1717 | 1995 | rm -rf conftest* |
1718 | 1996 | eval "ac_cv_func_socket=yes" |
1719 | 1997 | else |
1731 | 2009 | else |
1732 | 2010 | echo "$ac_t""no" 1>&6 |
1733 | 2011 | echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 |
1734 | echo "configure:1736: checking for socket in -lsocket" >&5 | |
2012 | echo "configure:2014: checking for socket in -lsocket" >&5 | |
1735 | 2013 | ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` |
1736 | 2014 | if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then |
1737 | 2015 | echo $ac_n "(cached) $ac_c" 1>&6 |
1739 | 2017 | ac_save_LIBS="$LIBS" |
1740 | 2018 | LIBS="-lsocket $LIBS" |
1741 | 2019 | cat > conftest.$ac_ext <<EOF |
1742 | #line 1744 "configure" | |
2020 | #line 2022 "configure" | |
1743 | 2021 | #include "confdefs.h" |
1744 | 2022 | /* Override any gcc2 internal prototype to avoid an error. */ |
1745 | 2023 | /* We use char because int might match the return type of a gcc2 |
1750 | 2028 | socket() |
1751 | 2029 | ; return 0; } |
1752 | 2030 | EOF |
1753 | if { (eval echo configure:1755: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then | |
2031 | if { (eval echo configure:2033: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
1754 | 2032 | rm -rf conftest* |
1755 | 2033 | eval "ac_cv_lib_$ac_lib_var=yes" |
1756 | 2034 | else |
1782 | 2060 | |
1783 | 2061 | |
1784 | 2062 | echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 |
1785 | echo "configure:1787: checking for gethostbyname" >&5 | |
2063 | echo "configure:2065: checking for gethostbyname" >&5 | |
1786 | 2064 | if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then |
1787 | 2065 | echo $ac_n "(cached) $ac_c" 1>&6 |
1788 | 2066 | else |
1789 | 2067 | cat > conftest.$ac_ext <<EOF |
1790 | #line 1792 "configure" | |
2068 | #line 2070 "configure" | |
1791 | 2069 | #include "confdefs.h" |
1792 | 2070 | /* System header to define __stub macros and hopefully few prototypes, |
1793 | 2071 | which can conflict with char gethostbyname(); below. */ |
1810 | 2088 | |
1811 | 2089 | ; return 0; } |
1812 | 2090 | EOF |
1813 | if { (eval echo configure:1815: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then | |
2091 | if { (eval echo configure:2093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
1814 | 2092 | rm -rf conftest* |
1815 | 2093 | eval "ac_cv_func_gethostbyname=yes" |
1816 | 2094 | else |
1828 | 2106 | else |
1829 | 2107 | echo "$ac_t""no" 1>&6 |
1830 | 2108 | echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 |
1831 | echo "configure:1833: checking for gethostbyname in -lnsl" >&5 | |
2109 | echo "configure:2111: checking for gethostbyname in -lnsl" >&5 | |
1832 | 2110 | ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` |
1833 | 2111 | if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then |
1834 | 2112 | echo $ac_n "(cached) $ac_c" 1>&6 |
1836 | 2114 | ac_save_LIBS="$LIBS" |
1837 | 2115 | LIBS="-lnsl $LIBS" |
1838 | 2116 | cat > conftest.$ac_ext <<EOF |
1839 | #line 1841 "configure" | |
2117 | #line 2119 "configure" | |
1840 | 2118 | #include "confdefs.h" |
1841 | 2119 | /* Override any gcc2 internal prototype to avoid an error. */ |
1842 | 2120 | /* We use char because int might match the return type of a gcc2 |
1847 | 2125 | gethostbyname() |
1848 | 2126 | ; return 0; } |
1849 | 2127 | EOF |
1850 | if { (eval echo configure:1852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then | |
2128 | if { (eval echo configure:2130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
1851 | 2129 | rm -rf conftest* |
1852 | 2130 | eval "ac_cv_lib_$ac_lib_var=yes" |
1853 | 2131 | else |
1878 | 2156 | fi |
1879 | 2157 | |
1880 | 2158 | |
2159 | echo $ac_n "checking for res_init""... $ac_c" 1>&6 | |
2160 | echo "configure:2162: checking for res_init" >&5 | |
2161 | if eval "test \"`echo '$''{'ac_cv_func_res_init'+set}'`\" = set"; then | |
2162 | echo $ac_n "(cached) $ac_c" 1>&6 | |
2163 | else | |
2164 | cat > conftest.$ac_ext <<EOF | |
2165 | #line 2167 "configure" | |
2166 | #include "confdefs.h" | |
2167 | /* System header to define __stub macros and hopefully few prototypes, | |
2168 | which can conflict with char res_init(); below. */ | |
2169 | #include <assert.h> | |
2170 | /* Override any gcc2 internal prototype to avoid an error. */ | |
2171 | /* We use char because int might match the return type of a gcc2 | |
2172 | builtin and then its argument prototype would still apply. */ | |
2173 | char res_init(); | |
2174 | ||
2175 | int main() { | |
2176 | ||
2177 | /* The GNU C library defines this for functions which it implements | |
2178 | to always fail with ENOSYS. Some functions are actually named | |
2179 | something starting with __ and the normal name is an alias. */ | |
2180 | #if defined (__stub_res_init) || defined (__stub___res_init) | |
2181 | choke me | |
2182 | #else | |
2183 | res_init(); | |
2184 | #endif | |
2185 | ||
2186 | ; return 0; } | |
2187 | EOF | |
2188 | if { (eval echo configure:2190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
2189 | rm -rf conftest* | |
2190 | eval "ac_cv_func_res_init=yes" | |
2191 | else | |
2192 | echo "configure: failed program was:" >&5 | |
2193 | cat conftest.$ac_ext >&5 | |
2194 | rm -rf conftest* | |
2195 | eval "ac_cv_func_res_init=no" | |
2196 | fi | |
2197 | rm -f conftest* | |
2198 | fi | |
2199 | ||
2200 | if eval "test \"`echo '$ac_cv_func_'res_init`\" = yes"; then | |
2201 | echo "$ac_t""yes" 1>&6 | |
2202 | : | |
2203 | else | |
2204 | echo "$ac_t""no" 1>&6 | |
2205 | echo $ac_n "checking for res_init in -lbind""... $ac_c" 1>&6 | |
2206 | echo "configure:2208: checking for res_init in -lbind" >&5 | |
2207 | ac_lib_var=`echo bind'_'res_init | sed 'y%./+-%__p_%'` | |
2208 | if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then | |
2209 | echo $ac_n "(cached) $ac_c" 1>&6 | |
2210 | else | |
2211 | ac_save_LIBS="$LIBS" | |
2212 | LIBS="-lbind $LIBS" | |
2213 | cat > conftest.$ac_ext <<EOF | |
2214 | #line 2216 "configure" | |
2215 | #include "confdefs.h" | |
2216 | /* Override any gcc2 internal prototype to avoid an error. */ | |
2217 | /* We use char because int might match the return type of a gcc2 | |
2218 | builtin and then its argument prototype would still apply. */ | |
2219 | char res_init(); | |
2220 | ||
2221 | int main() { | |
2222 | res_init() | |
2223 | ; return 0; } | |
2224 | EOF | |
2225 | if { (eval echo configure:2227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
2226 | rm -rf conftest* | |
2227 | eval "ac_cv_lib_$ac_lib_var=yes" | |
2228 | else | |
2229 | echo "configure: failed program was:" >&5 | |
2230 | cat conftest.$ac_ext >&5 | |
2231 | rm -rf conftest* | |
2232 | eval "ac_cv_lib_$ac_lib_var=no" | |
2233 | fi | |
2234 | rm -f conftest* | |
2235 | LIBS="$ac_save_LIBS" | |
2236 | ||
2237 | fi | |
2238 | if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then | |
2239 | echo "$ac_t""yes" 1>&6 | |
2240 | ac_tr_lib=HAVE_LIB`echo bind | sed -e 's/^a-zA-Z0-9_/_/g' \ | |
2241 | -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` | |
2242 | cat >> confdefs.h <<EOF | |
2243 | #define $ac_tr_lib 1 | |
2244 | EOF | |
2245 | ||
2246 | LIBS="-lbind $LIBS" | |
2247 | ||
2248 | else | |
2249 | echo "$ac_t""no" 1>&6 | |
2250 | echo $ac_n "checking for res_init in -lresolv""... $ac_c" 1>&6 | |
2251 | echo "configure:2253: checking for res_init in -lresolv" >&5 | |
2252 | ac_lib_var=`echo resolv'_'res_init | sed 'y%./+-%__p_%'` | |
2253 | if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then | |
2254 | echo $ac_n "(cached) $ac_c" 1>&6 | |
2255 | else | |
2256 | ac_save_LIBS="$LIBS" | |
2257 | LIBS="-lresolv $LIBS" | |
2258 | cat > conftest.$ac_ext <<EOF | |
2259 | #line 2261 "configure" | |
2260 | #include "confdefs.h" | |
2261 | /* Override any gcc2 internal prototype to avoid an error. */ | |
2262 | /* We use char because int might match the return type of a gcc2 | |
2263 | builtin and then its argument prototype would still apply. */ | |
2264 | char res_init(); | |
2265 | ||
2266 | int main() { | |
2267 | res_init() | |
2268 | ; return 0; } | |
2269 | EOF | |
2270 | if { (eval echo configure:2272: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
2271 | rm -rf conftest* | |
2272 | eval "ac_cv_lib_$ac_lib_var=yes" | |
2273 | else | |
2274 | echo "configure: failed program was:" >&5 | |
2275 | cat conftest.$ac_ext >&5 | |
2276 | rm -rf conftest* | |
2277 | eval "ac_cv_lib_$ac_lib_var=no" | |
2278 | fi | |
2279 | rm -f conftest* | |
2280 | LIBS="$ac_save_LIBS" | |
2281 | ||
2282 | fi | |
2283 | if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then | |
2284 | echo "$ac_t""yes" 1>&6 | |
2285 | ac_tr_lib=HAVE_LIB`echo resolv | sed -e 's/^a-zA-Z0-9_/_/g' \ | |
2286 | -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` | |
2287 | cat >> confdefs.h <<EOF | |
2288 | #define $ac_tr_lib 1 | |
2289 | EOF | |
2290 | ||
2291 | LIBS="-lresolv $LIBS" | |
2292 | ||
2293 | else | |
2294 | echo "$ac_t""no" 1>&6 | |
2295 | { echo "configure: error: No resolver library found" 1>&2; exit 1; } | |
2296 | fi | |
2297 | ||
2298 | fi | |
2299 | ||
2300 | fi | |
2301 | ||
2302 | ||
2303 | for ac_func in seteuid | |
2304 | do | |
2305 | echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 | |
2306 | echo "configure:2308: checking for $ac_func" >&5 | |
2307 | if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then | |
2308 | echo $ac_n "(cached) $ac_c" 1>&6 | |
2309 | else | |
2310 | cat > conftest.$ac_ext <<EOF | |
2311 | #line 2313 "configure" | |
2312 | #include "confdefs.h" | |
2313 | /* System header to define __stub macros and hopefully few prototypes, | |
2314 | which can conflict with char $ac_func(); below. */ | |
2315 | #include <assert.h> | |
2316 | /* Override any gcc2 internal prototype to avoid an error. */ | |
2317 | /* We use char because int might match the return type of a gcc2 | |
2318 | builtin and then its argument prototype would still apply. */ | |
2319 | char $ac_func(); | |
2320 | ||
2321 | int main() { | |
2322 | ||
2323 | /* The GNU C library defines this for functions which it implements | |
2324 | to always fail with ENOSYS. Some functions are actually named | |
2325 | something starting with __ and the normal name is an alias. */ | |
2326 | #if defined (__stub_$ac_func) || defined (__stub___$ac_func) | |
2327 | choke me | |
2328 | #else | |
2329 | $ac_func(); | |
2330 | #endif | |
2331 | ||
2332 | ; return 0; } | |
2333 | EOF | |
2334 | if { (eval echo configure:2336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
2335 | rm -rf conftest* | |
2336 | eval "ac_cv_func_$ac_func=yes" | |
2337 | else | |
2338 | echo "configure: failed program was:" >&5 | |
2339 | cat conftest.$ac_ext >&5 | |
2340 | rm -rf conftest* | |
2341 | eval "ac_cv_func_$ac_func=no" | |
2342 | fi | |
2343 | rm -f conftest* | |
2344 | fi | |
2345 | ||
2346 | if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then | |
2347 | echo "$ac_t""yes" 1>&6 | |
2348 | ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` | |
2349 | cat >> confdefs.h <<EOF | |
2350 | #define $ac_tr_func 1 | |
2351 | EOF | |
2352 | ||
2353 | else | |
2354 | echo "$ac_t""no" 1>&6 | |
2355 | fi | |
2356 | done | |
2357 | ||
2358 | # AC_CHECK_FUNC(setuid, , AC_MSG_ERROR (I Need either seteuid or setuid)) | |
2359 | ||
1881 | 2360 | echo $ac_n "checking for res_mkquery""... $ac_c" 1>&6 |
1882 | echo "configure:1884: checking for res_mkquery" >&5 | |
2361 | echo "configure:2363: checking for res_mkquery" >&5 | |
1883 | 2362 | if eval "test \"`echo '$''{'ac_cv_func_res_mkquery'+set}'`\" = set"; then |
1884 | 2363 | echo $ac_n "(cached) $ac_c" 1>&6 |
1885 | 2364 | else |
1886 | 2365 | cat > conftest.$ac_ext <<EOF |
1887 | #line 1889 "configure" | |
2366 | #line 2368 "configure" | |
1888 | 2367 | #include "confdefs.h" |
1889 | 2368 | /* System header to define __stub macros and hopefully few prototypes, |
1890 | 2369 | which can conflict with char res_mkquery(); below. */ |
1907 | 2386 | |
1908 | 2387 | ; return 0; } |
1909 | 2388 | EOF |
1910 | if { (eval echo configure:1912: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then | |
2389 | if { (eval echo configure:2391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
1911 | 2390 | rm -rf conftest* |
1912 | 2391 | eval "ac_cv_func_res_mkquery=yes" |
1913 | 2392 | else |
1924 | 2403 | : |
1925 | 2404 | else |
1926 | 2405 | echo "$ac_t""no" 1>&6 |
1927 | echo $ac_n "checking for res_mkquery in -lresolv""... $ac_c" 1>&6 | |
1928 | echo "configure:1930: checking for res_mkquery in -lresolv" >&5 | |
1929 | ac_lib_var=`echo resolv'_'res_mkquery | sed 'y%./+-%__p_%'` | |
2406 | echo $ac_n "checking for res_init in -lbind""... $ac_c" 1>&6 | |
2407 | echo "configure:2409: checking for res_init in -lbind" >&5 | |
2408 | ac_lib_var=`echo bind'_'res_init | sed 'y%./+-%__p_%'` | |
2409 | if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then | |
2410 | echo $ac_n "(cached) $ac_c" 1>&6 | |
2411 | else | |
2412 | ac_save_LIBS="$LIBS" | |
2413 | LIBS="-lbind $LIBS" | |
2414 | cat > conftest.$ac_ext <<EOF | |
2415 | #line 2417 "configure" | |
2416 | #include "confdefs.h" | |
2417 | /* Override any gcc2 internal prototype to avoid an error. */ | |
2418 | /* We use char because int might match the return type of a gcc2 | |
2419 | builtin and then its argument prototype would still apply. */ | |
2420 | char res_init(); | |
2421 | ||
2422 | int main() { | |
2423 | res_init() | |
2424 | ; return 0; } | |
2425 | EOF | |
2426 | if { (eval echo configure:2428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
2427 | rm -rf conftest* | |
2428 | eval "ac_cv_lib_$ac_lib_var=yes" | |
2429 | else | |
2430 | echo "configure: failed program was:" >&5 | |
2431 | cat conftest.$ac_ext >&5 | |
2432 | rm -rf conftest* | |
2433 | eval "ac_cv_lib_$ac_lib_var=no" | |
2434 | fi | |
2435 | rm -f conftest* | |
2436 | LIBS="$ac_save_LIBS" | |
2437 | ||
2438 | fi | |
2439 | if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then | |
2440 | echo "$ac_t""yes" 1>&6 | |
2441 | ac_tr_lib=HAVE_LIB`echo bind | sed -e 's/^a-zA-Z0-9_/_/g' \ | |
2442 | -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` | |
2443 | cat >> confdefs.h <<EOF | |
2444 | #define $ac_tr_lib 1 | |
2445 | EOF | |
2446 | ||
2447 | LIBS="-lbind $LIBS" | |
2448 | ||
2449 | else | |
2450 | echo "$ac_t""no" 1>&6 | |
2451 | echo $ac_n "checking for res_init in -lresolv""... $ac_c" 1>&6 | |
2452 | echo "configure:2454: checking for res_init in -lresolv" >&5 | |
2453 | ac_lib_var=`echo resolv'_'res_init | sed 'y%./+-%__p_%'` | |
1930 | 2454 | if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then |
1931 | 2455 | echo $ac_n "(cached) $ac_c" 1>&6 |
1932 | 2456 | else |
1933 | 2457 | ac_save_LIBS="$LIBS" |
1934 | 2458 | LIBS="-lresolv $LIBS" |
1935 | 2459 | cat > conftest.$ac_ext <<EOF |
1936 | #line 1938 "configure" | |
2460 | #line 2462 "configure" | |
1937 | 2461 | #include "confdefs.h" |
1938 | 2462 | /* Override any gcc2 internal prototype to avoid an error. */ |
1939 | 2463 | /* We use char because int might match the return type of a gcc2 |
1940 | 2464 | builtin and then its argument prototype would still apply. */ |
1941 | char res_mkquery(); | |
2465 | char res_init(); | |
1942 | 2466 | |
1943 | 2467 | int main() { |
1944 | res_mkquery() | |
2468 | res_init() | |
1945 | 2469 | ; return 0; } |
1946 | 2470 | EOF |
1947 | if { (eval echo configure:1949: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then | |
2471 | if { (eval echo configure:2473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
1948 | 2472 | rm -rf conftest* |
1949 | 2473 | eval "ac_cv_lib_$ac_lib_var=yes" |
1950 | 2474 | else |
1974 | 2498 | |
1975 | 2499 | fi |
1976 | 2500 | |
2501 | fi | |
2502 | ||
1977 | 2503 | |
1978 | 2504 | echo $ac_n "checking for herror""... $ac_c" 1>&6 |
1979 | echo "configure:1981: checking for herror" >&5 | |
2505 | echo "configure:2507: checking for herror" >&5 | |
1980 | 2506 | if eval "test \"`echo '$''{'ac_cv_func_herror'+set}'`\" = set"; then |
1981 | 2507 | echo $ac_n "(cached) $ac_c" 1>&6 |
1982 | 2508 | else |
1983 | 2509 | cat > conftest.$ac_ext <<EOF |
1984 | #line 1986 "configure" | |
2510 | #line 2512 "configure" | |
1985 | 2511 | #include "confdefs.h" |
1986 | 2512 | /* System header to define __stub macros and hopefully few prototypes, |
1987 | 2513 | which can conflict with char herror(); below. */ |
2004 | 2530 | |
2005 | 2531 | ; return 0; } |
2006 | 2532 | EOF |
2007 | if { (eval echo configure:2009: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then | |
2533 | if { (eval echo configure:2535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
2008 | 2534 | rm -rf conftest* |
2009 | 2535 | eval "ac_cv_func_herror=yes" |
2010 | 2536 | else |
2028 | 2554 | fi |
2029 | 2555 | |
2030 | 2556 | echo $ac_n "checking for strerror""... $ac_c" 1>&6 |
2031 | echo "configure:2033: checking for strerror" >&5 | |
2557 | echo "configure:2559: checking for strerror" >&5 | |
2032 | 2558 | if eval "test \"`echo '$''{'ac_cv_func_strerror'+set}'`\" = set"; then |
2033 | 2559 | echo $ac_n "(cached) $ac_c" 1>&6 |
2034 | 2560 | else |
2035 | 2561 | cat > conftest.$ac_ext <<EOF |
2036 | #line 2038 "configure" | |
2562 | #line 2564 "configure" | |
2037 | 2563 | #include "confdefs.h" |
2038 | 2564 | /* System header to define __stub macros and hopefully few prototypes, |
2039 | 2565 | which can conflict with char strerror(); below. */ |
2056 | 2582 | |
2057 | 2583 | ; return 0; } |
2058 | 2584 | EOF |
2059 | if { (eval echo configure:2061: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then | |
2585 | if { (eval echo configure:2587: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
2060 | 2586 | rm -rf conftest* |
2061 | 2587 | eval "ac_cv_func_strerror=yes" |
2062 | 2588 | else |
2106 | 2632 | # Ultrix sh set writes to stderr and can't be redirected directly, |
2107 | 2633 | # and sets the high bit in the cache file unless we assign to the vars. |
2108 | 2634 | (set) 2>&1 | |
2109 | case `(ac_space=' '; set) 2>&1` in | |
2635 | case `(ac_space=' '; set | grep ac_space) 2>&1` in | |
2110 | 2636 | *ac_space=\ *) |
2111 | 2637 | # `set' does not quote correctly, so add quotes (double-quote substitution |
2112 | 2638 | # turns \\\\ into \\, and sed turns \\ into \). |
2173 | 2699 | echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" |
2174 | 2700 | exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; |
2175 | 2701 | -version | --version | --versio | --versi | --vers | --ver | --ve | --v) |
2176 | echo "$CONFIG_STATUS generated by autoconf version 2.12" | |
2702 | echo "$CONFIG_STATUS generated by autoconf version 2.13" | |
2177 | 2703 | exit 0 ;; |
2178 | 2704 | -help | --help | --hel | --he | --h) |
2179 | 2705 | echo "\$ac_cs_usage"; exit 0 ;; |
2193 | 2719 | s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF |
2194 | 2720 | $ac_vpsub |
2195 | 2721 | $extrasub |
2722 | s%@SHELL@%$SHELL%g | |
2196 | 2723 | s%@CFLAGS@%$CFLAGS%g |
2197 | 2724 | s%@CPPFLAGS@%$CPPFLAGS%g |
2198 | 2725 | s%@CXXFLAGS@%$CXXFLAGS%g |
2726 | s%@FFLAGS@%$FFLAGS%g | |
2199 | 2727 | s%@DEFS@%$DEFS%g |
2200 | 2728 | s%@LDFLAGS@%$LDFLAGS%g |
2201 | 2729 | s%@LIBS@%$LIBS%g |
2215 | 2743 | s%@infodir@%$infodir%g |
2216 | 2744 | s%@mandir@%$mandir%g |
2217 | 2745 | s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g |
2746 | s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g | |
2218 | 2747 | s%@INSTALL_DATA@%$INSTALL_DATA%g |
2219 | s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g | |
2220 | 2748 | s%@PACKAGE@%$PACKAGE%g |
2221 | 2749 | s%@VERSION@%$VERSION%g |
2222 | 2750 | s%@ACLOCAL@%$ACLOCAL%g |
0 | 0 | AC_INIT(mtr.c) |
1 | AM_INIT_AUTOMAKE(mtr, 0.28) | |
1 | AM_INIT_AUTOMAKE(mtr, 0.41) | |
2 | 2 | |
3 | 3 | AC_SUBST(GTK_OBJ) |
4 | 4 | AC_SUBST(CURSES_OBJ) |
13 | 13 | AC_CHECK_SIZEOF(unsigned int, 4) |
14 | 14 | AC_CHECK_SIZEOF(unsigned long, 4) |
15 | 15 | |
16 | # Some doc I found somewhere. :-) -- REW | |
17 | # - Macro: AC_CHECK_FUNC (FUNCTION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) | |
18 | # - Macro: AC_CHECK_LIB (LIBRARY, FUNCTION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]]) | |
19 | ||
20 | # We don't refer to any symbols in termcap, but -lcurses on SunOS does. | |
21 | # We have to trust the linker not to mess things up... (It should not | |
22 | # pull in anything if we don't refer to anything in the lib). | |
23 | AC_CHECK_LIB(termcap, tgetent) | |
24 | ||
16 | 25 | AC_CHECK_FUNC(initscr, , |
17 | 26 | AC_CHECK_LIB(ncurses, initscr, , |
18 | 27 | AC_CHECK_LIB(curses, initscr, , |
28 | AC_CHECK_LIB(cursesX, initscr, , | |
19 | 29 | AC_MSG_WARN(Building without curses display support) |
20 | 30 | AC_DEFINE(NO_CURSES) |
21 | CURSES_OBJ=))) | |
22 | AC_CHECK_HEADERS(ncurses.h ncurses/curses.h curses.h) | |
31 | CURSES_OBJ=)))) | |
32 | ||
33 | AC_CHECK_FUNCS(attron) | |
34 | ||
35 | ||
36 | AC_CHECK_HEADERS(ncurses.h ncurses/curses.h curses.h cursesX.h sys/types.h) | |
23 | 37 | AC_CHECK_HEADERS(sys/xti.h) |
24 | 38 | |
25 | 39 | AC_CHECK_LIB(m, floor, , AC_MSG_ERROR(No math library found)) |
36 | 50 | AC_CHECK_FUNC(gethostbyname, , |
37 | 51 | AC_CHECK_LIB(nsl, gethostbyname, , AC_MSG_ERROR(No nameservice library found))) |
38 | 52 | |
53 | AC_CHECK_FUNC(res_init, , | |
54 | AC_CHECK_LIB(bind, res_init, , | |
55 | AC_CHECK_LIB(resolv, res_init, , AC_MSG_ERROR(No resolver library found)))) | |
56 | ||
57 | AC_CHECK_FUNCS(seteuid) | |
58 | # AC_CHECK_FUNC(setuid, , AC_MSG_ERROR (I Need either seteuid or setuid)) | |
59 | ||
39 | 60 | AC_CHECK_FUNC(res_mkquery, , |
40 | AC_CHECK_LIB(resolv, res_mkquery, , AC_MSG_ERROR(No resolver library found))) | |
61 | AC_CHECK_LIB(bind, res_init, , | |
62 | AC_CHECK_LIB(resolv, res_init, , AC_MSG_ERROR(No resolver library found)))) | |
41 | 63 | |
42 | 64 | AC_CHECK_FUNC(herror, , AC_DEFINE(NO_HERROR)) |
43 | 65 | AC_CHECK_FUNC(strerror, , AC_DEFINE(NO_STRERROR)) |
28 | 28 | # include <ncurses/curses.h> |
29 | 29 | #elif defined(HAVE_CURSES_H) |
30 | 30 | # include <curses.h> |
31 | #elif defined(HAVE_CURSESX_H) | |
32 | # include <cursesX.h> | |
31 | 33 | #else |
32 | 34 | # error No curses header file available |
35 | #endif | |
36 | ||
37 | #if defined(HAVE_SYS_TYPES_H) | |
38 | #include <sys/types.h> | |
39 | #else | |
40 | /* If a system doesn't have sys/types.h, lets hope that time_t is an int */ | |
41 | #define time_t int | |
42 | #endif | |
43 | ||
44 | #ifndef HAVE_ATTRON | |
45 | #define attron(x) | |
46 | #define attroff(x) | |
33 | 47 | #endif |
34 | 48 | |
35 | 49 | #ifndef getmaxyx |
41 | 55 | #include "net.h" |
42 | 56 | #include "dns.h" |
43 | 57 | #endif |
58 | ||
59 | #include <time.h> | |
60 | extern char LocalHostname[]; | |
44 | 61 | |
45 | 62 | void pwcenter(char *str) { |
46 | 63 | int maxx, maxy; |
60 | 77 | return ActionQuit; |
61 | 78 | if(c==3) |
62 | 79 | return ActionQuit; |
80 | if (c==12) | |
81 | return ActionClear; | |
82 | if ((c==19) || (tolower (c) == 'p')) | |
83 | return ActionPause; | |
84 | if ((c==17) || (c == ' ')) | |
85 | return ActionResume; | |
63 | 86 | if(tolower(c) == 'r') |
64 | 87 | return ActionReset; |
88 | if (tolower(c) == 'd') | |
89 | return ActionDisplay; | |
65 | 90 | |
66 | 91 | return 0; |
67 | 92 | } |
91 | 116 | getyx(stdscr, y, x); |
92 | 117 | move(y, startstat); |
93 | 118 | |
94 | printw(" %3d%% %3d %3d %4d %4d %6d", | |
119 | /* net_xxx returns times in usecs. Just display millisecs */ | |
120 | printw(" %3d%% %4d %4d %4d %4d %4d %6d", | |
95 | 121 | net_percent(at), |
96 | net_returned(at), net_xmit(at), | |
97 | net_best(at), net_avg(at), net_worst(at)); | |
122 | net_returned(at), net_xmit(at), | |
123 | net_last(at)/1000, net_best(at)/1000, | |
124 | net_avg(at)/1000, net_worst(at)/1000); | |
98 | 125 | |
99 | 126 | |
100 | 127 | } else { |
103 | 130 | |
104 | 131 | printw("\n"); |
105 | 132 | } |
133 | } | |
134 | ||
135 | static double factors[] = { 0.02, 0.05, 0.08, 0.15, 0.33, 0.50, 0.80, 1.00 }; | |
136 | static int scale[8]; | |
137 | static int low_ms, high_ms; | |
138 | ||
139 | void mtr_gen_scale(void) { | |
140 | int *saved, i, max, at; | |
141 | int range; | |
142 | ||
143 | low_ms = 1000000; | |
144 | high_ms = -1; | |
145 | ||
146 | for (i = 0; i < 8; i++) { | |
147 | scale[i] = 0; | |
148 | } | |
149 | max = net_max(); | |
150 | for (at = 0; at < max; at++) { | |
151 | saved = net_saved_pings(at); | |
152 | for (i = 0; i < SAVED_PINGS; i++) { | |
153 | if (saved[i] < 0) continue; | |
154 | if (saved[i] < low_ms) { | |
155 | low_ms = saved[i]; | |
156 | } | |
157 | if (saved[i] > high_ms) { | |
158 | high_ms = saved[i]; | |
159 | } | |
160 | } | |
161 | } | |
162 | range = high_ms - low_ms; | |
163 | for (i = 0; i < 8; i++) { | |
164 | scale[i] = low_ms + ((double)range * factors[i]); | |
165 | } | |
166 | } | |
167 | ||
168 | static const char* block_map = ".123abc>"; | |
169 | ||
170 | void mtr_print_scaled(int ms) { | |
171 | int i; | |
172 | ||
173 | for (i = 0; i < 8; i++) { | |
174 | if (ms <= scale[i]) { | |
175 | printw("%c", block_map[i]); | |
176 | return; | |
177 | } | |
178 | } | |
179 | printw(">"); | |
180 | } | |
181 | ||
182 | void mtr_fill_graph(int at) { | |
183 | int* saved; | |
184 | int i; | |
185 | int val; | |
186 | ||
187 | saved = net_saved_pings(at); | |
188 | for (i = 0; i < SAVED_PINGS; i++) { | |
189 | if (saved[i] == -2) { | |
190 | printw(" "); | |
191 | } else if (saved[i] == -1) { | |
192 | attron(A_BOLD); | |
193 | printw("?"); | |
194 | attroff(A_BOLD); | |
195 | } else { | |
196 | if (display_mode == 1) { | |
197 | if (saved[i] > scale[6]) { | |
198 | printw("%c", block_map[7]); | |
199 | } else { | |
200 | printw("."); | |
201 | } | |
202 | } else { | |
203 | mtr_print_scaled(saved[i]); | |
204 | } | |
205 | } | |
206 | } | |
207 | } | |
208 | ||
209 | void mtr_curses_graph(int startstat) { | |
210 | int max, at, addr, y, x; | |
211 | char* name; | |
212 | char blocks[50]; | |
213 | ||
214 | max = net_max(); | |
215 | for (at = 0; at < max; at++) { | |
216 | printw("%2d. ", at+1); | |
217 | ||
218 | addr = net_addr(at); | |
219 | if (!addr) { | |
220 | printw("???\n"); | |
221 | continue; | |
222 | } | |
223 | ||
224 | name = dns_lookup(addr); | |
225 | if (name) { | |
226 | printw("%s", name); | |
227 | } else { | |
228 | printw("%d.%d.%d.%d", (addr >> 24) & 0xff, (addr >> 16) && 0xff, (addr >> 8) & 0xff, addr & 0xff); | |
229 | } | |
230 | ||
231 | getyx(stdscr, y, x); | |
232 | move(y, startstat); | |
233 | ||
234 | printw(" "); | |
235 | mtr_fill_graph(at); | |
236 | printw("\n"); | |
237 | } | |
106 | 238 | } |
107 | 239 | |
108 | 240 | void mtr_curses_redraw() { |
109 | 241 | int maxx, maxy; |
110 | 242 | int startstat; |
111 | 243 | int rowstat; |
244 | int i; | |
245 | time_t t; | |
112 | 246 | |
113 | 247 | erase(); |
114 | 248 | getmaxyx(stdscr, maxy, maxx); |
115 | 249 | |
116 | /* Modified by Brian Casey December 1997 bcasey@imagiware.com */ | |
117 | startstat = maxx - 40; | |
118 | ||
119 | 250 | rowstat = 5; |
120 | 251 | |
252 | move(0, 0); | |
121 | 253 | attron(A_BOLD); |
122 | move(0, 0); | |
123 | 254 | pwcenter("Matt's traceroute [v" VERSION "]"); |
124 | printw("\n\n"); | |
125 | 255 | attroff(A_BOLD); |
126 | 256 | |
257 | mvprintw(1,0, LocalHostname); | |
258 | time(&t); | |
259 | mvprintw(1, maxx-25, ctime(&t)); | |
260 | ||
127 | 261 | printw("Keys: "); |
262 | attron(A_BOLD); printw("D"); attroff(A_BOLD); | |
263 | printw(" - Display mode "); | |
128 | 264 | attron(A_BOLD); printw("R"); attroff(A_BOLD); |
129 | 265 | printw(" - Restart statistics "); |
130 | 266 | attron(A_BOLD); printw("Q"); attroff(A_BOLD); |
133 | 269 | attron(A_BOLD); |
134 | 270 | mvprintw(rowstat - 1, 0, "Hostname"); |
135 | 271 | |
136 | /* Modified by Brian Casey December 1997 bcasey@imagiware.com */ | |
137 | mvprintw(rowstat - 2, startstat, " Packets Pings"); | |
138 | mvprintw(rowstat - 1, startstat, " %%Loss Rcv Snt Best Avg Worst"); | |
139 | ||
140 | attroff(A_BOLD); | |
141 | move(rowstat, 0); | |
142 | ||
143 | mtr_curses_hosts(startstat); | |
272 | if (display_mode == 0) { | |
273 | startstat = maxx - 41; | |
274 | ||
275 | /* Modified by Brian Casey December 1997 bcasey@imagiware.com */ | |
276 | mvprintw(rowstat - 2, startstat, " Packets Pings"); | |
277 | mvprintw(rowstat - 1, startstat, " %%Loss Rcv Snt Last Best Avg Worst"); | |
278 | ||
279 | attroff(A_BOLD); | |
280 | move(rowstat, 0); | |
281 | ||
282 | mtr_curses_hosts(startstat); | |
283 | } else { | |
284 | /* David Sward, Jan 1999 */ | |
285 | startstat = maxx - 52; | |
286 | ||
287 | mvprintw(rowstat - 1, startstat, " Last 50 pings"); | |
288 | ||
289 | attroff(A_BOLD); | |
290 | move(rowstat, 0); | |
291 | ||
292 | mtr_gen_scale(); | |
293 | mtr_curses_graph(startstat); | |
294 | ||
295 | printw("\n"); | |
296 | attron(A_BOLD); | |
297 | printw("Scale:"); | |
298 | attroff(A_BOLD); | |
299 | ||
300 | for (i = 0; i < 7; i++) { | |
301 | printw(" %c:%d ms", block_map[i], scale[i]/1000); | |
302 | } | |
303 | } | |
144 | 304 | |
145 | 305 | refresh(); |
146 | 306 | } |
157 | 317 | printw("\n"); |
158 | 318 | endwin(); |
159 | 319 | } |
320 | ||
321 | void mtr_curses_clear() { | |
322 | mtr_curses_close(); | |
323 | mtr_curses_open(); | |
324 | } |
30 | 30 | #define mtr_curses_close() |
31 | 31 | #define mtr_curses_redraw() |
32 | 32 | #define mtr_curses_keyaction() |
33 | #define mtr_curses_clear() | |
33 | 34 | #endif |
34 | 35 | |
35 | 36 | #ifdef NO_GTK |
38 | 39 | #define gtk_redraw() |
39 | 40 | #define gtk_keyaction() |
40 | 41 | #define gtk_loop() |
42 | #endif | |
43 | ||
44 | #ifdef NO_SPLIT | |
45 | #define split_open() | |
46 | #define split_close() | |
47 | #define split_redraw() | |
48 | #define split_keyaction() 0 | |
41 | 49 | #endif |
42 | 50 | |
43 | 51 | void display_detect(int *argc, char ***argv) { |
169 | 177 | } |
170 | 178 | } |
171 | 179 | |
180 | ||
181 | void display_clear() { | |
182 | switch(DisplayMode) { | |
183 | case DisplayCurses: | |
184 | mtr_curses_clear(); | |
185 | break; | |
186 | case DisplayReport: | |
187 | case DisplaySplit: /* BL */ | |
188 | case DisplayRaw: | |
189 | break; | |
190 | ||
191 | case DisplayGTK: | |
192 | break; | |
193 | } | |
194 | } |
16 | 16 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
17 | 17 | */ |
18 | 18 | |
19 | enum { ActionNone, ActionQuit, ActionReset }; | |
19 | enum { ActionNone, ActionQuit, ActionReset, ActionDisplay, ActionClear, | |
20 | ActionPause, ActionResume }; | |
20 | 21 | enum { DisplayReport, DisplayCurses, DisplayGTK, DisplaySplit, DisplayRaw }; |
21 | 22 | |
22 | 23 | /* Prototypes for display.c */ |
28 | 29 | void display_rawhost(int hostnum, int ip_addr); |
29 | 30 | int display_keyaction(); |
30 | 31 | void display_loop(); |
32 | void display_clear(); | |
33 | ||
34 | int display_mode; |
91 | 91 | struct resolve *previousip; |
92 | 92 | struct resolve *nexthost; |
93 | 93 | struct resolve *previoushost; |
94 | float expiretime; /* Fucking HPUX has a problem with "double" here. */ | |
94 | 95 | char *hostname; |
95 | double expiretime; | |
96 | 96 | ip_t ip; |
97 | 97 | word id; |
98 | 98 | byte state; |
207 | 207 | #define getheader_pr(x) ((x->databyte_b >> 6) & 1) |
208 | 208 | #define getheader_ra(x) (x->databyte_b >> 7) |
209 | 209 | |
210 | #if 0 | |
211 | ||
212 | /* The execution order inside an expression is undefined! That means that | |
213 | this might work, but then again, it might not... Sun Lint pointed this | |
214 | one out...*/ | |
215 | ||
210 | 216 | #define sucknetword(x) (((word)*(x) << 8) | (((x)+= 2)[-1])) |
211 | 217 | #define sucknetshort(x) (((short)*(x) << 8) | (((x)+= 2)[-1])) |
212 | 218 | #define sucknetdword(x) (((dword)*(x) << 24) | ((x)[1] << 16) | ((x)[2] << 8) | (((x)+= 4)[-1])) |
213 | 219 | #define sucknetlong(x) (((long)*(x) << 24) | ((x)[1] << 16) | ((x)[2] << 8) | (((x)+= 4)[-1])) |
220 | #else | |
221 | ||
222 | #define sucknetword(x) ((x)+=2,((word) (((x)[-2] << 8) | ((x)[-1] << 0)))) | |
223 | #define sucknetshort(x) ((x)+=2,((short) (((x)[-2] << 8) | ((x)[-1] << 0)))) | |
224 | #define sucknetdword(x) ((x)+=4,((dword) (((x)[-4] << 24) | ((x)[-3] << 16) | \ | |
225 | ((x)[-2] << 8) | ((x)[-1] << 0)))) | |
226 | #define sucknetlong(x) ((x)+=4,((long) (((x)[-4] << 24) | ((x)[-3] << 16) | \ | |
227 | ((x)[-2] << 8) | ((x)[-1] << 0)))) | |
228 | #endif | |
214 | 229 | |
215 | 230 | enum { |
216 | 231 | STATE_FINISHED, |
735 | 750 | void dorequest(char *s,int type,word id){ |
736 | 751 | packetheader *hp; |
737 | 752 | int r,i; |
738 | byte buf[MaxPacketsize+1]; | |
753 | int buf[(MaxPacketsize/sizeof (int))+1]; | |
739 | 754 | r = res_mkquery(QUERY,s,C_IN,type,NULL,0,NULL,buf,MaxPacketsize); |
740 | 755 | if (r == -1){ |
741 | 756 | restell("Resolver error: Query too large."); |
31 | 31 | #include "img/mtr_icon.xpm" |
32 | 32 | #endif |
33 | 33 | |
34 | ||
35 | gint gtk_ping(gpointer data); | |
36 | ||
37 | ||
34 | 38 | extern char *Hostname; |
35 | 39 | extern float WaitTime; |
36 | extern float DeltaTime; | |
37 | ||
38 | 40 | static int tag; |
41 | static GtkWidget *Pause_Button; | |
42 | ||
43 | ||
44 | void gtk_add_ping_timeout (void) | |
45 | { | |
46 | int dt; | |
47 | ||
48 | dt = calc_deltatime (WaitTime); | |
49 | tag = gtk_timeout_add(dt / 1000, gtk_ping, NULL); | |
50 | } | |
51 | ||
39 | 52 | |
40 | 53 | void gtk_do_init(int *argc, char ***argv) { |
41 | 54 | static int done = 0; |
49 | 62 | |
50 | 63 | int gtk_detect(int *argc, char ***argv) { |
51 | 64 | if(getenv("DISPLAY") != NULL) { |
52 | gtk_do_init(argc, argv); | |
65 | /* If we do this here, gtk_init exits on an error. This happens | |
66 | BEFORE the user has had a chance to tell us not to use the | |
67 | display... */ | |
53 | 68 | return TRUE; |
54 | 69 | } else { |
55 | 70 | return FALSE; |
69 | 84 | return FALSE; |
70 | 85 | } |
71 | 86 | |
87 | ||
88 | gint Pause_clicked(GtkWidget *Button, gpointer data) { | |
89 | static int paused = 0; | |
90 | ||
91 | if (paused) { | |
92 | gtk_add_ping_timeout (); | |
93 | } else { | |
94 | gtk_timeout_remove (tag); | |
95 | } | |
96 | paused = ! paused; | |
97 | gtk_redraw(); | |
98 | ||
99 | return FALSE; | |
100 | } | |
101 | ||
102 | /* | |
103 | * There is a small problem with the following code: | |
104 | * The timeout is canceled and removed in order to ensure that | |
105 | * it takes effect (consider what happens if you set the timeout to 999, | |
106 | * then try to undo the change); is a better approach possible? -- CMR | |
107 | * | |
108 | * What's the problem with this? (-> "I don't think so) -- REW | |
109 | */ | |
110 | ||
111 | gint WaitTime_changed(GtkAdjustment *Adj, GtkWidget *Button) { | |
112 | WaitTime = gtk_spin_button_get_value_as_float(GTK_SPIN_BUTTON(Button)); | |
113 | gtk_timeout_remove (tag); | |
114 | gtk_add_ping_timeout (); | |
115 | gtk_redraw(); | |
116 | ||
117 | return FALSE; | |
118 | } | |
119 | ||
72 | 120 | gint Host_activate(GtkWidget *Entry, gpointer data) { |
73 | 121 | int addr; |
74 | 122 | |
75 | 123 | addr = dns_forward(gtk_entry_get_text(GTK_ENTRY(Entry))); |
76 | if(addr) | |
124 | if(addr) { | |
77 | 125 | net_reopen(addr); |
126 | /* If we are "Paused" at this point it is usually because someone | |
127 | entered a non-existing host. Therefore do the go-ahead... --REW */ | |
128 | gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON( Pause_Button ) , 0); | |
129 | } else { | |
130 | gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON( Pause_Button ) , 1); | |
131 | gtk_entry_append_text( GTK_ENTRY(Entry), ": not found" ); | |
132 | } | |
78 | 133 | |
79 | 134 | return FALSE; |
80 | 135 | } |
89 | 144 | GtkWidget *Button; |
90 | 145 | GtkWidget *Label; |
91 | 146 | GtkWidget *Entry; |
147 | GtkAdjustment *Adjustment; | |
92 | 148 | |
93 | 149 | Button = gtk_button_new_with_label("Quit"); |
94 | 150 | gtk_box_pack_end(GTK_BOX(Toolbar), Button, FALSE, FALSE, 0); |
102 | 158 | GTK_SIGNAL_FUNC(Restart_clicked), NULL); |
103 | 159 | gtk_widget_show(Button); |
104 | 160 | |
161 | Pause_Button = gtk_toggle_button_new_with_label("Pause"); | |
162 | gtk_box_pack_end(GTK_BOX(Toolbar), Pause_Button, FALSE, FALSE, 0); | |
163 | gtk_signal_connect(GTK_OBJECT(Pause_Button), "clicked", | |
164 | GTK_SIGNAL_FUNC(Pause_clicked), NULL); | |
165 | gtk_widget_show(Pause_Button); | |
166 | ||
167 | /* allow root only to set zero delay */ | |
168 | Adjustment = (GtkAdjustment *)gtk_adjustment_new(WaitTime, | |
169 | getuid()==0 ? 0.00:1.00, | |
170 | 999.99, | |
171 | 1.0, 10.0, | |
172 | 0.0); | |
173 | Button = gtk_spin_button_new(Adjustment, 0.5, 2); | |
174 | gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(Button), TRUE); | |
175 | /* gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(Button), FALSE); */ | |
176 | /* gtk_spin_button_set_set_update_policy(GTK_SPIN_BUTTON(Button), | |
177 | GTK_UPDATE_IF_VALID); */ | |
178 | gtk_box_pack_end(GTK_BOX(Toolbar), Button, FALSE, FALSE, 0); | |
179 | gtk_signal_connect(GTK_OBJECT(Adjustment), "value_changed", | |
180 | GTK_SIGNAL_FUNC(WaitTime_changed), Button); | |
181 | gtk_widget_show(Button); | |
182 | ||
105 | 183 | Label = gtk_label_new("Hostname"); |
106 | 184 | gtk_box_pack_start(GTK_BOX(Toolbar), Label, FALSE, FALSE, 0); |
107 | 185 | gtk_widget_show(Label); |
146 | 224 | |
147 | 225 | GtkWidget *Scrollarea_create() { |
148 | 226 | GtkWidget *List; |
227 | GtkWidget *scroll; | |
149 | 228 | int count; |
150 | 229 | |
151 | 230 | for(count = 0; Report_Positions[count]; count++); |
152 | 231 | |
153 | 232 | List = GTK_WIDGET(gtk_clist_new_with_titles(count, Report_Text)); |
154 | gtk_clist_set_policy(GTK_CLIST(List), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
233 | scroll = gtk_scrolled_window_new(NULL, NULL); | |
234 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
155 | 235 | for(count = 0; Report_Positions[count + 1]; count++) { |
156 | 236 | gtk_clist_set_column_width(GTK_CLIST(List), count, |
157 | 237 | Report_Positions[count + 1] - |
161 | 241 | for(count = 1; Report_Positions[count]; count++) { |
162 | 242 | gtk_clist_set_column_justification(GTK_CLIST(List), count, GTK_JUSTIFY_RIGHT); |
163 | 243 | } |
244 | gtk_container_add(GTK_CONTAINER(scroll), List); | |
245 | gtk_widget_show(List); | |
164 | 246 | |
165 | 247 | ReportBody = List; |
166 | return List; | |
248 | return scroll; | |
167 | 249 | } |
168 | 250 | |
169 | 251 | void gtk_add_row(GtkWidget *List) { |
217 | 299 | gtk_set_field_num(List, row, 2, "%d", net_returned(row)); |
218 | 300 | gtk_set_field_num(List, row, 3, "%d", net_xmit(row)); |
219 | 301 | |
220 | gtk_set_field_num(List, row, 4, "%d", net_best(row)); | |
221 | gtk_set_field_num(List, row, 5, "%d", net_avg(row)); | |
222 | gtk_set_field_num(List, row, 6, "%d", net_worst(row)); | |
302 | gtk_set_field_num(List, row, 4, "%d", net_best(row)/1000); | |
303 | gtk_set_field_num(List, row, 5, "%d", net_avg(row)/1000); | |
304 | gtk_set_field_num(List, row, 6, "%d", net_worst(row)/1000); | |
223 | 305 | |
224 | 306 | } |
225 | 307 | |
250 | 332 | GtkWidget *List; |
251 | 333 | |
252 | 334 | gtk_window_set_title(GTK_WINDOW(Window), "My traceroute [v" VERSION "]"); |
335 | gtk_window_set_wmclass(GTK_WINDOW(Window), "mtr", "Mtr"); | |
253 | 336 | gtk_widget_set_usize(Window, 540, 400); |
254 | 337 | gtk_container_border_width(GTK_CONTAINER(Window), 10); |
255 | 338 | VBox = gtk_vbox_new(FALSE, 10); |
307 | 390 | gtk_redraw(); |
308 | 391 | net_send_batch(); |
309 | 392 | gtk_timeout_remove (tag); |
310 | tag = gtk_timeout_add(DeltaTime*1000, gtk_ping, NULL); | |
393 | gtk_add_ping_timeout (); | |
311 | 394 | return TRUE; |
312 | 395 | } |
313 | 396 | |
323 | 406 | |
324 | 407 | |
325 | 408 | void gtk_loop() { |
326 | DeltaTime = WaitTime/10; | |
327 | tag = gtk_timeout_add(DeltaTime*1000, gtk_ping, NULL); | |
409 | gtk_add_ping_timeout (); | |
328 | 410 | gdk_input_add(net_waitfd(), GDK_INPUT_READ, gtk_net_data, NULL); |
329 | 411 | gdk_input_add(dns_waitfd(), GDK_INPUT_READ, gtk_dns_data, NULL); |
330 | 412 |
0 | # Makefile.in generated automatically by automake 1.2 from Makefile.am | |
0 | # Makefile.in generated automatically by automake 1.3 from Makefile.am | |
1 | 1 | |
2 | # Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. | |
2 | # Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. | |
3 | 3 | # This Makefile.in is free software; the Free Software Foundation |
4 | # gives unlimited permission to copy, distribute and modify it. | |
4 | # gives unlimited permission to copy and/or distribute it, | |
5 | # with or without modifications, as long as this notice is preserved. | |
6 | ||
7 | # This program is distributed in the hope that it will be useful, | |
8 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without | |
9 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A | |
10 | # PARTICULAR PURPOSE. | |
5 | 11 | |
6 | 12 | |
7 | 13 | SHELL = /bin/sh |
25 | 31 | includedir = @includedir@ |
26 | 32 | oldincludedir = /usr/include |
27 | 33 | |
34 | DISTDIR = | |
35 | ||
28 | 36 | pkgdatadir = $(datadir)/@PACKAGE@ |
29 | 37 | pkglibdir = $(libdir)/@PACKAGE@ |
30 | 38 | pkgincludedir = $(includedir)/@PACKAGE@ |
42 | 50 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ |
43 | 51 | transform = @program_transform_name@ |
44 | 52 | |
45 | NORMAL_INSTALL = true | |
46 | PRE_INSTALL = true | |
47 | POST_INSTALL = true | |
48 | NORMAL_UNINSTALL = true | |
49 | PRE_UNINSTALL = true | |
50 | POST_UNINSTALL = true | |
53 | NORMAL_INSTALL = : | |
54 | PRE_INSTALL = : | |
55 | POST_INSTALL = : | |
56 | NORMAL_UNINSTALL = : | |
57 | PRE_UNINSTALL = : | |
58 | POST_UNINSTALL = : | |
51 | 59 | CC = @CC@ |
52 | 60 | CURSES_OBJ = @CURSES_OBJ@ |
53 | 61 | GTK_CFLAGS = @GTK_CFLAGS@ |
69 | 77 | |
70 | 78 | TAR = tar |
71 | 79 | GZIP = --best |
72 | default: all | |
80 | all: Makefile | |
73 | 81 | |
74 | 82 | .SUFFIXES: |
75 | $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) | |
83 | $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) | |
76 | 84 | cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps img/Makefile |
77 | 85 | |
78 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status | |
86 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status | |
79 | 87 | cd $(top_builddir) \ |
80 | 88 | && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status |
81 | 89 | |
110 | 118 | |
111 | 119 | uninstall: |
112 | 120 | |
113 | all: Makefile | |
114 | ||
115 | 121 | install-strip: |
116 | 122 | $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install |
117 | 123 | installdirs: |
118 | 124 | |
119 | 125 | |
120 | 126 | mostlyclean-generic: |
121 | test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) | |
127 | -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) | |
122 | 128 | |
123 | 129 | clean-generic: |
124 | test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) | |
130 | -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) | |
125 | 131 | |
126 | 132 | distclean-generic: |
127 | rm -f Makefile $(DISTCLEANFILES) | |
128 | rm -f config.cache config.log stamp-h stamp-h[0-9]* | |
129 | test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) | |
133 | -rm -f Makefile $(DISTCLEANFILES) | |
134 | -rm -f config.cache config.log stamp-h stamp-h[0-9]* | |
135 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) | |
130 | 136 | |
131 | 137 | maintainer-clean-generic: |
132 | test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) | |
133 | test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) | |
138 | -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) | |
139 | -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) | |
134 | 140 | mostlyclean: mostlyclean-generic |
135 | 141 | |
136 | 142 | clean: clean-generic mostlyclean |
137 | 143 | |
138 | 144 | distclean: distclean-generic clean |
139 | rm -f config.status | |
145 | -rm -f config.status | |
140 | 146 | |
141 | 147 | maintainer-clean: maintainer-clean-generic distclean |
142 | 148 | @echo "This command is intended for maintainers to use;" |
143 | 149 | @echo "it deletes files that may require special tools to rebuild." |
144 | 150 | |
145 | .PHONY: default tags distdir info dvi installcheck install-exec \ | |
146 | install-data install uninstall all installdirs mostlyclean-generic \ | |
147 | distclean-generic clean-generic maintainer-clean-generic clean \ | |
148 | mostlyclean distclean maintainer-clean | |
151 | .PHONY: tags distdir info dvi installcheck install-exec install-data \ | |
152 | install uninstall all installdirs mostlyclean-generic distclean-generic \ | |
153 | clean-generic maintainer-clean-generic clean mostlyclean distclean \ | |
154 | maintainer-clean | |
149 | 155 | |
150 | 156 | |
151 | 157 | # Tell versions [3.59,3.63) of GNU make to not export all variables. |
21 | 21 | void mtr_curses_close(); |
22 | 22 | void mtr_curses_redraw(); |
23 | 23 | int mtr_curses_keyaction(); |
24 | void mtr_curses_clear(); |
0 | .TH MTR 8 "December 28, 1997" "mtr" "mtr" | |
0 | .TH MTR 8 "March 4, 1999" "mtr" "mtr" | |
1 | 1 | |
2 | 2 | |
3 | 3 | .SH NAME |
7 | 7 | .SH SYNOPSIS |
8 | 8 | .B mtr |
9 | 9 | [\c |
10 | .B \-hvrctgi\c | |
10 | .B \-hvrctglsni\c | |
11 | 11 | ] |
12 | 12 | [\c |
13 | 13 | .B \-\-help\c |
39 | 39 | [\c |
40 | 40 | .B \-\-interval\ SECONDS\c |
41 | 41 | ] |
42 | .B HOSTNAME | |
42 | [\c | |
43 | .B \-\-psize\ BYTES | -p BYTES\c | |
44 | ] | |
45 | .B HOSTNAME [PACKETSIZE] | |
43 | 46 | |
44 | 47 | |
45 | 48 | .SH DESCRIPTION |
46 | 49 | |
47 | 50 | .B mtr |
48 | combines the functionaly of the | |
51 | combines the functionality of the | |
49 | 52 | .B traceroute |
50 | 53 | and |
51 | 54 | .B ping |
116 | 119 | option. |
117 | 120 | |
118 | 121 | .TP |
122 | .B \-p\ BYTES | |
123 | .TP | |
124 | .B \-\-psize\ BYTES | |
125 | .TP | |
126 | .B PACKETSIZE | |
127 | These options or a trailing PACKETSIZE on the commandline sets | |
128 | the packet size used for probing. | |
129 | It is in bytes inclusive IP and ICMP headers | |
130 | .TP | |
119 | 131 | .B \-t |
120 | 132 | .TP |
121 | 133 | .B \-\-curses |
28 | 28 | #include "dns.h" |
29 | 29 | #include "report.h" |
30 | 30 | #include "net.h" |
31 | ||
32 | ||
33 | #ifndef HAVE_SETEUID | |
34 | /* HPUX doesn't have seteuid, but setuid works fine in that case for us */ | |
35 | #define seteuid setuid | |
36 | #endif | |
31 | 37 | |
32 | 38 | int DisplayMode; |
33 | 39 | int Interactive = 1; |
36 | 42 | int MaxPing = 16; |
37 | 43 | float WaitTime = 1.0; |
38 | 44 | char *Hostname = NULL; |
45 | char LocalHostname[128]; | |
39 | 46 | int dns = 1; |
47 | int packetsize = MINPACKET; | |
40 | 48 | |
41 | 49 | void parse_arg(int argc, char **argv) { |
42 | 50 | int opt; |
48 | 56 | { "curses", 0, 0, 't' }, |
49 | 57 | { "gtk", 0, 0, 'g' }, |
50 | 58 | { "interval", 1, 0, 'i' }, |
59 | { "psize", 1, 0, 'p' }, | |
51 | 60 | { "no-dns", 0, 0, 'n' }, |
52 | 61 | { "split", 0, 0, 's' }, /* BL */ |
53 | 62 | { "raw", 0, 0, 'l' }, |
56 | 65 | |
57 | 66 | opt = 0; |
58 | 67 | while(1) { |
59 | opt = getopt_long(argc, argv, "hvrc:tklnsi:", long_options, NULL); | |
68 | opt = getopt_long(argc, argv, "hvrc:tklnsi:p:", long_options, NULL); | |
60 | 69 | if(opt == -1) |
61 | 70 | break; |
62 | 71 | |
71 | 80 | DisplayMode = DisplayReport; |
72 | 81 | break; |
73 | 82 | case 'c': |
74 | MaxPing = atoi(optarg); | |
83 | MaxPing = atoi (optarg); | |
84 | break; | |
85 | case 'p': | |
86 | packetsize = atoi (optarg); | |
75 | 87 | break; |
76 | 88 | case 't': |
77 | 89 | DisplayMode = DisplayCurses; |
89 | 101 | dns = 0; |
90 | 102 | break; |
91 | 103 | case 'i': |
92 | WaitTime = atof(optarg); | |
104 | WaitTime = atof (optarg); | |
93 | 105 | if (WaitTime <= 0.0) { |
94 | 106 | fprintf (stderr, "mtr: wait time must be positive\n"); |
95 | 107 | exit (1); |
96 | 108 | } |
109 | if (getuid() != 0 && WaitTime < 1.0) | |
110 | WaitTime = 1.0; | |
97 | 111 | break; |
98 | 112 | } |
99 | 113 | } |
101 | 115 | if(DisplayMode == DisplayReport) |
102 | 116 | Interactive = 0; |
103 | 117 | |
104 | if(optind != argc - 1) | |
118 | if(optind > argc - 1) | |
105 | 119 | return; |
106 | 120 | |
107 | Hostname = argv[optind]; | |
121 | Hostname = argv[optind++]; | |
122 | ||
123 | if (argc > optind) | |
124 | packetsize = atoi(argv[optind]); | |
108 | 125 | |
109 | 126 | } |
127 | ||
128 | ||
129 | void parse_mtr_options (char *string) | |
130 | { | |
131 | int argc; | |
132 | char *argv[128], *p; | |
133 | int i; | |
134 | ||
135 | if (!string) return; | |
136 | ||
137 | argv[0] = "mtr"; | |
138 | argc = 1; | |
139 | p = strtok (string, " \t"); | |
140 | while (p) { | |
141 | argv[argc++] = p; | |
142 | p = strtok (NULL, " \t"); | |
143 | } | |
144 | parse_arg (argc, argv); | |
145 | optind = 0; | |
146 | } | |
147 | ||
148 | ||
110 | 149 | |
111 | 150 | int main(int argc, char **argv) { |
112 | 151 | int traddr; |
130 | 169 | } |
131 | 170 | |
132 | 171 | display_detect(&argc, &argv); |
172 | ||
173 | parse_mtr_options (getenv ("MTR_OPTIONS")); | |
174 | ||
133 | 175 | parse_arg(argc, argv); |
134 | 176 | |
135 | 177 | if(PrintVersion) { |
138 | 180 | } |
139 | 181 | |
140 | 182 | if(PrintHelp) { |
141 | printf("usage: %s [-hvrctlis] [--help] [--version] [--report]\n" | |
183 | printf("usage: %s [-hvrctglsni] [--help] [--version] [--report]\n" | |
142 | 184 | "\t\t[--report-cycles=COUNT] [--curses] [--gtk]\n" |
143 | "\t\t[--raw] [--split]\n" /* BL */ | |
144 | "\t\t[--interval=SECONDS] HOSTNAME\n", argv[0]); | |
185 | "\t\t[--raw] [--split] [--no-dns]\n" /* BL */ | |
186 | "\t\t[--psize=bytes/-p=bytes]\n" /* ok */ | |
187 | "\t\t[--interval=SECONDS] HOSTNAME [PACKETSIZE]\n", argv[0]); | |
145 | 188 | exit(0); |
146 | 189 | } |
147 | 190 | if (Hostname == NULL) Hostname = "localhost"; |
191 | ||
192 | if(gethostname(LocalHostname, sizeof(LocalHostname))) { | |
193 | strcpy(LocalHostname, "UNKNOWNHOST"); | |
194 | } | |
148 | 195 | |
149 | 196 | if(net_preopen_result != 0) { |
150 | 197 | printf("mtr: Unable to get raw socket. (Executable not suid?)\n"); |
172 | 219 | display_open(); |
173 | 220 | dns_open(); |
174 | 221 | |
222 | display_mode = 0; | |
175 | 223 | display_loop(); |
176 | 224 | |
177 | 225 | net_end_transit(); |
14 | 14 | You should have received a copy of the GNU General Public License |
15 | 15 | along with this program; if not, write to the Free Software |
16 | 16 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
17 | ||
18 | 1999-08-13 ok Olav@okvittem.priv.no added -psize | |
19 | ||
17 | 20 | */ |
18 | 21 | |
19 | 22 | #include <config.h> |
30 | 33 | #include <unistd.h> |
31 | 34 | #include <stdio.h> |
32 | 35 | #include <math.h> |
36 | #include <errno.h> | |
33 | 37 | |
34 | 38 | #include "net.h" |
35 | 39 | |
36 | 40 | |
37 | extern float WaitTime, DeltaTime; | |
38 | 41 | |
39 | 42 | #define MaxTransit 4 |
40 | 43 | |
42 | 45 | the fields have different names between, for instance, Linux and |
43 | 46 | Solaris */ |
44 | 47 | struct ICMPHeader { |
45 | unsigned char type; | |
46 | unsigned char code; | |
47 | unsigned short checksum; | |
48 | unsigned short id; | |
49 | unsigned short sequence; | |
48 | uint8 type; | |
49 | uint8 code; | |
50 | uint16 checksum; | |
51 | uint16 id; | |
52 | uint16 sequence; | |
50 | 53 | }; |
51 | 54 | |
52 | 55 | /* Structure of an IP header. */ |
65 | 68 | |
66 | 69 | #define ICMP_ECHO 8 |
67 | 70 | #define ICMP_ECHOREPLY 0 |
71 | ||
72 | #define ICMP_TSTAMP 13 | |
73 | #define ICMP_TSTAMPREPLY 14 | |
74 | ||
68 | 75 | #define ICMP_TIME_EXCEEDED 11 |
69 | ||
76 | ||
70 | 77 | #ifndef SOL_IP |
71 | 78 | #define SOL_IP 0 |
72 | 79 | #endif |
73 | ||
74 | struct packetdata { | |
75 | int index; | |
76 | int ttl; | |
77 | int sec; | |
78 | int msec; | |
79 | }; | |
80 | ||
81 | ||
80 | 82 | |
81 | 83 | struct nethost { |
82 | int addr; | |
84 | uint32 addr; | |
83 | 85 | int xmit; |
84 | 86 | int returned; |
85 | int total; | |
87 | long long total; | |
88 | int last; | |
86 | 89 | int best; |
87 | 90 | int worst; |
88 | 91 | int transit; |
92 | int saved[SAVED_PINGS]; | |
89 | 93 | }; |
90 | 94 | |
95 | struct sequence { | |
96 | int index; | |
97 | int transit; | |
98 | int saved_seq; | |
99 | struct timeval time; | |
100 | }; | |
101 | ||
102 | ||
103 | /* Configuration parameter: How many queries to unknown hosts do we | |
104 | send? (This limits the amount of traffic generated if a host is not | |
105 | reachable) */ | |
106 | #define MAX_UNKNOWN_HOSTS 5 | |
107 | ||
108 | ||
91 | 109 | static struct nethost host[MaxHost]; |
110 | static struct sequence sequence[MaxSequence]; | |
92 | 111 | static struct timeval reset = { 0, 0 }; |
93 | 112 | |
113 | int timestamp; | |
94 | 114 | int sendsock; |
95 | 115 | int recvsock; |
96 | 116 | struct sockaddr_in remoteaddress; |
97 | ||
117 | static int batch_at = 0; | |
118 | ||
119 | ||
120 | extern int packetsize; | |
121 | static int numhosts = 10; | |
122 | ||
123 | /* return the number of microseconds to wait before sending the next | |
124 | ping */ | |
125 | int calc_deltatime (float waittime) | |
126 | { | |
127 | waittime /= numhosts; | |
128 | return 1000000 * waittime; | |
129 | } | |
130 | ||
131 | ||
132 | /* This doesn't work for odd sz. I don't know enough about this to say | |
133 | that this is wrong. It doesn't seem to cripple mtr though. -- REW */ | |
98 | 134 | int checksum(void *data, int sz) { |
99 | 135 | unsigned short *ch; |
100 | 136 | unsigned int sum; |
111 | 147 | return (~sum & 0xffff); |
112 | 148 | } |
113 | 149 | |
114 | void net_send_ping(int index) { | |
115 | char packet[sizeof(struct IPHeader) + sizeof(struct ICMPHeader) | |
116 | + sizeof(struct packetdata)]; | |
150 | ||
151 | static int BSDfix = 0; | |
152 | ||
153 | int new_sequence(int index) { | |
154 | static int next_sequence = 0; | |
155 | int seq; | |
156 | ||
157 | seq = next_sequence++; | |
158 | if(next_sequence >= MaxSequence) | |
159 | next_sequence = 0; | |
160 | ||
161 | sequence[seq].index = index; | |
162 | sequence[seq].transit = 1; | |
163 | sequence[seq].saved_seq = ++host[index].xmit; | |
164 | memset(&sequence[seq].time, 0, sizeof(sequence[seq].time)); | |
165 | ||
166 | host[index].transit = 1; | |
167 | net_save_xmit(index); | |
168 | ||
169 | return seq; | |
170 | } | |
171 | ||
172 | /* Attempt to find the host at a particular number of hops away */ | |
173 | void net_send_query(int index) { | |
174 | /*ok char packet[sizeof(struct IPHeader) + sizeof(struct ICMPHeader)];*/ | |
175 | char packet[MAXPACKET]; | |
117 | 176 | struct IPHeader *ip; |
118 | 177 | struct ICMPHeader *icmp; |
119 | struct packetdata *data; | |
120 | int packetsize = sizeof(struct IPHeader) + sizeof(struct ICMPHeader) + sizeof(struct packetdata); | |
121 | struct sockaddr_in addr; | |
122 | struct timeval now; | |
123 | ||
124 | memset(&addr, 0, sizeof(struct sockaddr_in)); | |
125 | addr.sin_family = AF_INET; | |
126 | addr.sin_addr.s_addr = host[index].addr; | |
127 | host[index].xmit++; | |
128 | host[index].transit = 1; | |
129 | ||
178 | ||
179 | /*ok int packetsize = sizeof(struct IPHeader) + sizeof(struct ICMPHeader) + datasize;*/ | |
180 | int rv; | |
181 | static int first=1; | |
182 | ||
183 | if ( packetsize < MINPACKET ) packetsize = MINPACKET; | |
184 | if ( packetsize > MAXPACKET ) packetsize = MAXPACKET; | |
130 | 185 | memset(packet, 0, packetsize); |
131 | 186 | |
132 | 187 | ip = (struct IPHeader *)packet; |
133 | 188 | icmp = (struct ICMPHeader *)(packet + sizeof(struct IPHeader)); |
134 | data = (struct packetdata *)(packet + sizeof(struct IPHeader) + sizeof(struct ICMPHeader)); | |
135 | 189 | |
136 | 190 | ip->version = 0x45; |
137 | 191 | ip->tos = 0; |
138 | ip->len = htons (packetsize); | |
192 | ip->len = BSDfix ? packetsize: htons (packetsize); | |
139 | 193 | ip->id = 0; |
140 | 194 | ip->frag = 0; |
141 | ip->ttl = 127; | |
142 | ip->protocol = IPPROTO_ICMP; | |
143 | ip->saddr = 0; | |
144 | ip->daddr = host[index].addr; | |
145 | ||
146 | icmp->type = ICMP_ECHO; | |
147 | icmp->id = getpid(); | |
148 | icmp->sequence = 0; | |
149 | ||
150 | data->ttl = 0; | |
151 | data->index = index; | |
152 | ||
153 | gettimeofday(&now, NULL); | |
154 | data->sec = now.tv_sec; | |
155 | data->msec = now.tv_usec / 1000; | |
156 | ||
157 | icmp->checksum = checksum(icmp, packetsize - sizeof(struct IPHeader)); | |
158 | ip->check = checksum(ip, packetsize); | |
159 | ||
160 | sendto(sendsock, packet, packetsize, 0, | |
161 | (struct sockaddr *)&addr, sizeof(addr)); | |
162 | } | |
163 | ||
164 | /* Attempt to find the host at a particular number of hops away */ | |
165 | void net_send_query(int hops) { | |
166 | char packet[sizeof(struct IPHeader) + sizeof(struct ICMPHeader) + sizeof(struct packetdata)]; | |
167 | struct IPHeader *ip; | |
168 | struct ICMPHeader *icmp; | |
169 | struct packetdata *data; | |
170 | int packetsize = sizeof(struct IPHeader) + sizeof(struct ICMPHeader) + sizeof(struct packetdata); | |
171 | ||
172 | memset(packet, 0, packetsize); | |
173 | ||
174 | ip = (struct IPHeader *)packet; | |
175 | icmp = (struct ICMPHeader *)(packet + sizeof(struct IPHeader)); | |
176 | data = (struct packetdata *)(packet + sizeof(struct IPHeader) + sizeof(struct ICMPHeader)); | |
177 | ||
178 | ip->version = 0x45; | |
179 | ip->tos = 0; | |
180 | ip->len = htons (packetsize); | |
181 | ip->id = 0; | |
182 | ip->frag = 0; | |
183 | ip->ttl = hops; | |
195 | ip->ttl = index + 1; | |
184 | 196 | ip->protocol = IPPROTO_ICMP; |
185 | 197 | ip->saddr = 0; |
186 | 198 | ip->daddr = remoteaddress.sin_addr.s_addr; |
187 | 199 | |
188 | 200 | icmp->type = ICMP_ECHO; |
189 | 201 | icmp->id = getpid(); |
190 | icmp->sequence = hops; | |
191 | ||
192 | data->ttl = hops; | |
193 | data->index = -1; | |
202 | icmp->sequence = new_sequence(index); | |
194 | 203 | |
195 | 204 | icmp->checksum = checksum(icmp, packetsize - sizeof(struct IPHeader)); |
196 | 205 | ip->check = checksum(ip, packetsize); |
197 | 206 | |
198 | sendto(sendsock, packet, packetsize, 0, | |
207 | gettimeofday(&sequence[icmp->sequence].time, NULL); | |
208 | rv = sendto(sendsock, packet, packetsize, 0, | |
199 | 209 | (struct sockaddr *)&remoteaddress, sizeof(remoteaddress)); |
200 | } | |
201 | ||
202 | void net_process_ping(struct packetdata *data, struct sockaddr_in *addr) { | |
203 | int at; | |
204 | struct timeval now; | |
205 | int totmsec; | |
206 | ||
207 | if(data->index >= 0) { | |
208 | gettimeofday(&now, NULL); | |
209 | ||
210 | if(data->sec < reset.tv_sec | |
211 | || (data->sec == reset.tv_sec && (1000*data->msec) < reset.tv_usec)) | |
212 | /* discard this data point, stats were reset after it was generated */ | |
213 | return; | |
214 | ||
215 | totmsec = (now.tv_sec - data->sec) * 1000 + | |
216 | ((now.tv_usec/1000) - data->msec); | |
217 | ||
218 | if(host[data->index].returned <= 0) { | |
219 | host[data->index].best = host[data->index].worst = totmsec; | |
210 | if (first && (rv < 0) && (errno == EINVAL)) { | |
211 | ip->len = packetsize; | |
212 | rv = sendto(sendsock, packet, packetsize, 0, | |
213 | (struct sockaddr *)&remoteaddress, sizeof(remoteaddress)); | |
214 | if (rv >= 0) { | |
215 | fprintf (stderr, "You've got a broken (FreeBSD?) system\n"); | |
216 | BSDfix = 1; | |
220 | 217 | } |
221 | ||
222 | if(totmsec < host[data->index].best) | |
223 | host[data->index].best = totmsec; | |
224 | ||
225 | if(totmsec > host[data->index].worst) | |
226 | host[data->index].worst = totmsec; | |
227 | ||
228 | display_rawping (data->index, totmsec); | |
229 | ||
230 | host[data->index].total += totmsec; | |
231 | host[data->index].returned++; | |
232 | host[data->index].transit = 0; | |
233 | } else { | |
234 | at = data->ttl - 1; | |
235 | if(at < 0 || at > MaxHost) | |
236 | return; | |
237 | ||
238 | host[at].addr = addr->sin_addr.s_addr; | |
239 | display_rawhost (at, host[at].addr); | |
240 | } | |
241 | } | |
242 | ||
218 | } | |
219 | first = 0; | |
220 | } | |
221 | ||
222 | /* We got a return on something we sent out. Record the address and | |
223 | time. */ | |
224 | void net_process_ping(int seq, uint32 addr, struct timeval now) { | |
225 | int index; | |
226 | int totusec; | |
227 | ||
228 | if(seq < 0 || seq >= MaxSequence) | |
229 | return; | |
230 | ||
231 | if(!sequence[seq].transit) | |
232 | return; | |
233 | sequence[seq].transit = 0; | |
234 | ||
235 | index = sequence[seq].index; | |
236 | ||
237 | totusec = (now.tv_sec - sequence[seq].time.tv_sec ) * 1000000 + | |
238 | (now.tv_usec - sequence[seq].time.tv_usec); | |
239 | ||
240 | if(host[index].addr == 0) { | |
241 | host[index].addr = addr; | |
242 | display_rawhost(index, host[index].addr); | |
243 | } | |
244 | if(host[index].returned <= 0) { | |
245 | host[index].best = host[index].worst = totusec; | |
246 | } | |
247 | host[index].last = totusec; | |
248 | if(totusec < host[index].best) | |
249 | host[index].best = totusec; | |
250 | if(totusec > host[index].worst) | |
251 | host[index].worst = totusec; | |
252 | ||
253 | host[index].total += totusec; | |
254 | host[index].returned++; | |
255 | host[index].transit = 0; | |
256 | ||
257 | net_save_return(index, sequence[seq].saved_seq, totusec); | |
258 | display_rawping(index, totusec); | |
259 | } | |
260 | ||
261 | /* We know a packet has come in, because the main select loop has called us, | |
262 | now we just need to read it, see if it is for us, and if it is a reply | |
263 | to something we sent, then call net_process_ping() */ | |
243 | 264 | void net_process_return() { |
244 | 265 | char packet[2048]; |
245 | 266 | struct sockaddr_in fromaddr; |
247 | 268 | int num; |
248 | 269 | int at; |
249 | 270 | struct ICMPHeader *header; |
271 | struct timeval now; | |
272 | ||
273 | gettimeofday(&now, NULL); | |
250 | 274 | |
251 | 275 | fromaddrsize = sizeof(fromaddr); |
252 | 276 | num = recvfrom(recvsock, packet, 2048, 0, |
253 | 277 | (struct sockaddr *)&fromaddr, &fromaddrsize); |
254 | 278 | |
255 | if(num < sizeof(struct IPHeader) + sizeof(struct ICMPHeader) + sizeof(struct packetdata)) | |
279 | if(num < sizeof(struct IPHeader) + sizeof(struct ICMPHeader)) | |
256 | 280 | return; |
257 | 281 | |
258 | 282 | header = (struct ICMPHeader *)(packet + sizeof(struct IPHeader)); |
260 | 284 | if(header->id != getpid()) |
261 | 285 | return; |
262 | 286 | |
263 | net_process_ping((struct packetdata *)(packet + sizeof(struct IPHeader) + | |
264 | sizeof(struct ICMPHeader)), | |
265 | &fromaddr); | |
287 | net_process_ping(header->sequence, fromaddr.sin_addr.s_addr, now); | |
266 | 288 | } else if(header->type == ICMP_TIME_EXCEEDED) { |
267 | 289 | if(num < sizeof(struct IPHeader) + sizeof(struct ICMPHeader) + |
268 | 290 | sizeof(struct IPHeader) + sizeof(struct ICMPHeader)) |
272 | 294 | sizeof(struct ICMPHeader) + sizeof(struct IPHeader)); |
273 | 295 | if(header->id != getpid()) |
274 | 296 | return; |
275 | ||
276 | at = header->sequence - 1; | |
277 | if(at < 0 || at > MaxHost) | |
278 | return; | |
279 | ||
280 | host[at].addr = fromaddr.sin_addr.s_addr; | |
281 | display_rawhost (at, net_addr(at)); | |
297 | ||
298 | net_process_ping(header->sequence, fromaddr.sin_addr.s_addr, now); | |
282 | 299 | } |
283 | 300 | } |
284 | 301 | |
287 | 304 | } |
288 | 305 | |
289 | 306 | int net_percent(int at) { |
290 | if(host[at].xmit == 0) | |
307 | if((host[at].xmit - host[at].transit) == 0) | |
291 | 308 | return 0; |
292 | 309 | |
293 | return 100 - (100 * (host[at].returned + host[at].transit) / host[at].xmit); | |
310 | return 100 - (100 * host[at].returned / (host[at].xmit - host[at].transit)); | |
311 | } | |
312 | ||
313 | int net_last(int at) { | |
314 | return host[at].last; | |
294 | 315 | } |
295 | 316 | |
296 | 317 | int net_best(int at) { |
313 | 334 | int max; |
314 | 335 | |
315 | 336 | max = 0; |
316 | for(at = 0; at < MaxHost; at++) { | |
337 | for(at = 0; at < MaxHost-2; at++) { | |
317 | 338 | if(host[at].addr == remoteaddress.sin_addr.s_addr) { |
318 | 339 | return at + 1; |
319 | 340 | } else if(host[at].addr != 0) { |
347 | 368 | |
348 | 369 | |
349 | 370 | int net_send_batch() { |
350 | static int n_unknown = 10; | |
351 | static int at; | |
352 | ||
353 | if(host[at].addr == 0) { | |
354 | net_send_query(at + 1); | |
355 | n_unknown--; | |
356 | } else { | |
357 | net_send_ping(at); | |
358 | } | |
359 | ||
360 | if ((host[at].addr == remoteaddress.sin_addr.s_addr) || | |
361 | (n_unknown == 0)) { | |
362 | DeltaTime = WaitTime / (float) (at+1); | |
363 | at = 0; | |
364 | n_unknown = 10; | |
371 | int n_unknown, i; | |
372 | ||
373 | net_send_query(batch_at); | |
374 | ||
375 | n_unknown = 0; | |
376 | ||
377 | for (i=0;i<batch_at;i++) { | |
378 | if (host[i].addr == 0) | |
379 | n_unknown++; | |
380 | if (host[i].addr == remoteaddress.sin_addr.s_addr) | |
381 | n_unknown = 100; /* Make sure we drop into "we should restart" */ | |
382 | } | |
383 | ||
384 | if ((host[batch_at].addr == remoteaddress.sin_addr.s_addr) || | |
385 | (n_unknown > MAX_UNKNOWN_HOSTS) || | |
386 | (batch_at >= MaxHost-2)) { | |
387 | numhosts = batch_at+1; | |
388 | batch_at = 0; | |
365 | 389 | return 1; |
366 | 390 | } |
367 | 391 | |
368 | at++; | |
392 | batch_at++; | |
369 | 393 | return 0; |
370 | 394 | } |
371 | 395 | |
395 | 419 | } |
396 | 420 | |
397 | 421 | int net_open(int addr) { |
422 | net_reset(); | |
423 | ||
398 | 424 | remoteaddress.sin_family = AF_INET; |
399 | 425 | remoteaddress.sin_addr.s_addr = addr; |
400 | 426 | |
401 | net_send_batch(); | |
402 | ||
403 | 427 | return 0; |
404 | 428 | } |
405 | 429 | |
419 | 443 | |
420 | 444 | void net_reset() { |
421 | 445 | int at; |
446 | int i; | |
447 | ||
448 | batch_at = 0; | |
449 | numhosts = 10; | |
422 | 450 | |
423 | 451 | for(at = 0; at < MaxHost; at++) { |
424 | host[at].xmit = host[at].transit; | |
452 | host[at].xmit = 0; | |
453 | host[at].transit = 0; | |
425 | 454 | host[at].returned = 0; |
426 | 455 | host[at].total = 0; |
427 | 456 | host[at].best = 0; |
428 | 457 | host[at].worst = 0; |
429 | } | |
458 | for (i=0; i<SAVED_PINGS; i++) { | |
459 | host[at].saved[i] = -2; /* unsent */ | |
460 | } | |
461 | } | |
462 | ||
463 | for(at = 0; at < MaxSequence; at++) { | |
464 | sequence[at].transit = 0; | |
465 | } | |
466 | ||
430 | 467 | gettimeofday(&reset, NULL); |
431 | 468 | } |
432 | 469 | |
440 | 477 | } |
441 | 478 | |
442 | 479 | |
480 | int* net_saved_pings(int at) { | |
481 | return host[at].saved; | |
482 | } | |
483 | ||
484 | void net_save_xmit(int at) { | |
485 | int tmp[SAVED_PINGS]; | |
486 | memcpy(tmp, &host[at].saved[1], (SAVED_PINGS-1)*sizeof(int)); | |
487 | memcpy(host[at].saved, tmp, (SAVED_PINGS-1)*sizeof(int)); | |
488 | host[at].saved[SAVED_PINGS-1] = -1; | |
489 | } | |
490 | ||
491 | void net_save_return(int at, int seq, int ms) { | |
492 | int idx; | |
493 | idx = SAVED_PINGS - (host[at].xmit - seq) - 1; | |
494 | if (idx < 0) { | |
495 | return; | |
496 | } | |
497 | host[at].saved[idx] = ms; | |
498 | } |
34 | 34 | int net_send_batch(); |
35 | 35 | void net_end_transit(); |
36 | 36 | |
37 | int calc_deltatime (float WaitTime); | |
38 | ||
39 | ||
37 | 40 | /* Added by Brian Casey, December 1997 bcasey@imagiware.com*/ |
38 | 41 | int net_returned(int at); |
39 | 42 | int net_xmit(int at); |
40 | 43 | int net_transit(int at); |
41 | 44 | |
45 | #define SAVED_PINGS 50 | |
46 | int* net_saved_pings(int at); | |
47 | void net_save_xmit(int at); | |
48 | void net_save_return(int at, int seq, int ms); | |
49 | int net_duplicate(int at, int seq); | |
42 | 50 | |
43 | 51 | #define MaxHost 256 |
52 | #define MaxSequence 65536 | |
53 | ||
54 | #define MAXPACKET 4096 | |
55 | #define MINPACKET 64 |
30 | 30 | extern int dns; |
31 | 31 | |
32 | 32 | void report_open() { |
33 | printf("%-40s LOSS RCVD SENT BEST AVG WORST\n", "HOST"); | |
33 | printf("%-38s LOSS RCVD SENT BEST AVG WORST\n", "HOST"); | |
34 | 34 | fflush(stdout); |
35 | 35 | } |
36 | 36 | |
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | printf("%-40s%5d%%%6d%5d%6d%6d%6d\n", name, | |
64 | /* Coding tip: | |
65 | ||
66 | NEVER EVER use a format like "%6d%6d%6d". This will nicely | |
67 | format your three numbers in 18 spaces just like " %5d %5d %5d" | |
68 | and save you three bytes of static string space. However, when | |
69 | the numbers suddenly become a bit larger than you expected | |
70 | you'll end up with unexpected results: just one huge number | |
71 | instead of three separate numbers. This especially matters if | |
72 | the reader of the info is a program and not human. */ | |
73 | ||
74 | printf("%-38s %4d%% %5d %4d %7.2f %7.2f %7.2f\n", name, | |
65 | 75 | net_percent(at), |
66 | 76 | net_returned(at), net_xmit(at), |
67 | net_best(at), net_avg(at), net_worst(at)); | |
77 | net_best(at)/1000.0, net_avg(at)/1000.0, net_worst(at)/1000.0); | |
68 | 78 | } |
69 | 79 | } |
70 | 80 |
31 | 31 | extern int Interactive; |
32 | 32 | extern int MaxPing; |
33 | 33 | extern float WaitTime; |
34 | float DeltaTime; | |
35 | 34 | double dnsinterval; |
36 | 35 | |
37 | 36 | static struct timeval intervaltime; |
37 | ||
38 | 38 | |
39 | 39 | void select_loop() { |
40 | 40 | fd_set readfd; |
42 | 42 | int action, maxfd; |
43 | 43 | int dnsfd, netfd; |
44 | 44 | int NumPing; |
45 | int paused; | |
45 | 46 | struct timeval lasttime, thistime, selecttime; |
46 | 47 | float wt; |
48 | int dt; | |
47 | 49 | |
48 | NumPing = 0; | |
50 | NumPing = 0; | |
49 | 51 | anyset = 0; |
50 | 52 | gettimeofday(&lasttime, NULL); |
51 | DeltaTime = WaitTime/10; | |
53 | paused=0; | |
52 | 54 | |
53 | 55 | while(1) { |
54 | intervaltime.tv_sec = DeltaTime; | |
55 | intervaltime.tv_usec = 1000000 *( DeltaTime - floor (DeltaTime)); | |
56 | dt = calc_deltatime (WaitTime); | |
57 | intervaltime.tv_sec = dt / 1000000; | |
58 | intervaltime.tv_usec = dt % 1000000; | |
56 | 59 | |
57 | 60 | FD_ZERO(&readfd); |
58 | 61 | |
73 | 76 | if(netfd >= maxfd) |
74 | 77 | maxfd = netfd + 1; |
75 | 78 | |
76 | if(anyset) { | |
79 | if(anyset || paused) { | |
77 | 80 | selecttime.tv_sec = 0; |
78 | 81 | selecttime.tv_usec = 0; |
79 | 82 | |
133 | 136 | if(action == ActionReset) |
134 | 137 | net_reset(); |
135 | 138 | |
139 | if (action == ActionDisplay) | |
140 | display_mode = (display_mode+1) % 3; | |
141 | ||
142 | if (action == ActionClear) | |
143 | display_clear(); | |
144 | ||
145 | if (action == ActionPause) | |
146 | paused=1; | |
147 | ||
148 | if (action == ActionResume) | |
149 | paused=0; | |
150 | ||
136 | 151 | anyset = 1; |
137 | 152 | } |
138 | 153 |
30 | 30 | #include "net.h" |
31 | 31 | #include "split.h" |
32 | 32 | */ |
33 | ||
34 | #include <config.h> | |
35 | ||
36 | #ifdef NO_CURSES | |
37 | #include <sys/time.h> | |
38 | #include <sys/types.h> | |
39 | #include <unistd.h> | |
40 | #else | |
41 | /* Use the curses variant */ | |
42 | ||
43 | #if defined(HAVE_NCURSES_H) | |
44 | # include <ncurses.h> | |
45 | #elif defined(HAVE_NCURSES_CURSES_H) | |
46 | # include <ncurses/curses.h> | |
47 | #elif defined(HAVE_CURSES_H) | |
48 | # include <curses.h> | |
49 | #else | |
50 | # error No curses header file available | |
51 | #endif | |
52 | ||
53 | #endif | |
33 | 54 | |
34 | 55 | |
35 | 56 | extern char *Hostname; |
79 | 100 | if(name != NULL) { |
80 | 101 | /* May be we should test name's length */ |
81 | 102 | sprintf(newLine, "%s %d %d %d %d %d %d", name, |
82 | net_percent(at), | |
83 | net_returned(at), net_xmit(at), | |
84 | net_best(at), net_avg(at), net_worst(at)); | |
103 | net_percent(at), | |
104 | net_returned(at), net_xmit(at), | |
105 | net_best(at) /1000, net_avg(at)/1000, | |
106 | net_worst(at)/1000); | |
85 | 107 | } else { |
86 | 108 | sprintf(newLine, "%d.%d.%d.%d %d %d %d %d %d %d", |
87 | (addr >> 24) & 0xff, (addr >> 16) & 0xff, | |
88 | (addr >> 8) & 0xff, addr & 0xff, | |
89 | net_percent(at), | |
90 | net_returned(at), net_xmit(at), | |
91 | net_best(at), net_avg(at), net_worst(at)); | |
109 | (addr >> 24) & 0xff, (addr >> 16) & 0xff, | |
110 | (addr >> 8) & 0xff, addr & 0xff, | |
111 | net_percent(at), | |
112 | net_returned(at), net_xmit(at), | |
113 | net_best(at) /1000, net_avg(at)/1000, | |
114 | net_worst(at)/1000); | |
92 | 115 | } |
93 | 116 | } else { |
94 | 117 | sprintf(newLine, "???"); |
131 | 154 | |
132 | 155 | int |
133 | 156 | split_keyaction() { |
157 | #ifdef NO_CURSES | |
158 | fd_set readfds; | |
159 | struct timeval tv; | |
160 | char c; | |
161 | ||
162 | FD_ZERO (&readfds); | |
163 | FD_SET (0, &readfds); | |
164 | tv.tv_sec = 0; | |
165 | tv.tv_usec = 0; | |
166 | ||
167 | if (select (1, &readfds, NULL, NULL, &tv) > 0) { | |
168 | read (0, &c, 1); | |
169 | } else | |
170 | return 0; | |
171 | #else | |
134 | 172 | char c = getch(); |
173 | #endif | |
135 | 174 | |
136 | 175 | #if DEBUG |
137 | 176 | printf("split_keyaction()\n"); |