Skip to content
Newer
Older
100644 155 lines (136 sloc) 4.29 KB
3ca2e51 Initial commit
Manju Rajashekhar authored Feb 22, 2012
1 # Define the package version numbers and the bug reporting address
2 m4_define([NC_MAJOR], 0)
3 m4_define([NC_MINOR], 1)
480cc67 version 0.1.19 release
Manju Rajashekhar authored Jul 31, 2012
4 m4_define([NC_PATCH], 19)
3ca2e51 Initial commit
Manju Rajashekhar authored Feb 22, 2012
5 m4_define([NC_BUGS], [manj@twitter.com])
6
7 # Initialize autoconf
8 AC_PREREQ([2.64])
9 AC_INIT([nutcracker], [NC_MAJOR.NC_MINOR.NC_PATCH], [NC_BUGS])
10 AC_CONFIG_SRCDIR([src/nc.c])
11 AC_CONFIG_AUX_DIR([config])
12 AC_CONFIG_HEADERS([config.h:config.h.in])
13 AC_CONFIG_MACRO_DIR([m4])
14
15 # Initialize automake
16 AM_INIT_AUTOMAKE([1.9 foreign])
17
18 # Define macro variables for the package version numbers
19 AC_DEFINE(NC_VERSION_MAJOR, NC_MAJOR, [Define the major version number])
20 AC_DEFINE(NC_VERSION_MINOR, NC_MINOR, [Define the minor version number])
21 AC_DEFINE(NC_VERSION_PATCH, NC_PATCH, [Define the patch version number])
22 AC_DEFINE(NC_VERSION_STRING, "NC_MAJOR.NC_MINOR.NC_PATCH", [Define the version string])
23
24 # Checks for language
25 AC_LANG([C])
26
27 # Checks for programs
28 AC_PROG_AWK
29 AC_PROG_CC
30 AC_PROG_CPP
31 AC_PROG_CXX
32 AC_PROG_INSTALL
33 AC_PROG_LN_S
34 AC_PROG_MAKE_SET
35 AC_PROG_RANLIB
36 AC_PROG_LIBTOOL
37
38 # Checks for typedefs, structures, and compiler characteristics
39 AC_C_INLINE
40 AC_TYPE_INT8_T
41 AC_TYPE_INT16_T
42 AC_TYPE_INT32_T
43 AC_TYPE_INT64_T
44 AC_TYPE_INTMAX_T
45 AC_TYPE_INTPTR_T
46 AC_TYPE_UINT8_T
47 AC_TYPE_UINT16_T
48 AC_TYPE_UINT32_T
49 AC_TYPE_UINT64_T
50 AC_TYPE_UINTMAX_T
51 AC_TYPE_UINTPTR_T
52 AC_TYPE_OFF_T
53 AC_TYPE_PID_T
54 AC_TYPE_SIZE_T
55 AC_TYPE_SSIZE_T
56
57 AC_C_BIGENDIAN(
58 [],
59 [AC_DEFINE(HAVE_LITTLE_ENDIAN, 1, [Define to 1 if machine is little endian])],
60 [AC_MSG_ERROR([endianess of this machine is unknown])],
61 [AC_MSG_ERROR([universial endianess not supported])]
62 )
63
64 # Checks for header files
65 AC_HEADER_STDBOOL
66 AC_CHECK_HEADERS([fcntl.h float.h limits.h stddef.h stdlib.h string.h unistd.h])
67 AC_CHECK_HEADERS([inttypes.h stdint.h])
68 AC_CHECK_HEADERS([sys/ioctl.h sys/time.h sys/uio.h])
69 AC_CHECK_HEADERS([sys/socket.h sys/un.h netinet/in.h arpa/inet.h netdb.h])
70 AC_CHECK_HEADERS([sys/epoll.h], [], [AC_MSG_ERROR([required sys/epoll.h header file is missing])])
71
72 # Checks for libraries
73 AC_CHECK_LIB([m], [pow])
74 AC_CHECK_LIB([pthread], [pthread_create])
75
76 # Checks for library functions
77 AC_FUNC_FORK
78 AC_FUNC_MALLOC
79 AC_FUNC_REALLOC
80 AC_CHECK_FUNCS([dup2 gethostname gettimeofday strerror])
81 AC_CHECK_FUNCS([socket])
82 AC_CHECK_FUNCS([memchr memmove memset])
83 AC_CHECK_FUNCS([strchr strndup strtoul])
84
85 AC_CACHE_CHECK([if epoll works], [ac_cv_epoll_works],
86 AC_TRY_RUN([
87 #include <stdio.h>
88 #include <stdlib.h>
89 #include <sys/epoll.h>
90 int
91 main(int argc, char **argv)
92 {
93 int fd;
94
95 fd = epoll_create(256);
96 if (fd < 0) {
97 perror("epoll_create:");
98 exit(1);
99 }
100 exit(0);
101 }
102 ], [ac_cv_epoll_works=yes], [ac_cv_epoll_works=no]))
103 AS_IF([test "x$ac_cv_epoll_works" = "xyes"], [], [AC_MSG_FAILURE([Linux epoll(7) API is missing])])
104
105 # Package options
106 AC_MSG_CHECKING([whether to enable debug logs and asserts])
107 AC_ARG_ENABLE([debug],
108 [AS_HELP_STRING(
109 [--enable-debug=@<:@full|yes|log|no@:>@],
110 [enable debug logs and asserts @<:@default=no@:>@])
111 ],
112 [],
113 [enable_debug=no])
114 AS_CASE([x$enable_debug],
115 [xfull], [AC_DEFINE([HAVE_ASSERT_PANIC], [1],
116 [Define to 1 if panic on an assert is enabled])
117 AC_DEFINE([HAVE_DEBUG_LOG], [1], [Define to 1 if debug log is enabled])
118 ],
119 [xyes], [AC_DEFINE([HAVE_ASSERT_LOG], [1],
120 [Define to 1 if log on an assert is enabled])
121 AC_DEFINE([HAVE_DEBUG_LOG], [1], [Define to 1 if debug log is enabled])
122 ],
123 [xlog], [AC_DEFINE([HAVE_DEBUG_LOG], [1], [Define to 1 if debug log is enabled])],
124 [xno], [],
125 [AC_MSG_FAILURE([invalid value ${enable_debug} for --enable-debug])])
126 AC_MSG_RESULT($enable_debug)
127
128 AC_MSG_CHECKING([whether to disable stats])
129 AC_ARG_ENABLE([stats],
130 [AS_HELP_STRING(
131 [--disable-stats],
132 [disable stats])
133 ],
134 [disable_stats=yes],
135 [disable_stats=no])
136 AS_IF([test "x$disable_stats" = xyes],
137 [],
138 [AC_DEFINE([HAVE_STATS], [1], [Define to 1 if stats is not disabled])])
139 AC_MSG_RESULT($disable_stats)
140
141 # Untar the yaml-0.1.4 in contrib/ before config.status is rerun
142 AC_CONFIG_COMMANDS_PRE([tar xvfz contrib/yaml-0.1.4.tar.gz -C contrib])
143
144 # Call yaml-0.1.4 ./configure recursively
145 AC_CONFIG_SUBDIRS([contrib/yaml-0.1.4])
146
147 # Define Makefiles
148 AC_CONFIG_FILES([Makefile
149 contrib/Makefile
150 src/Makefile
151 src/hashkit/Makefile])
152
153 # Generate the "configure" script
154 AC_OUTPUT
Something went wrong with that request. Please try again.