• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2013, Ben Noordhuis <info@bnoordhuis.nl>
2#
3# Permission to use, copy, modify, and/or distribute this software for any
4# purpose with or without fee is hereby granted, provided that the above
5# copyright notice and this permission notice appear in all copies.
6#
7# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
15ACLOCAL_AMFLAGS = -I m4
16
17AM_CPPFLAGS = -I$(top_srcdir)/include \
18              -I$(top_srcdir)/src
19
20include_HEADERS=include/uv.h
21
22uvincludedir = $(includedir)/uv
23uvinclude_HEADERS = include/uv/errno.h \
24                    include/uv/threadpool.h \
25                    include/uv/version.h
26
27CLEANFILES =
28
29lib_LTLIBRARIES = libuv.la
30libuv_la_CFLAGS = $(AM_CFLAGS)
31libuv_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined -version-info 1:0:0
32libuv_la_SOURCES = src/fs-poll.c \
33                   src/heap-inl.h \
34                   src/idna.c \
35                   src/idna.h \
36                   src/inet.c \
37                   src/queue.h \
38                   src/random.c \
39                   src/strscpy.c \
40                   src/strscpy.h \
41                   src/threadpool.c \
42                   src/timer.c \
43                   src/uv-data-getter-setters.c \
44                   src/uv-common.c \
45                   src/uv-common.h \
46                   src/version.c \
47                   src/strtok.c \
48                   src/strtok.h
49
50if SUNOS
51# Can't be turned into a CC_CHECK_CFLAGS in configure.ac, it makes compilers
52# on other platforms complain that the argument is unused during compilation.
53libuv_la_CFLAGS += -pthreads
54endif
55
56if WINNT
57
58uvinclude_HEADERS += include/uv/win.h include/uv/tree.h
59AM_CPPFLAGS += -I$(top_srcdir)/src/win \
60               -DWIN32_LEAN_AND_MEAN \
61               -D_WIN32_WINNT=0x0602
62libuv_la_SOURCES += src/win/async.c \
63                    src/win/atomicops-inl.h \
64                    src/win/core.c \
65                    src/win/detect-wakeup.c \
66                    src/win/dl.c \
67                    src/win/error.c \
68                    src/win/fs-event.c \
69                    src/win/fs.c \
70                    src/win/getaddrinfo.c \
71                    src/win/getnameinfo.c \
72                    src/win/handle.c \
73                    src/win/handle-inl.h \
74                    src/win/internal.h \
75                    src/win/loop-watcher.c \
76                    src/win/pipe.c \
77                    src/win/poll.c \
78                    src/win/process-stdio.c \
79                    src/win/process.c \
80                    src/win/req-inl.h \
81                    src/win/signal.c \
82                    src/win/stream.c \
83                    src/win/stream-inl.h \
84                    src/win/tcp.c \
85                    src/win/thread.c \
86                    src/win/tty.c \
87                    src/win/udp.c \
88                    src/win/util.c \
89                    src/win/winapi.c \
90                    src/win/winapi.h \
91                    src/win/winsock.c \
92                    src/win/winsock.h
93
94else  # WINNT
95
96uvinclude_HEADERS += include/uv/unix.h
97AM_CPPFLAGS += -I$(top_srcdir)/src/unix
98libuv_la_SOURCES += src/unix/async.c \
99                   src/unix/atomic-ops.h \
100                   src/unix/core.c \
101                   src/unix/dl.c \
102                   src/unix/fs.c \
103                   src/unix/getaddrinfo.c \
104                   src/unix/getnameinfo.c \
105                   src/unix/internal.h \
106                   src/unix/loop-watcher.c \
107                   src/unix/loop.c \
108                   src/unix/pipe.c \
109                   src/unix/poll.c \
110                   src/unix/process.c \
111                   src/unix/random-devurandom.c \
112                   src/unix/signal.c \
113                   src/unix/spinlock.h \
114                   src/unix/stream.c \
115                   src/unix/tcp.c \
116                   src/unix/thread.c \
117                   src/unix/tty.c \
118                   src/unix/udp.c
119
120endif  # WINNT
121
122EXTRA_DIST = test/fixtures/empty_file \
123             test/fixtures/load_error.node \
124             test/fixtures/lorem_ipsum.txt \
125             include \
126             docs \
127             img \
128             CONTRIBUTING.md \
129             LICENSE \
130             README.md
131
132
133
134TESTS = test/run-tests
135check_PROGRAMS = test/run-tests
136test_run_tests_CFLAGS = $(AM_CFLAGS)
137
138if SUNOS
139# Can't be turned into a CC_CHECK_CFLAGS in configure.ac, it makes compilers
140# on other platforms complain that the argument is unused during compilation.
141test_run_tests_CFLAGS += -pthreads
142endif
143
144test_run_tests_LDFLAGS = $(AM_LDFLAGS)
145test_run_tests_SOURCES = test/blackhole-server.c \
146                         test/echo-server.c \
147                         test/run-tests.c \
148                         test/runner.c \
149                         test/runner.h \
150                         test/task.h \
151                         test/test-active.c \
152                         test/test-async.c \
153                         test/test-async-null-cb.c \
154                         test/test-barrier.c \
155                         test/test-callback-stack.c \
156                         test/test-close-fd.c \
157                         test/test-close-order.c \
158                         test/test-condvar.c \
159                         test/test-connect-unspecified.c \
160                         test/test-connection-fail.c \
161                         test/test-cwd-and-chdir.c \
162                         test/test-default-loop-close.c \
163                         test/test-delayed-accept.c \
164                         test/test-dlerror.c \
165                         test/test-eintr-handling.c \
166                         test/test-embed.c \
167                         test/test-emfile.c \
168                         test/test-env-vars.c \
169                         test/test-error.c \
170                         test/test-fail-always.c \
171                         test/test-fs-copyfile.c \
172                         test/test-fs-event.c \
173                         test/test-fs-poll.c \
174                         test/test-fs.c \
175                         test/test-fs-readdir.c \
176                         test/test-fs-fd-hash.c \
177                         test/test-fs-open-flags.c \
178                         test/test-fork.c \
179                         test/test-getters-setters.c \
180                         test/test-get-currentexe.c \
181                         test/test-get-loadavg.c \
182                         test/test-get-memory.c \
183                         test/test-get-passwd.c \
184                         test/test-getaddrinfo.c \
185                         test/test-gethostname.c \
186                         test/test-getnameinfo.c \
187                         test/test-getsockname.c \
188                         test/test-gettimeofday.c \
189                         test/test-handle-fileno.c \
190                         test/test-homedir.c \
191                         test/test-hrtime.c \
192                         test/test-idle.c \
193                         test/test-idna.c \
194                         test/test-ip4-addr.c \
195                         test/test-ip6-addr.c \
196                         test/test-ip-name.c \
197                         test/test-ipc-heavy-traffic-deadlock-bug.c \
198                         test/test-ipc-send-recv.c \
199                         test/test-ipc.c \
200                         test/test-list.h \
201                         test/test-loop-handles.c \
202                         test/test-loop-alive.c \
203                         test/test-loop-close.c \
204                         test/test-loop-stop.c \
205                         test/test-loop-time.c \
206                         test/test-loop-configure.c \
207                         test/test-metrics.c \
208                         test/test-multiple-listen.c \
209                         test/test-mutexes.c \
210                         test/test-not-readable-nor-writable-on-read-error.c \
211                         test/test-not-writable-after-shutdown.c \
212                         test/test-osx-select.c \
213                         test/test-pass-always.c \
214                         test/test-ping-pong.c \
215                         test/test-pipe-bind-error.c \
216                         test/test-pipe-connect-error.c \
217                         test/test-pipe-connect-multiple.c \
218                         test/test-pipe-connect-prepare.c \
219                         test/test-pipe-getsockname.c \
220                         test/test-pipe-pending-instances.c \
221                         test/test-pipe-sendmsg.c \
222                         test/test-pipe-server-close.c \
223                         test/test-pipe-close-stdout-read-stdin.c \
224                         test/test-pipe-set-non-blocking.c \
225                         test/test-pipe-set-fchmod.c \
226                         test/test-platform-output.c \
227                         test/test-poll.c \
228                         test/test-poll-close.c \
229                         test/test-poll-close-doesnt-corrupt-stack.c \
230                         test/test-poll-closesocket.c \
231                         test/test-poll-multiple-handles.c \
232                         test/test-poll-oob.c \
233                         test/test-process-priority.c \
234                         test/test-process-title.c \
235                         test/test-process-title-threadsafe.c \
236                         test/test-queue-foreach-delete.c \
237                         test/test-random.c \
238                         test/test-readable-on-eof.c \
239                         test/test-ref.c \
240                         test/test-run-nowait.c \
241                         test/test-run-once.c \
242                         test/test-semaphore.c \
243                         test/test-shutdown-close.c \
244                         test/test-shutdown-eof.c \
245                         test/test-shutdown-simultaneous.c \
246                         test/test-shutdown-twice.c \
247                         test/test-signal-multiple-loops.c \
248                         test/test-signal-pending-on-close.c \
249                         test/test-signal.c \
250                         test/test-socket-buffer-size.c \
251                         test/test-spawn.c \
252                         test/test-stdio-over-pipes.c \
253                         test/test-strscpy.c \
254                         test/test-strtok.c \
255                         test/test-tcp-alloc-cb-fail.c \
256                         test/test-tcp-bind-error.c \
257                         test/test-tcp-bind6-error.c \
258                         test/test-tcp-close-accept.c \
259                         test/test-tcp-close-while-connecting.c \
260                         test/test-tcp-close-after-read-timeout.c \
261                         test/test-tcp-close.c \
262                         test/test-tcp-close-reset.c \
263                         test/test-tcp-create-socket-early.c \
264                         test/test-tcp-connect-error-after-write.c \
265                         test/test-tcp-connect-error.c \
266                         test/test-tcp-connect-timeout.c \
267                         test/test-tcp-connect6-error.c \
268                         test/test-tcp-flags.c \
269                         test/test-tcp-open.c \
270                         test/test-tcp-read-stop.c \
271                         test/test-tcp-read-stop-start.c \
272                         test/test-tcp-rst.c \
273                         test/test-tcp-shutdown-after-write.c \
274                         test/test-tcp-unexpected-read.c \
275                         test/test-tcp-oob.c \
276                         test/test-tcp-write-to-half-open-connection.c \
277                         test/test-tcp-write-after-connect.c \
278                         test/test-tcp-writealot.c \
279                         test/test-tcp-write-fail.c \
280                         test/test-tcp-try-write.c \
281                         test/test-tcp-try-write-error.c \
282                         test/test-tcp-write-queue-order.c \
283                         test/test-test-macros.c \
284                         test/test-thread-equal.c \
285                         test/test-thread.c \
286                         test/test-threadpool-cancel.c \
287                         test/test-threadpool.c \
288                         test/test-timer-again.c \
289                         test/test-timer-from-check.c \
290                         test/test-timer.c \
291                         test/test-tmpdir.c \
292                         test/test-tty-duplicate-key.c \
293                         test/test-tty-escape-sequence-processing.c \
294                         test/test-tty.c \
295                         test/test-udp-alloc-cb-fail.c \
296                         test/test-udp-bind.c \
297                         test/test-udp-connect.c \
298                         test/test-udp-connect6.c \
299                         test/test-udp-create-socket-early.c \
300                         test/test-udp-dgram-too-big.c \
301                         test/test-udp-ipv6.c \
302                         test/test-udp-mmsg.c \
303                         test/test-udp-multicast-interface.c \
304                         test/test-udp-multicast-interface6.c \
305                         test/test-udp-multicast-join.c \
306                         test/test-udp-multicast-join6.c \
307                         test/test-udp-multicast-ttl.c \
308                         test/test-udp-open.c \
309                         test/test-udp-options.c \
310                         test/test-udp-send-and-recv.c \
311                         test/test-udp-send-hang-loop.c \
312                         test/test-udp-send-immediate.c \
313                         test/test-udp-sendmmsg-error.c \
314                         test/test-udp-send-unreachable.c \
315                         test/test-udp-try-send.c \
316                         test/test-uname.c \
317                         test/test-walk-handles.c \
318                         test/test-watcher-cross-stop.c
319test_run_tests_LDADD = libuv.la
320
321if WINNT
322test_run_tests_SOURCES += test/runner-win.c \
323                          test/runner-win.h
324else
325test_run_tests_SOURCES += test/runner-unix.c \
326                          test/runner-unix.h
327endif
328
329if AIX
330test_run_tests_CFLAGS += -D_ALL_SOURCE \
331                         -D_XOPEN_SOURCE=500 \
332                         -D_LINUX_SOURCE_COMPAT
333endif
334
335if OS400
336test_run_tests_CFLAGS += -D_ALL_SOURCE \
337                         -D_XOPEN_SOURCE=500 \
338                         -D_LINUX_SOURCE_COMPAT
339endif
340
341if HAIKU
342test_run_tests_CFLAGS += -D_BSD_SOURCE
343endif
344
345if LINUX
346test_run_tests_CFLAGS += -D_GNU_SOURCE
347endif
348
349if SUNOS
350test_run_tests_CFLAGS += -D__EXTENSIONS__ \
351                         -D_XOPEN_SOURCE=500 \
352                         -D_REENTRANT
353endif
354
355if OS390
356test_run_tests_CFLAGS += -D_ISOC99_SOURCE \
357                         -D_UNIX03_THREADS \
358                         -D_UNIX03_SOURCE \
359                         -D_OPEN_SYS_IF_EXT=1 \
360                         -D_OPEN_SYS_SOCK_IPV6 \
361                         -D_OPEN_MSGQ_EXT \
362                         -D_XOPEN_SOURCE_EXTENDED \
363                         -D_ALL_SOURCE \
364                         -D_LARGE_TIME_API \
365                         -D_OPEN_SYS_FILE_EXT \
366                         -DPATH_MAX=255 \
367                         -qCHARS=signed \
368                         -qXPLINK \
369                         -qFLOAT=IEEE
370endif
371
372if AIX
373libuv_la_CFLAGS += -D_ALL_SOURCE \
374                   -D_XOPEN_SOURCE=500 \
375                   -D_LINUX_SOURCE_COMPAT \
376                   -D_THREAD_SAFE \
377                   -DHAVE_SYS_AHAFS_EVPRODS_H
378uvinclude_HEADERS += include/uv/aix.h
379libuv_la_SOURCES += src/unix/aix.c src/unix/aix-common.c
380endif
381
382if OS400
383libuv_la_CFLAGS += -D_ALL_SOURCE \
384                   -D_XOPEN_SOURCE=500 \
385                   -D_LINUX_SOURCE_COMPAT \
386                   -D_THREAD_SAFE
387uvinclude_HEADERS += include/uv/posix.h
388libuv_la_SOURCES += src/unix/aix-common.c \
389                    src/unix/ibmi.c \
390                    src/unix/posix-poll.c \
391                    src/unix/no-fsevents.c
392endif
393
394if ANDROID
395libuv_la_CFLAGS += -D_GNU_SOURCE
396libuv_la_SOURCES += src/unix/pthread-fixes.c
397endif
398
399if CYGWIN
400uvinclude_HEADERS += include/uv/posix.h
401libuv_la_CFLAGS += -D_GNU_SOURCE
402libuv_la_SOURCES += src/unix/cygwin.c \
403                    src/unix/bsd-ifaddrs.c \
404                    src/unix/no-fsevents.c \
405                    src/unix/no-proctitle.c \
406                    src/unix/posix-hrtime.c \
407                    src/unix/posix-poll.c \
408                    src/unix/procfs-exepath.c \
409                    src/unix/sysinfo-loadavg.c \
410                    src/unix/sysinfo-memory.c
411endif
412
413if DARWIN
414uvinclude_HEADERS += include/uv/darwin.h
415libuv_la_CFLAGS += -D_DARWIN_USE_64_BIT_INODE=1
416libuv_la_CFLAGS += -D_DARWIN_UNLIMITED_SELECT=1
417libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \
418                    src/unix/darwin-proctitle.c \
419                    src/unix/darwin-stub.h \
420                    src/unix/darwin.c \
421                    src/unix/fsevents.c \
422                    src/unix/kqueue.c \
423                    src/unix/proctitle.c \
424                    src/unix/random-getentropy.c
425test_run_tests_LDFLAGS += -lutil
426endif
427
428if DRAGONFLY
429uvinclude_HEADERS += include/uv/bsd.h
430libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \
431                    src/unix/bsd-proctitle.c \
432                    src/unix/freebsd.c \
433                    src/unix/kqueue.c \
434                    src/unix/posix-hrtime.c
435test_run_tests_LDFLAGS += -lutil
436endif
437
438if FREEBSD
439uvinclude_HEADERS += include/uv/bsd.h
440libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \
441                    src/unix/bsd-proctitle.c \
442                    src/unix/freebsd.c \
443                    src/unix/kqueue.c \
444                    src/unix/posix-hrtime.c \
445                    src/unix/random-getrandom.c
446test_run_tests_LDFLAGS += -lutil
447endif
448
449if HAIKU
450uvinclude_HEADERS += include/uv/posix.h
451libuv_la_CFLAGS += -D_BSD_SOURCE
452libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \
453                    src/unix/haiku.c \
454                    src/unix/no-fsevents.c \
455                    src/unix/no-proctitle.c \
456                    src/unix/posix-hrtime.c \
457                    src/unix/posix-poll.c
458endif
459
460if HURD
461uvinclude_HEADERS += include/uv/posix.h
462libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \
463                    src/unix/no-fsevents.c \
464                    src/unix/no-proctitle.c \
465                    src/unix/posix-hrtime.c \
466                    src/unix/posix-poll.c \
467                    src/unix/hurd.c
468endif
469
470if KFREEBSD
471libuv_la_CFLAGS += -D_GNU_SOURCE
472endif
473
474if LINUX
475uvinclude_HEADERS += include/uv/linux.h
476libuv_la_CFLAGS += -D_GNU_SOURCE
477libuv_la_SOURCES += src/unix/linux-core.c \
478                    src/unix/linux-inotify.c \
479                    src/unix/linux-syscalls.c \
480                    src/unix/linux-syscalls.h \
481                    src/unix/procfs-exepath.c \
482                    src/unix/proctitle.c \
483                    src/unix/random-getrandom.c \
484                    src/unix/random-sysctl-linux.c \
485                    src/unix/epoll.c
486test_run_tests_LDFLAGS += -lutil
487endif
488
489if MSYS
490libuv_la_CFLAGS += -D_GNU_SOURCE
491libuv_la_SOURCES += src/unix/cygwin.c \
492                    src/unix/bsd-ifaddrs.c \
493                    src/unix/no-fsevents.c \
494                    src/unix/no-proctitle.c \
495                    src/unix/posix-hrtime.c \
496                    src/unix/posix-poll.c \
497                    src/unix/procfs-exepath.c \
498                    src/unix/sysinfo-loadavg.c \
499                    src/unix/sysinfo-memory.c
500endif
501
502if NETBSD
503uvinclude_HEADERS += include/uv/bsd.h
504libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \
505                    src/unix/bsd-proctitle.c \
506                    src/unix/kqueue.c \
507                    src/unix/netbsd.c \
508                    src/unix/posix-hrtime.c
509test_run_tests_LDFLAGS += -lutil
510endif
511
512if OPENBSD
513uvinclude_HEADERS += include/uv/bsd.h
514libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \
515                    src/unix/bsd-proctitle.c \
516                    src/unix/kqueue.c \
517                    src/unix/openbsd.c \
518                    src/unix/posix-hrtime.c \
519                    src/unix/random-getentropy.c
520test_run_tests_LDFLAGS += -lutil
521endif
522
523if SUNOS
524uvinclude_HEADERS += include/uv/sunos.h
525libuv_la_CFLAGS += -D__EXTENSIONS__ \
526                   -D_XOPEN_SOURCE=500 \
527                   -D_REENTRANT
528libuv_la_SOURCES += src/unix/no-proctitle.c \
529                    src/unix/sunos.c
530endif
531
532if OS390
533libuv_la_CFLAGS += -D_UNIX03_THREADS \
534                   -D_UNIX03_SOURCE \
535                   -D_OPEN_SYS_IF_EXT=1 \
536                   -D_OPEN_MSGQ_EXT \
537                   -D_XOPEN_SOURCE_EXTENDED \
538                   -D_ALL_SOURCE \
539                   -D_LARGE_TIME_API \
540                   -D_OPEN_SYS_SOCK_EXT3 \
541                   -D_OPEN_SYS_SOCK_IPV6 \
542                   -D_OPEN_SYS_FILE_EXT \
543                   -DUV_PLATFORM_SEM_T=int \
544                   -DPATH_MAX=255 \
545                   -qCHARS=signed \
546                   -qXPLINK \
547                   -qFLOAT=IEEE
548libuv_la_LDFLAGS += -qXPLINK
549libuv_la_SOURCES += src/unix/pthread-fixes.c \
550                    src/unix/os390.c \
551                    src/unix/os390-syscalls.c \
552                    src/unix/proctitle.c
553endif
554
555pkgconfigdir = $(libdir)/pkgconfig
556pkgconfig_DATA = @PACKAGE_NAME@.pc
557