Bug 449371 Firefox/Thunderbird crashes at exit [@ gdk_display_x11_finalize], p=Brian...
[wine-gecko.git] / nsprpub / pr / tests / Makefile.in
blobca052f3a30c0989b87259df8e7bbfc82aa834b84
1 #
2 # ***** BEGIN LICENSE BLOCK *****
3 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 # The contents of this file are subject to the Mozilla Public License Version
6 # 1.1 (the "License"); you may not use this file except in compliance with
7 # the License. You may obtain a copy of the License at
8 # http://www.mozilla.org/MPL/
10 # Software distributed under the License is distributed on an "AS IS" basis,
11 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 # for the specific language governing rights and limitations under the
13 # License.
15 # The Original Code is the Netscape Portable Runtime (NSPR).
17 # The Initial Developer of the Original Code is
18 # Netscape Communications Corporation.
19 # Portions created by the Initial Developer are Copyright (C) 1998-2000
20 # the Initial Developer. All Rights Reserved.
22 # Contributor(s):
24 # Alternatively, the contents of this file may be used under the terms of
25 # either the GNU General Public License Version 2 or later (the "GPL"), or
26 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 # in which case the provisions of the GPL or the LGPL are applicable instead
28 # of those above. If you wish to allow use of your version of this file only
29 # under the terms of either the GPL or the LGPL, and not to allow others to
30 # use your version of this file under the terms of the MPL, indicate your
31 # decision by deleting the provisions above and replace them with the notice
32 # and other provisions required by the GPL or the LGPL. If you do not delete
33 # the provisions above, a recipient may use your version of this file under
34 # the terms of any one of the MPL, the GPL or the LGPL.
36 # ***** END LICENSE BLOCK *****
39 #! gmake
41 MOD_DEPTH = ../..
42 topsrcdir = @top_srcdir@
43 srcdir = @srcdir@
44 VPATH = @srcdir@
46 include $(MOD_DEPTH)/config/autoconf.mk
48 include $(topsrcdir)/config/config.mk
50 DIRS = dll
52 CSRCS = \
53 accept.c \
54 acceptread.c \
55 acceptreademu.c \
56 addrstr.c \
57 affinity.c \
58 alarm.c \
59 anonfm.c \
60 append.c \
61 atomic.c \
62 attach.c \
63 bigfile.c \
64 bigfile2.c \
65 bigfile3.c \
66 cleanup.c \
67 cltsrv.c \
68 concur.c \
69 cvar.c \
70 cvar2.c \
71 dceemu.c \
72 dlltest.c \
73 dtoa.c \
74 env.c \
75 errcodes.c \
76 errset.c \
77 exit.c \
78 fdcach.c \
79 fileio.c \
80 foreign.c \
81 forktest.c \
82 formattm.c \
83 fsync.c \
84 getai.c \
85 gethost.c \
86 getproto.c \
87 i2l.c \
88 initclk.c \
89 inrval.c \
90 instrumt.c \
91 intrio.c \
92 intrupt.c \
93 io_timeout.c \
94 ioconthr.c \
95 ipv6.c \
96 join.c \
97 joinkk.c \
98 joinku.c \
99 joinuk.c \
100 joinuu.c \
101 layer.c \
102 lazyinit.c \
103 libfilename.c \
104 lltest.c \
105 lock.c \
106 lockfile.c \
107 logger.c \
108 makedir.c \
109 mbcs.c \
110 multiacc.c \
111 multiwait.c \
112 many_cv.c \
113 nameshm1.c \
114 nbconn.c \
115 nblayer.c \
116 nonblock.c \
117 ntioto.c \
118 ntoh.c \
119 obsints.c \
120 op_2long.c \
121 op_excl.c \
122 op_filnf.c \
123 op_filok.c \
124 op_noacc.c \
125 op_nofil.c \
126 openfile.c \
127 parent.c \
128 peek.c \
129 perf.c \
130 pipeping.c \
131 pipeping2.c \
132 pipepong.c \
133 pipepong2.c \
134 pipeself.c \
135 poll_er.c \
136 poll_nm.c \
137 poll_to.c \
138 pollable.c \
139 prftest.c \
140 prftest1.c \
141 prftest2.c \
142 primblok.c \
143 priotest.c \
144 provider.c \
145 prpoll.c \
146 prpollml.c \
147 ranfile.c \
148 randseed.c \
149 rmdir.c \
150 rwlocktest.c \
151 sel_spd.c \
152 selct_er.c \
153 selct_nm.c \
154 selct_to.c \
155 select2.c \
156 selintr.c \
157 sem.c \
158 sema.c \
159 semaerr.c \
160 semaerr1.c \
161 semaping.c \
162 semapong.c \
163 sendzlf.c \
164 server_test.c \
165 servr_kk.c \
166 servr_ku.c \
167 servr_uk.c \
168 servr_uu.c \
169 short_thread.c \
170 sigpipe.c \
171 socket.c \
172 sockopt.c \
173 sockping.c \
174 sockpong.c \
175 sprintf.c \
176 sproc_ch.c \
177 sproc_p.c \
178 stack.c \
179 stdio.c \
180 str2addr.c \
181 strod.c \
182 suspend.c \
183 switch.c \
184 system.c \
185 testbit.c \
186 testfile.c \
187 thrpool_server.c \
188 thrpool_client.c \
189 threads.c \
190 thruput.c \
191 timemac.c \
192 timetest.c \
193 tmoacc.c \
194 tmocon.c \
195 tpd.c \
196 vercheck.c \
197 version.c \
198 udpsrv.c \
199 writev.c \
200 xnotify.c \
201 y2k.c \
202 y2ktmo.c \
203 zerolen.c \
204 $(NULL)
206 ifeq ($(OS_TARGET),OS2)
207 CSRCS += \
208 sleep.c \
209 stat.c \
210 yield.c \
211 $(NULL)
212 endif
214 ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
215 PROG_SUFFIX = .exe
216 else
217 PROG_SUFFIX =
218 endif
220 PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX)))
222 TARGETS = $(PROGS)
224 INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
226 ifeq ($(OS_ARCH), WINNT)
227 ifdef NS_USE_GCC
228 EXTRA_LIBS += -lwsock32
229 else
230 EXTRA_LIBS += wsock32.lib
231 LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
232 ifdef PROFILE
233 LDOPTS += -PROFILE -MAP
234 endif # profile
235 endif # NS_USE_GCC
236 endif
238 ifeq ($(OS_ARCH),OS2)
239 ifeq ($(MOZ_OS2_TOOLS),VACPP)
240 LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO
241 else
242 EXTRA_LIBS = $(OS_LIBS)
243 LDOPTS = -Zomf -Zlinker /PM:VIO -Zlinker /ST:0x64000
244 endif
245 endif
247 ifneq ($(OS_ARCH), WINNT)
248 # Use an absolute pathname as the runtime library path (for the -R
249 # or -rpath linker option or the LD_RUN_PATH environment variable).
250 ifeq (,$(patsubst /%,,$(DIST)))
251 # $(DIST) is already an absolute pathname.
252 ABSOLUTE_LIB_DIR = $(dist_libdir)
253 else
254 # $(DIST) is a relative pathname: prepend the current directory.
255 PWD = $(shell pwd)
256 ABSOLUTE_LIB_DIR = $(PWD)/$(dist_libdir)
257 endif
258 endif
260 ifeq ($(OS_ARCH), IRIX)
261 ifeq ($(USE_CPLUS), 1)
262 CC = CC
263 endif
264 LDOPTS += -rpath $(ABSOLUTE_LIB_DIR)
265 ifdef NS_USE_GCC
266 LDOPTS += -Wl,-rdata_shared
267 else
268 LDOPTS += -rdata_shared
269 endif
270 # For 6.x machines, include this flag
271 ifeq ($(basename $(OS_RELEASE)),6)
272 ifndef NS_USE_GCC
273 ifeq ($(USE_N32),1)
274 LDOPTS += -n32
275 else
276 LDOPTS += -32
277 endif
279 ifeq ($(USE_PTHREADS), 1)
280 ifeq ($(OS_RELEASE), 6.2)
281 LDOPTS += -Wl,-woff,85
282 endif
283 endif
284 endif
285 endif
286 endif
288 ifeq ($(OS_ARCH), OSF1)
289 ifeq ($(USE_CPLUS), 1)
290 CC = cxx
291 endif
292 # I haven't figured out how to pass -rpath to cc on OSF1 V3.2, so
293 # we do static linking.
294 ifeq (,$(filter-out V2.0 V3.2,$(OS_RELEASE)))
295 LIBNSPR = $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a
296 LIBPLC = $(dist_libdir)/libplc$(MOD_MAJOR_VERSION).a
297 EXTRA_LIBS = -lc_r
298 else
299 LDOPTS += -rpath $(ABSOLUTE_LIB_DIR)
300 endif
301 endif
303 ifeq ($(OS_ARCH), HP-UX)
304 LDOPTS += -z -Wl,+s,+b,$(ABSOLUTE_LIB_DIR)
305 ifeq ($(USE_64),1)
306 LDOPTS += +DD64
307 endif
308 ifeq ($(USE_PTHREADS),1)
309 EXTRA_LIBS = $(LIBPTHREAD)
310 endif
311 endif
313 # AIX
314 ifeq ($(OS_ARCH),AIX)
315 LDOPTS += -blibpath:$(ABSOLUTE_LIB_DIR):/usr/lib:/lib
316 ifneq ($(OS_ARCH)$(OS_RELEASE),AIX4.1)
317 LDOPTS += -brtl
318 EXTRA_LIBS = -ldl
319 endif
320 endif
322 # Solaris
323 ifeq ($(OS_ARCH), SunOS)
324 ifneq ($(OS_RELEASE), 4.1.3_U1)
325 ifdef NS_USE_GCC
326 LDOPTS += -Xlinker -R -Xlinker $(ABSOLUTE_LIB_DIR)
327 else
328 ifeq ($(USE_CPLUS), 1)
329 CC = CC
330 endif
331 LDOPTS += -R $(ABSOLUTE_LIB_DIR)
332 endif
333 endif
335 ifneq ($(LOCAL_THREADS_ONLY),1)
336 ifdef USE_PTHREADS
337 EXTRA_LIBS = -lpthread
338 else
339 EXTRA_LIBS = -lthread
340 endif
341 endif # LOCAL_THREADS_ONLY
342 endif # SunOS
344 ifeq ($(OS_ARCH), NEC)
345 EXTRA_LIBS = $(OS_LIBS)
346 # This hardcodes in the executable programs the directory to find
347 # libnspr.so etc. at program startup. Equivalent to the -R or -rpath
348 # option for ld on other platforms.
349 export LD_RUN_PATH = $(ABSOLUTE_LIB_DIR)
350 endif
352 ifeq ($(OS_ARCH), NCR)
353 # NCR needs to link against -lsocket -lnsl -ldl (and -lc, which is
354 # linked implicitly by $(CC)). Note that we did not link with these
355 # system libraries when we built libnspr.so.
356 EXTRA_LIBS = -lsocket -lnsl -ldl
357 # This hardcodes in the executable programs the directory to find
358 # libnspr.so etc. at program startup. Equivalent to the -R or -rpath
359 # option for ld on other platforms.
360 export LD_RUN_PATH = $(ABSOLUTE_LIB_DIR)
361 endif
363 ifeq ($(OS_ARCH), NEXTSTEP)
364 # balazs.pataki@sztaki.hu: linkage is done in a different pass in the `tests'
365 # modeul, so we have to pass the `-posix' flag by "hand" to `ld'
366 LDOPTS += -posix
367 endif
369 ifeq ($(OS_ARCH), NEWS-OS)
370 # This hardcodes in the executable programs the directory to find
371 # libnspr.so etc. at program startup. Equivalent to the -R or -rpath
372 # option for ld on other platforms.
373 #export LD_RUN_PATH = $(ABSOLUTE_LIB_DIR)
374 LIBNSPR = $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a
375 LIBPLC = $(dist_libdir)/libplc$(MOD_MAJOR_VERSION).a
376 EXTRA_LIBS = -lsocket -lnsl -lgen -lresolv
377 endif
379 ifeq (,$(filter-out Linux GNU GNU_%,$(OS_ARCH)))
380 LDOPTS += -Xlinker -rpath $(ABSOLUTE_LIB_DIR)
381 ifeq ($(USE_PTHREADS),1)
382 EXTRA_LIBS = -lpthread
383 endif
384 endif
386 ifeq ($(OS_ARCH), SCOOS)
387 # SCO Unix needs to link against -lsocket again even though we
388 # already linked with these system libraries when we built libnspr.so.
389 EXTRA_LIBS = -lsocket
390 # This hardcodes in the executable programs the directory to find
391 # libnspr.so etc. at program startup. Equivalent to the -R or -rpath
392 # option for ld on other platforms.
393 export LD_RUN_PATH = $(ABSOLUTE_LIB_DIR)
394 endif
396 ifeq ($(OS_ARCH),SINIX)
397 EXTRA_LIBS = -lsocket -lnsl -lresolv -ldl
398 # This hardcodes in the executable programs the directory to find
399 # libnspr.so etc. at program startup. Equivalent to the -R or -rpath
400 # option for ld on other platforms.
401 export LD_RUN_PATH = $(ABSOLUTE_LIB_DIR)
402 endif
404 ifeq ($(OS_ARCH),OpenUNIX)
405 export LD_RUN_PATH = $(ABSOLUTE_LIB_DIR)
406 ifeq ($(USE_PTHREADS),1)
407 LDOPTS += -pthread
408 endif
409 endif
411 ifeq ($(OS_ARCH), UNIXWARE)
412 export LD_RUN_PATH = $(ABSOLUTE_LIB_DIR)
413 endif
415 ifeq ($(OS_ARCH),FreeBSD)
416 ifeq ($(USE_PTHREADS),1)
417 LDOPTS += -pthread
418 endif
419 LDOPTS += -Xlinker -R $(ABSOLUTE_LIB_DIR)
420 endif
422 ifeq ($(OS_ARCH),OpenBSD)
423 ifeq ($(USE_PTHREADS),1)
424 LDOPTS += -pthread
425 endif
426 endif
428 ifeq ($(OS_ARCH),BSD_OS)
429 ifneq ($(OS_RELEASE),1.1)
430 EXTRA_LIBS = -ldl
431 endif
432 endif
434 ifeq ($(USE_PTHREADS),1)
435 LIBPTHREAD = -lpthread
436 ifeq ($(OS_ARCH),AIX)
437 LIBPTHREAD = -lpthreads
438 endif
439 ifeq (,$(filter-out FreeBSD OpenBSD BSD_OS QNX Darwin OpenUNIX,$(OS_ARCH)))
440 LIBPTHREAD =
441 endif
442 ifeq ($(OS_ARCH)$(basename $(OS_RELEASE)),HP-UXB.10)
443 LIBPTHREAD = -ldce
444 endif
445 endif
448 #####################################################
450 # The rules
452 #####################################################
454 include $(topsrcdir)/config/rules.mk
456 AIX_PRE_4_2 = 0
457 ifeq ($(OS_ARCH),AIX)
458 ifeq ($(OS_RELEASE),4.1)
459 ifneq ($(USE_PTHREADS), 1)
460 #AIX_PRE_4_2 = 1
461 endif
462 endif
463 endif
465 ifeq ($(AIX_PRE_4_2),1)
467 # AIX releases prior to 4.2 need a special two-step linking hack
468 # in order to both override the system select() and be able to
469 # get at the original system select().
471 # We use a pattern rule in ns/nspr20/config/rules.mk to generate
472 # the .$(OBJ_SUFFIX) file from the .c source file, then do the
473 # two-step linking hack below.
475 $(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX)
476 @$(MAKE_OBJDIR)
477 rm -f $@ $(AIX_TMP)
478 $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a
479 $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP)
480 rm -f $(AIX_TMP)
482 else
484 # All platforms that are not AIX pre-4.2.
486 $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
487 @$(MAKE_OBJDIR)
488 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
489 link $(LDOPTS) $(EXTRA_LDOPTS) $< $(LIBPLC) $(LIBNSPR) $(EXTRA_LIBS) -out:$@
490 ifdef MT
491 @if test -f $@.manifest; then \
492 $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
493 rm -f $@.manifest; \
495 endif
496 else
497 ifeq ($(MOZ_OS2_TOOLS),VACPP)
498 $(LD) $(EXEFLAGS) $(LDOPTS) $< $(LIBPLC) $(LIBNSPR) $(OS_LIBS) $(EXTRA_LIBS)
499 else
500 $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(EXTRA_LIBS) -o $@
501 endif # OS/2
502 endif # WINNT
503 endif # AIX_PRE_4_2
505 export:: $(TARGETS)
506 clean::
507 rm -f $(TARGETS)
509 # The following tests call BSD socket functions, so they need to link
510 # with -lsocket on some platforms.
511 ifeq ($(OS_ARCH),SunOS)
512 ifneq ($(OS_RELEASE),4.1.3_U1)
513 ifeq ($(USE_IPV6),1)
514 $(OBJDIR)/gethost: $(OBJDIR)/gethost.o
515 $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) -lsocket $(EXTRA_LIBS) -o $@
516 endif
517 $(OBJDIR)/prpoll: $(OBJDIR)/prpoll.o
518 $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) -lsocket $(EXTRA_LIBS) -o $@
519 endif
520 endif
522 ifeq ($(USE_PTHREADS), 1)
523 $(OBJDIR)/attach: $(OBJDIR)/attach.o
524 $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@
525 $(OBJDIR)/foreign: $(OBJDIR)/foreign.o
526 $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@
527 $(OBJDIR)/provider: $(OBJDIR)/provider.o
528 $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@
529 $(OBJDIR)/socket: $(OBJDIR)/socket.o
530 $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@
531 $(OBJDIR)/testfile: $(OBJDIR)/testfile.o
532 $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@
533 endif
536 # Run the test programs with no arguments
538 # Test output goes to the file pointed to by the environment variable
539 # NSPR_TEST_LOGFILE, if set, else to /dev/null
541 ECHO = echo
542 PROGRAMS = $(notdir $(PROGS))
543 ifdef NSPR_TEST_LOGFILE
544 LOGFILE = $(NSPR_TEST_LOGFILE)
545 else
546 ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
547 LOGFILE = nul
548 else
549 LOGFILE = /dev/null
550 endif
551 endif
553 ifeq ($(OS_TARGET),Linux)
554 ECHO = /bin/echo
555 endif
557 ALWAYS:
559 runtests:: $(PROGS) ALWAYS
560 @$(ECHO) "\nNSPR Test Results - $(OBJDIR)\n"
561 @$(ECHO) "BEGIN\t\t\t`date`"
562 @$(ECHO) "NSPR_TEST_LOGFILE\t$(LOGFILE)\n"
563 @$(ECHO) "Test\t\t\tResult\n"
564 @cd $(OBJDIR); for i in $(PROGRAMS); do \
565 $(ECHO) "$$i\c"; \
566 ./$$i >> $(LOGFILE) 2>&1 ; \
567 if [ 0 = $$? ] ; then \
568 $(ECHO) "\t\t\tPassed"; \
569 else \
570 $(ECHO) "\t\t\tFAILED"; \
571 fi; \
572 done
573 @$(ECHO) "\nEND\t\t`date`\n"