ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/vendor/libpeak-0.1.2/configure.ac
Revision: 3251
Committed: Wed Apr 2 16:58:30 2014 UTC (9 years, 11 months ago) by michael
Content type: application/pkix-attr-cert
File size: 10852 byte(s)
Log Message:
- Imported libpeak-0.1.2

File Contents

# Content
1 dnl Prefered emacs editing mode: -*- Autoconf -*-
2 dnl
3 dnl Process this file with autoconf to produce a configure script.
4 dnl
5 dnl Copyright (c) 2003, 2004, 2005, 2006, 2007
6 dnl Stephane Thiell <mbuna@bugged.org>. All rights reserved.
7 dnl
8 dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
9 dnl "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
10 dnl TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
11 dnl PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
12 dnl CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
13 dnl EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
14 dnl PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
15 dnl OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
16 dnl WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
17 dnl OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
18 dnl ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19 dnl
20 dnl $Id: configure.ac,v 1.14 2007/05/24 13:26:43 mbuna Exp $
21
22 AC_INIT([PEAK Library], 0.1.2, [mbuna@bugged.org], [libpeak])
23 AC_CONFIG_SRCDIR([peak/peak.h])
24 AC_CANONICAL_HOST
25 AM_INIT_AUTOMAKE
26 AM_CONFIG_HEADER([config.h])
27 AM_MAINTAINER_MODE
28
29 dnl Assume GCC compatibility.
30 cflags='-O2 -g -Wall'
31 default_includes=' -I. -I$(srcdir) -I$(top_builddir)'
32 includes='-I- -I$(top_builddir)'
33
34 case "$host" in
35 *-*-aix*)
36 if test -z "$CC"; then
37 AC_CHECK_PROGS(CC, [cc_r xlc_r gcc cc])
38 fi
39 if test "$CC" = "cc_r" -o "$CC" = "xlc_r"; then
40 cflags='-O3 -qthreaded -qwarn64'
41 default_includes='-I$(top_builddir)'
42 includes=
43 elif test "$CC" = gcc; then
44 AC_MSG_WARN([GCC not recommended on AIX])
45 else
46 AC_MSG_WARN([cc_r on AIX not found; threads wont work!])
47 default_includes='-I$(top_builddir)'
48 includes=
49 fi
50 ;;
51
52 *-*-netbsd*)
53 includes='-I- -I/usr/pkg/include -I$(top_builddir)'
54 PTHREAD_CFLAGS='-I/usr/pkg/include'
55 PTHREAD_LIBS='-L/usr/pkg/lib -lpthread'
56 ;;
57
58 powerpc-*-darwin*)
59 dnl We support the PowerPC IBM compiler on Darwin.
60 if test -z "$CC"; then
61 AC_CHECK_PROGS(CC, [gcc cc_r cc])
62 fi
63 if test "$CC" = "cc_r" -o "$CC" = "xlc_r"; then
64 cflags='-O3 -qthreaded -qtune=auto'
65 default_includes='-I$(top_builddir)'
66 includes='-I$(ARCH_INCLUDES)'
67 fi
68 ;;
69
70 *)
71 ;;
72 esac
73 CFLAGS=$cflags
74 AC_SUBST(default_includes)
75 AC_SUBST(includes)
76
77 dnl Check for asm includes
78 AC_PROG_LN_S
79 AC_MSG_CHECKING(for architecture-dependent code)
80 arch=unknown
81 case "$host" in
82 powerpc-*)
83 arch=powerpc
84 ;;
85
86 i*86-* | x86-* | x86_64-*)
87 arch=x86
88 ;;
89
90 m68k-*)
91 arch=m68k
92 ;;
93
94 sparc-*)
95 arch=sparc
96 ;;
97
98 ia64-*)
99 arch=ia64
100 ;;
101
102 *)
103 AC_MSG_RESULT([failed!])
104 AC_MSG_ERROR([libpeak is not available for your architecture yet,
105 please submit a feature request for:
106 ${host}])
107 ;;
108 esac
109 AC_CONFIG_LINKS([peak/atomic.h:peak/arch/${arch}/atomic.h
110 peak/spinlock.h:peak/arch/${arch}/spinlock.h])
111 AC_MSG_RESULT([peak/arch/${arch} will be used.])
112
113 AC_SUBST_FILE([atomic_header])
114 atomic_header="peak/atomic.h"
115
116 dnl Initialize libtool
117 AM_PROG_LIBTOOL
118
119 dnl Checks for programs.
120 AC_PROG_CC
121 AC_PROG_MAKE_SET
122 ACX_PTHREAD
123 LIBS="$PTHREAD_CFLAGS $PTHREAD_LIBS $LIBS"
124 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
125 CC="$PTHREAD_CC"
126
127 dnl Checks for header files.
128 AC_HEADER_STDC
129 AC_CHECK_HEADERS([pthread.h sched.h mach/mach_init.h mach/mach.h])
130 AC_CHECK_HEADERS([mach/semaphore.h mach/task.h signal.h sys/signal.h])
131 AC_CHECK_HEADERS([machine/hal_sysinfo.h sys/atomic_op.h])
132 AC_CHECK_HEADERS([poll.h sys/poll.h sys/devpoll.h sys/epoll.h sys/event.h])
133 AC_CHECK_HEADERS([sys/mpctl.h sys/sysctl.h sys/sysinfo.h])
134 AC_CREATE_STDINT_H([peak/stdint.h])
135
136 dnl Checks for typedefs, structures, and compiler characteristics.
137 AC_C_INLINE
138 AC_TYPE_SIZE_T
139 AC_HEADER_TIME
140 AC_STRUCT_TM
141 ACX_STRUCT_TZHEAD
142 ACX_FD_SETSIZE
143
144 dnl Checks for library functions.
145 AC_PROG_GCC_TRADITIONAL
146 AC_FUNC_ALLOCA
147 AC_FUNC_SELECT_ARGTYPES
148
149 dnl Do all the checks necessary to figure out -lnsl / -lsocket stuff
150 AC_LIBRARY_NET
151
152 AC_CHECK_FUNCS([gettimeofday memset strerror])
153 AC_CHECK_FUNCS([getpagesize getsysinfo mpctl sysconf sysctl])
154 AC_CHECK_FUNCS([epoll_create poll kqueue getrlimit getrusage setrlimit])
155 AC_CHECK_FUNCS([semaphore_create semaphore_signal])
156 AC_CHECK_FUNCS([_spin_lock _spin_lock_try _spin_unlock])
157 AC_SEARCH_LIBS([sched_yield], [rt posix4])
158
159 dnl Now choose the engine
160 AC_MSG_CHECKING([for event engine module type])
161 AC_ARG_WITH([engine],
162 [ --with-engine=ENGINE Force event engine module type [[automatic]]],
163 [peak_engine=$with_engine])
164 if test -z "$peak_engine" -o x"$peak_engine" = xno; then
165 if test x"$ac_cv_header_sys_event_h" = xyes -a x"$ac_cv_func_kqueue" = xyes; then
166 peak_engine=kqueue
167 elif test x"$ac_cv_header_sys_epoll_h" = xyes; then
168 peak_engine=epoll
169 elif test x"$ac_cv_header_sys_devpoll_h" = xyes; then
170 case "$host" in
171 *-*-linux*) dnl Do not use devpoll on Linux.
172 peak_engine=poll
173 ;;
174 *)
175 peak_engine=devpoll
176 ;;
177 esac
178 elif test x"$ac_cv_header_poll_h" = xyes; then
179 peak_engine=poll
180 else
181 peak_engine=select
182 fi
183 fi
184 case "$peak_engine" in
185 devpoll)
186 AC_LIBOBJ([engine_mod_devpoll])
187 AC_DEFINE_UNQUOTED(PEAK_ENGINE_DEVPOLL, 1, [Use engine devpoll.])
188 ;;
189 epoll)
190 AC_LIBOBJ([engine_mod_epoll])
191 AC_DEFINE_UNQUOTED(PEAK_ENGINE_EPOLL, 1, [Use engine epoll.])
192 ;;
193 kqueue)
194 AC_LIBOBJ([engine_mod_kqueue])
195 AC_DEFINE_UNQUOTED(PEAK_ENGINE_KQUEUE, 1, [Use engine kqueue.])
196 ;;
197 poll)
198 AC_LIBOBJ([engine_mod_poll])
199 AC_DEFINE_UNQUOTED(PEAK_ENGINE_POLL, 1, [Use engine poll.])
200 ;;
201 select)
202 AC_DEFINE_UNQUOTED(PEAK_ENGINE_SELECT, 1, [Use engine select.])
203 AC_LIBOBJ([engine_mod_select])
204 ;;
205 *)
206 AC_MSG_ERROR([Unable to find requested engine module type])
207 ;;
208 esac
209 AC_MSG_RESULT([$peak_engine])
210
211
212 dnl Now check for --enable-profile
213 AC_MSG_CHECKING([whether to enable profiling support (gprof)])
214 AC_ARG_ENABLE([profile],
215 [ --enable-profile Enable profiling support (add -pg to CFLAGS)],
216 [peak_cv_enable_profile=$enable_profile],
217 [AC_CACHE_VAL(peak_cv_enable_profile,
218 [peak_cv_enable_profile=no])])
219 AC_MSG_RESULT([$peak_cv_enable_profile])
220
221 if test x"$peak_cv_enable_profile" = xyes; then
222 CFLAGS="-pg $CFLAGS"
223 fi
224
225
226 dnl Now check for --enable-pedantic
227 AC_MSG_CHECKING([whether to enable pedantic compiler warnings])
228 AC_ARG_ENABLE([pedantic],
229 [ --enable-pedantic Enable pedantic warnings (add -pedantic to CFLAGS)],
230 [peak_cv_enable_pedantic=$enable_pedantic],
231 [AC_CACHE_VAL(peak_cv_enable_pedantic,
232 [peak_cv_enable_pedantic=no])])
233 AC_MSG_RESULT([$peak_cv_enable_pedantic])
234
235 if test x"$peak_cv_enable_pedantic" = xyes; then
236 CFLAGS="-pedantic $CFLAGS"
237 fi
238
239 dnl Now check for --enable-uniprocessor-only
240 AC_MSG_CHECKING([whether to enable uniprocessor-only code])
241 AC_ARG_ENABLE([uniprocessor-only],
242 [ --enable-uniprocessor-only Enable uniprocessor-only code optimization
243 Warning: library binary no more SMP safe
244 [[default=no]]],
245 [peak_cv_enable_uniprocessor_only=$enable_uniprocessor_only],
246 [AC_CACHE_VAL(peak_cv_enable_uniprocessor_only,
247 [peak_cv_enable_uniprocessor_only=no])])
248 AC_MSG_RESULT([$peak_cv_enable_uniprocessor_only])
249
250 if test x"$peak_cv_enable_uniprocessor_only" = xyes; then
251 AC_DEFINE_UNQUOTED(PEAK_CONFIG_UNIPROCESSOR, 1, [Enable uniprocessor-only code.])
252 fi
253
254
255 dnl --with-default-maxfds
256 peak_default_maxfds=256
257 AC_MSG_CHECKING([for default maxfds flavor])
258 AC_ARG_WITH([default-maxfds],
259 [ --with-default-maxfds=MAXFDS Default MAXFDS flavor number [[default=256]]],
260 [peak_cv_with_default_maxfds=$with_default_maxfds],
261 [AC_CACHE_VAL(peak_cv_with_default_maxfds,
262 [peak_cv_with_default_maxfds=$peak_default_maxfds])])
263
264 if test x"$peak_cv_with_default_maxfds" = xyes -o x"$peak_cv_with_default_maxfds" = xno; then
265 peak_cv_with_default_maxfds=$peak_default_maxfds
266 fi
267 AC_MSG_RESULT([$peak_cv_with_default_maxfds])
268 AC_DEFINE_UNQUOTED(PEAK_DEFAULT_FLAVOR_MAXFDS, $peak_cv_with_default_maxfds,
269 [Default maxfds flavor number])
270
271
272 if test $peak_engine = "select"; then
273
274 dnl --with-select-maxfds allows us to set the number of fds for systems that support
275 dnl it and with the select engine only
276 AC_MSG_CHECKING([for max fds for select])
277 AC_ARG_WITH([select-maxfds],
278 [ --with-select-maxfds=MAXFDS Maximum number of fds the library can handle
279 (make sense for select engine only)
280 [[default=FD_SETSIZE]]],
281 [select_maxfds=$with_select_maxfds])
282
283 if test -n "$select_maxfds"; then
284 AC_MSG_RESULT([$select_maxfds])
285 AC_DEFINE_UNQUOTED(PEAK_FD_SETSIZE, $peak_cv_with_select_maxfds,
286 [Maximum number of fds the library can handle with select])
287 else
288 AC_MSG_RESULT([n/a])
289 fi
290
291 fi
292
293
294 dnl We need another host scan for atomic.h configuration
295 ATOMIC_HEADERS=
296 case "$host" in
297 *-*-aix*)
298 if test x"$ac_cv_header_atomic_op_h" = xyes; then
299 ATOMIC_HEADERS=[#include <sys/atomic_op.h> /* AIX */]
300 fi
301 ;;
302 i*86-* | x86-*)
303 if test x"$peak_cv_enable_uniprocessor_only" = xyes; then
304 ATOMIC_HEADERS=[#define PEAK_CONFIG_UNIPROCESSOR]
305 fi
306 ;;
307 *)
308 ;;
309 esac
310 AC_SUBST(ATOMIC_HEADERS)
311
312
313 PEAK_CFLAGS=
314 PEAK_LIBS=-lpeak
315 PEAK_LIBDEPS=$LIBS
316 PEAK_VERSION=$PACKAGE_VERSION
317
318 AC_CONFIG_LIBCONFIG_IN([peak])
319
320 AC_CONFIG_FILES([Makefile peak-config peak/Makefile tests/Makefile
321 peak/arch/ia64/atomic.h
322 peak/arch/ia64/spinlock.h
323 peak/arch/m68k/atomic.h
324 peak/arch/m68k/spinlock.h
325 peak/arch/powerpc/atomic.h
326 peak/arch/powerpc/spinlock.h
327 peak/arch/sparc/atomic.h
328 peak/arch/sparc/spinlock.h
329 peak/arch/x86/atomic.h
330 peak/arch/x86/spinlock.h])
331
332 AC_OUTPUT
333
334 eval e_bindir=${bindir}; eval e_bindir=${e_bindir}
335 eval e_includedir=${includedir}; eval e_includedir=${e_includedir}
336 eval e_libdir=${libdir}; eval e_libdir=${e_libdir}
337 AC_MSG_RESULT([
338 PEAK library compile-time configuration done.
339
340 Installation base directory: ${prefix}
341 Installation binary directory: ${e_bindir}
342 Installation include directory: ${e_includedir}
343 Installation library directory: ${e_libdir}
344 Architecture: ${arch}
345 Engine module: ${peak_engine}
346
347 Type 'make' to compile the library
348 then 'make check' to compile and run the test suite (optional)
349 then 'make install' to install libpeak.])
350