xref: /libuv/configure.ac (revision 94e467ad)
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
15AC_PREREQ(2.57)
16AC_INIT([libuv], [1.49.3-dev], [https://github.com/libuv/libuv/issues])
17AC_CONFIG_MACRO_DIR([m4])
18m4_include([m4/libuv-extra-automake-flags.m4])
19m4_include([m4/as_case.m4])
20m4_include([m4/libuv-check-flags.m4])
21AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects] UV_EXTRA_AUTOMAKE_FLAGS)
22AM_MAINTAINER_MODE([enable]) # pass --disable-maintainer-mode if autotools may be unavailable
23AC_CANONICAL_HOST
24AC_ENABLE_SHARED
25AC_ENABLE_STATIC
26AC_PROG_CC
27AM_PROG_CC_C_O
28
29CC_ATTRIBUTE_VISIBILITY([default], [
30  CC_FLAG_VISIBILITY([CFLAGS="${CFLAGS} -fvisibility=hidden"])
31])
32# Xlc has a flag "-f<filename>". Need to use CC_CHECK_FLAG_SUPPORTED_APPEND so
33# we exclude -fno-strict-aliasing for xlc
34CC_CHECK_FLAG_SUPPORTED_APPEND([-fno-strict-aliasing])
35CC_CHECK_CFLAGS_APPEND([-g])
36CC_CHECK_CFLAGS_APPEND([-std=gnu89])
37CC_CHECK_CFLAGS_APPEND([-Wall])
38CC_CHECK_CFLAGS_APPEND([-Wextra])
39CC_CHECK_CFLAGS_APPEND([-Wno-long-long])
40CC_CHECK_CFLAGS_APPEND([-Wno-unused-parameter])
41CC_CHECK_CFLAGS_APPEND([-Wstrict-prototypes])
42# AM_PROG_AR is not available in automake v0.11 but it's essential in v0.12.
43m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
44# autoconf complains if AC_PROG_LIBTOOL precedes AM_PROG_AR.
45AC_PROG_LIBTOOL
46m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
47LT_INIT
48AX_PTHREAD([
49    LIBS="$LIBS $PTHREAD_LIBS"
50    CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
51])
52AC_SEARCH_LIBS([dlopen], [dl])
53AC_SEARCH_LIBS([kstat_lookup], [kstat])
54AC_SEARCH_LIBS([gethostbyname], [nsl])
55AC_SEARCH_LIBS([perfstat_cpu], [perfstat])
56AC_SEARCH_LIBS([clock_gettime], [rt])
57AC_SEARCH_LIBS([sendfile], [sendfile])
58AC_SEARCH_LIBS([socket], [socket])
59AC_SYS_LARGEFILE
60AM_CONDITIONAL([AIX],      [AS_CASE([$host_os],[aix*],          [true], [false])])
61AM_CONDITIONAL([ANDROID],  [AS_CASE([$host_os],[linux-android*],[true], [false])])
62AM_CONDITIONAL([CYGWIN],   [AS_CASE([$host_os],[cygwin*],       [true], [false])])
63AM_CONDITIONAL([DARWIN],   [AS_CASE([$host_os],[darwin*],       [true], [false])])
64AM_CONDITIONAL([DRAGONFLY],[AS_CASE([$host_os],[dragonfly*],    [true], [false])])
65AM_CONDITIONAL([FREEBSD],  [AS_CASE([$host_os],[freebsd*],      [true], [false])])
66AM_CONDITIONAL([HAIKU],    [AS_CASE([$host_os],[haiku],         [true], [false])])
67AM_CONDITIONAL([HURD],     [AS_CASE([$host_os],[gnu*],          [true], [false])])
68AM_CONDITIONAL([LINUX],    [AS_CASE([$host_os],[linux*],        [true], [false])])
69AM_CONDITIONAL([MSYS],     [AS_CASE([$host_os],[msys*],         [true], [false])])
70AM_CONDITIONAL([NETBSD],   [AS_CASE([$host_os],[netbsd*],       [true], [false])])
71AM_CONDITIONAL([OPENBSD],  [AS_CASE([$host_os],[openbsd*],      [true], [false])])
72AM_CONDITIONAL([OS390],    [AS_CASE([$host_os],[openedition*],  [true], [false])])
73AM_CONDITIONAL([OS400],    [AS_CASE([$host_os],[os400],         [true], [false])])
74AM_CONDITIONAL([SUNOS],    [AS_CASE([$host_os],[solaris*],      [true], [false])])
75AM_CONDITIONAL([WINNT],    [AS_CASE([$host_os],[mingw*],        [true], [false])])
76AS_CASE([$host_os],[mingw*], [
77    LIBS="$LIBS -lws2_32 -lpsapi -liphlpapi -luserenv -luser32 -ldbghelp -lole32 -lshell32"
78])
79AS_CASE([$host_os], [solaris2.10], [
80    CFLAGS="$CFLAGS -DSUNOS_NO_IFADDRS"
81])
82AS_CASE([$host_os], [netbsd*], [AC_CHECK_LIB([kvm], [kvm_open])])
83AS_CASE([$host_os], [haiku], [
84    LIBS="$LIBS -lnetwork"
85])
86AC_CHECK_HEADERS([sys/ahafs_evProds.h])
87AC_CONFIG_FILES([Makefile libuv.pc])
88AC_CONFIG_LINKS([test/fixtures/empty_file:test/fixtures/empty_file])
89AC_CONFIG_LINKS([test/fixtures/load_error.node:test/fixtures/load_error.node])
90AC_CONFIG_LINKS([test/fixtures/lorem_ipsum.txt:test/fixtures/lorem_ipsum.txt])
91AC_CONFIG_LINKS([test/fixtures/one_file/one_file:test/fixtures/one_file/one_file])
92AC_OUTPUT
93